mirror of
https://github.com/AntonioND/nitro-engine.git
synced 2025-06-18 16:45:33 -04:00
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:
parent
3af40682cb
commit
a7f8353bac
@ -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);
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user