#include "entity_tutorial_text.h"

/* Initializes a player entity. */
void
entity_tutorial_text_init(ECS* ecs, u32 id, vec3 position)
{
	ComponentActionDeleteOnTimer* actionDeleteOnTimer;
	ComponentAnimationColorChange* animationColorChange;
	ComponentText* text;
	f32 base;

	text = ecs_component_add(ecs, ECS_COMPONENT_TEXT, id);
	actionDeleteOnTimer = ecs_component_add(ecs, ECS_COMPONENT_ACTION_DELETE_ON_TIMER, id);
	animationColorChange = ecs_component_add(ecs, ECS_COMPONENT_ANIMATION_COLOR_CHANGE, id);

	component_text_init
	(
		text,
		&ecs->game->resources.fonts[FONT_HUD],
		STRING_TUTORIAL_TEXT,
		strlen(STRING_TUTORIAL_TEXT),
		ENTITY_TUTORIAL_TEXT_WRAP,
		position,
		(f32*)COLOR_OPAQUE
	);

	component_action_delete_on_timer_init
	(
		actionDeleteOnTimer,
		ENTITY_TUTORIAL_TEXT_TIMER
	);

	component_animation_color_change_init
	(
		animationColorChange,
		(f32*)COLOR_TRANSPARENT,
		(f32*)COLOR_OPAQUE,
		ENTITY_TUTORIAL_TEXT_TIMER,
		ANIMATION_COLOR_CHANGE_MODE_STICK
	);
}
