Extracted focus to SpriteObject for joker selling - WIP

This commit is contained in:
MeirGavish
2025-08-15 10:38:20 +03:00
parent 5ef7fa49aa
commit 06dc4f9c62
3 changed files with 27 additions and 19 deletions
+16
View File
@@ -8,6 +8,7 @@
#define MAX_SPRITES 128
#define MAX_AFFINES 32
#define SPRITE_FOCUS_RAISE_PX 10
OBJ_ATTR obj_buffer[MAX_SPRITES];
OBJ_AFFINE *obj_aff_buffer = (OBJ_AFFINE*)obj_buffer;
@@ -239,3 +240,18 @@ Sprite* sprite_object_get_sprite(SpriteObject* sprite_object)
return NULL;
return sprite_object->sprite;
}
void sprite_object_set_focus(SpriteObject* sprite_object, bool focus)
{
if (sprite_object->focused == focus)
{
return;
}
sprite_object->ty = sprite_object->ty + (focus ? -1 : 1) * SPRITE_FOCUS_RAISE_PX;
}
bool sprite_object_is_focused(SpriteObject* sprite_object)
{
return sprite_object->focused;
}