#pragma once

// ::Game::Types::Header::

typedef struct gUICtx
{
	rUIVertex *vertices;
	u32 vertices_len;
	u32 *indices;
	u32 indices_len;
	u32 instance_count;
	b8 	has_grabbed;
} gUICtx;

typedef struct gWindowWidget
{
	Vec2 p0;
	Vec2 p1;
	Vec2 grabbed_pos;
	u64 id;
	b8 grabbed;
} gWindowWidget;

typedef struct gButtonWidget
{
	Vec2 p0;
	Vec2 p1;
	u64	 id;
	b8 	 pressed;
	b8 	 pressed_prev;
} gButtonWidget;

typedef struct gGameCtx
{
	gUICtx gui;
	rPushConst  pc;
	Arena      *arena;
	gWindowWidget  *windows;
	u32        window_len;
	gButtonWidget  *buttons;
	u32        btn_len;
} gGameCtx;

// ::Game::Init::Functions::Header::

static void gInit(gGameCtx *ctx);
static void gDestroy();

// ::Game::GameLoop::Functions::Header::

static void gRunCycle(gGameCtx *ctx, pGameInput *inputs, u32 i_count);

// ::Game::Inputs::Functions::Header::

static void gHandleInputs(pGameInput *inputs, u32 count);

// ::Game::GUI::Functions::Header::

static inline void gPrepareGUICtx(gGameCtx *ctx);
static void gRect(gUICtx *ctx, Vec2 p0, Vec2 p1, Vec4 col, rDescHandle handle);
static b32 gWindow(gGameCtx *ctx, c8 *title, f32 x0, f32 y0, f32 x1, f32 y1, rDescHandle handle);
static b32 gButton(gGameCtx *ctx, c8 *label, f32 x0, f32 y0, f32 x1, f32 y1);
