27 lines
569 B
C
27 lines
569 B
C
#include "entity_menu_button.h"
|
|
|
|
/* Initializes a menu_button entity. */
|
|
void
|
|
entity_menu_button_init(ECS* ecs, u32 id, vec3 position, MenuButtonType type)
|
|
{
|
|
ComponentButton* button;
|
|
ComponentSprite* sprite;
|
|
|
|
button = ecs_component_add(ecs, ECS_COMPONENT_BUTTON, id);
|
|
|
|
component_button_init
|
|
(
|
|
button,
|
|
ecs,
|
|
ecs->game->resources.textures[TEXTURE_MENU_BUTTONS],
|
|
(s32*)MENU_BUTTON_FRAME_SIZE,
|
|
(s32*)MENU_BUTTON_ATLAS_SIZE,
|
|
(f32*)MENU_BUTTON_SIZE,
|
|
position
|
|
);
|
|
|
|
sprite = ecs_component_get(ecs, ECS_COMPONENT_SPRITE, id);
|
|
|
|
sprite->atlas.index = type;
|
|
}
|