Changes to sprite animation system

* Changed the names of some of the functions
* Added functions for setting and returning the projection matrix of the active camera
* Added a function for getting the 2D screen coordinates from a 3D vector
* Added documentation for all the new functions
This commit is contained in:
n00b
2024-10-18 23:12:42 -04:00
parent 8f372bdf19
commit 5762c171ae
58 changed files with 457 additions and 5 deletions

View File

@@ -204,7 +204,7 @@ int rc_getSpriteAnimation(int spr_id)
return rc_sprite[spr_id].current_animation;
}
int rc_getSpriteActiveAnimationFrame(int spr_id)
int rc_getSpriteCurrentAnimationFrame(int spr_id)
{
if(spr_id < 0 || spr_id >= rc_sprite.size())
return -1;
@@ -216,7 +216,7 @@ int rc_getSpriteActiveAnimationFrame(int spr_id)
return rc_sprite[spr_id].animation[current_animation].current_frame;
}
void rc_loopSpriteAnimation(int spr_id, int num_loops)
void rc_setSpriteAnimationLoops(int spr_id, int num_loops)
{
if(spr_id < 0 || spr_id >= rc_sprite.size())
return;
@@ -391,6 +391,41 @@ void rc_deleteSprite(int spr_id)
}
}
void rc_setSpriteSource(int spr_id, int img_id)
{
if(spr_id < 0 || spr_id >= rc_sprite.size())
return;
if(!rc_sprite[spr_id].active)
return;
if(img_id < 0)
{
rc_sprite[spr_id].image_id = -1;
return;
}
if(img_id >= rc_image.size())
return;
if(!rc_image[img_id].image)
return;
rc_sprite[spr_id].image_id = img_id;
}
int rc_getSpriteSource(int spr_id)
{
if(spr_id < 0 || spr_id >= rc_sprite.size())
return -1;
if(!rc_sprite[spr_id].active)
return -1;
return rc_sprite[spr_id].image_id;
}
void rc_setSpriteType(int spr_id, int body_type)
{
if(spr_id < 0 || spr_id >= rc_sprite.size())
@@ -402,6 +437,17 @@ void rc_setSpriteType(int spr_id, int body_type)
rc_sprite[spr_id].physics.body->SetType((b2BodyType) body_type);
}
int rc_getSpriteType(int spr_id)
{
if(spr_id < 0 || spr_id >= rc_sprite.size())
return -1;
if(!rc_sprite[spr_id].active)
return -1;
return (int)rc_sprite[spr_id].physics.body->GetType();
}
void rc_setSpriteSolid(int spr_id, bool flag)
{
if(spr_id < 0 || spr_id >= rc_sprite.size())