Files
frillrun/src/game/ecs/component/visual/component_dialogue.h
2024-08-24 00:47:58 -04:00

58 lines
1.2 KiB
C

#pragma once
#include "component_text.h"
#include "../../entity/utility/entity_timer.h"
static const u32 COMPONENT_DIALOGUE_SPEED_DEFAULT = 3;
static const u32 COMPONENT_DIALOGUE_SKIP_TIMER_VALUE = 1;
typedef struct ComponentDialogue
{
Component component;
char string[COMPONENT_TEXT_STRING_MAX];
u32 speed;
u32 index;
u32 length;
bool isFinished;
EntityID timerID;
EntityID skipTimerID;
} ComponentDialogue;
void component_dialogue_add(ComponentDialogue* self, ECS* ecs);
void component_dialogue_delete(ComponentDialogue* self, ECS* ecs);
void component_dialogue_tick(ComponentDialogue* self, ECS* ecs);
void component_dialogue_string_set(ComponentDialogue* self, ECS* ecs);
void
component_dialogue_init
(
ComponentDialogue* self,
ECS* ecs,
const char* string,
u32 speed
);
#define COMPONENT_DIALOGUE_DEPENDENCY_COUNT 1
static const ComponentType COMPONENT_DIALOGUE_DEPENDENCIES[COMPONENT_DIALOGUE_DEPENDENCY_COUNT] =
{
COMPONENT_TEXT
};
static const ComponentInfo COMPONENT_DIALOGUE_INFO =
{
.system =
{
.functions =
{
(ECSFunction)component_dialogue_add,
(ECSFunction)component_dialogue_delete,
(ECSFunction)component_dialogue_tick,
NULL,
NULL
}
},
.type = COMPONENT_DIALOGUE,
.size = sizeof(ComponentDialogue)
};