#include "component_animation_cursor.h"

/* Ticks animation cursor component. */
void
component_animation_cursor_tick(ComponentAnimationCursor* self, ECS* ecs)
{
	DrawObject* drawObject;
	drawObject = ecs_component_get(ecs, ECS_COMPONENT_SPRITE, self->component.id);
	vec2 mousePosition;
	
	if (!drawObject)
		drawObject = ecs_component_get(ecs, ECS_COMPONENT_TEXT, self->component.id);

	mouse_world_position_get(&ecs->game->input.mouse, &ecs->game->renderer, mousePosition);

	drawObject->position[0] = mousePosition[0];
	drawObject->position[1] = mousePosition[1];
	drawObject->position[2] = 0.0f;
}
