library: Set sprite size to the texture size it is assigned

What most people will want to do is to draw sprites with the same size as
the texture, so do that by default.
This commit is contained in:
Antonio Niño Díaz 2024-02-28 02:50:29 +00:00
parent 3af40682cb
commit a7f8353bac
2 changed files with 6 additions and 0 deletions

View File

@ -85,6 +85,9 @@ void NE_SpriteSetScaleI(NE_Sprite *sprite, int scale);
/// Assign a material to a sprite.
///
/// This will also set the size of the sprite to the size of the texture of that
/// material.
///
/// @param sprite Sprite.
/// @param mat Material.
void NE_SpriteSetMaterial(NE_Sprite *sprite, NE_Material *mat);

View File

@ -80,6 +80,9 @@ void NE_SpriteSetMaterial(NE_Sprite *sprite, NE_Material *mat)
NE_AssertPointer(sprite, "NULL sprite pointer");
NE_AssertPointer(mat, "NULL material pointer");
sprite->mat = mat;
sprite->w = NE_TextureGetSizeX(mat);
sprite->h = NE_TextureGetSizeY(mat);
}
void NE_SpriteSetPriority(NE_Sprite *sprite, int priority)