#pragma once

#include "../../../GAME_COMMON.h"
#include "../../../input/input.h"
#include "../../ecs_entity.h"
#include "../component_sprite.h"

#include "../../../../engine/rectangle.h"

static const vec4 COMPONENT_BUTTON_COLOR_UNSELECTED = {1.0f, 1.0f, 1.0f, 1.0f};
static const vec4 COMPONENT_BUTTON_COLOR_HOVER = {0.75f, 0.75f, 0.75f, 1.0f};
static const vec4 COMPONENT_BUTTON_COLOR_PRESSED = {0.5f, 0.5, 0.5f, 1.0f};

typedef enum ButtonState
{
	BUTTON_UNSELECTED,
	BUTTON_HOVER,
	BUTTON_PRESSED
} ButtonState; 

typedef struct ComponentButton
{
	ECSComponent component;
	ButtonState state;
} ComponentButton;

void
component_button_init
(
	ComponentButton* self, 
	ECS* ecs,
	Texture texture, 
	ivec2 frameSize,
	ivec2 atlasSize,
	vec2 size, 
	vec3 position
);

void component_button_add(ComponentButton* self, ECS* ecs);
void component_button_delete(ComponentButton* self, ECS* ecs);
void component_button_tick(ComponentButton* self, ECS* ecs);

static const ECSComponentInfo COMPONENT_BUTTON_INFO = 
{
	.system = 
	{
		.functions = 
		{ 
			(ECSFunction)component_button_add, 
			(ECSFunction)component_button_delete, 
			(ECSFunction)component_button_tick, 
			NULL
		}
	},
	.type = ECS_COMPONENT_BUTTON,
	.size = sizeof(ComponentButton)
};


