24 sprite->image = image;
25 sprite->params.pos.x = 0.0f;
26 sprite->params.pos.y = 0.0f;
27 sprite->params.pos.w = image.subtex->width;
28 sprite->params.pos.h = image.subtex->height;
29 sprite->params.center.x = 0.0f;
30 sprite->params.center.y = 0.0f;
31 sprite->params.angle = 0.0f;
32 sprite->params.depth = 0.0f;
52 sprite->params.pos.w *= x;
53 sprite->params.pos.h *= y;
54 sprite->params.center.x *= x;
55 sprite->params.center.y *= y;
64 sprite->params.angle += radians;
83 sprite->params.pos.x += x;
84 sprite->params.pos.y += y;
94 float oldCenterX = sprite->params.center.x / sprite->params.pos.w;
95 float oldCenterY = sprite->params.center.y / sprite->params.pos.h;
96 sprite->params.pos.w = x*sprite->image.subtex->width;
97 sprite->params.pos.h = y*sprite->image.subtex->height;
98 sprite->params.center.x = fabsf(oldCenterX*sprite->params.pos.w);
99 sprite->params.center.y = fabsf(oldCenterY*sprite->params.pos.h);
108 sprite->params.angle = radians;
127 sprite->params.center.x = x*sprite->params.pos.w;
128 sprite->params.center.y = y*sprite->params.pos.h;
138 sprite->params.center.x = x;
139 sprite->params.center.y = y;
149 sprite->params.pos.x = x;
150 sprite->params.pos.y = y;
159 sprite->params.depth = depth;
static void C2D_SpriteSetScale(C2D_Sprite *sprite, float x, float y)
Scale sprite (absolute)
Definition: sprite.h:92
C2D_Image C2D_SpriteSheetGetImage(C2D_SpriteSheet sheet, size_t index)
Retrieves the specified image from the specified sprite sheet.
static void C2D_SpriteRotateDegrees(C2D_Sprite *sprite, float degrees)
Rotate sprite (relative)
Definition: sprite.h:71
static void C2D_SpriteSetCenterRaw(C2D_Sprite *sprite, float x, float y)
Set the center of a sprite in terms of pixels (absolute)
Definition: sprite.h:136
static bool C2D_DrawSprite(const C2D_Sprite *sprite)
Draw sprite.
Definition: sprite.h:165
static void C2D_SpriteRotate(C2D_Sprite *sprite, float radians)
Rotate sprite (relative)
Definition: sprite.h:62
bool C2D_DrawImage(C2D_Image img, const C2D_DrawParams *params, const C2D_ImageTint *tint C2D_OPTIONAL(nullptr))
Draws an image using the GPU (variant accepting C2D_DrawParams)
static void C2D_SpriteSetPos(C2D_Sprite *sprite, float x, float y)
Move sprite (absolute)
Definition: sprite.h:147
static void C2D_SpriteSetDepth(C2D_Sprite *sprite, float depth)
Sets the depth level of a sprite (absolute)
Definition: sprite.h:157
static void C2D_SpriteSetRotation(C2D_Sprite *sprite, float radians)
Rotate sprite (absolute)
Definition: sprite.h:106
static bool C2D_DrawSpriteTinted(const C2D_Sprite *sprite, const C2D_ImageTint *tint)
Draw sprite with color tinting.
Definition: sprite.h:174
Spritesheet (texture atlas) loading and management.
static void C2D_SpriteSetCenter(C2D_Sprite *sprite, float x, float y)
Set the center of a sprite in values independent of the sprite size (absolute)
Definition: sprite.h:125
static void C2D_SpriteFromImage(C2D_Sprite *sprite, C2D_Image image)
Initializes a sprite from an image.
Definition: sprite.h:22
static void C2D_SpriteScale(C2D_Sprite *sprite, float x, float y)
Scale sprite (relative)
Definition: sprite.h:50
static void C2D_SpriteMove(C2D_Sprite *sprite, float x, float y)
Move sprite (relative)
Definition: sprite.h:81
static void C2D_SpriteSetRotationDegrees(C2D_Sprite *sprite, float degrees)
Rotate sprite (absolute)
Definition: sprite.h:115
static void C2D_SpriteFromSheet(C2D_Sprite *sprite, C2D_SpriteSheet sheet, size_t index)
Initializes a sprite from an image stored in a sprite sheet.
Definition: sprite.h:40