#ifdef _WIN32

#include "entry_windows.h"

#include "platform/platform.c"
#include "ds.c"
#include "util.c"
#include "allocators.c"
#include "renderer.c"
#include "game.c"

int CALLBACK WinMain(HINSTANCE instance, HINSTANCE prev_instance, LPSTR cmd_line, int show_code)
{
	win32_instance = instance;

#ifdef BUILD_DEBUG
	{
		AllocConsole();
	}
#endif

	u8 *mem = (u8 *)MemAllocZeroed(MB(32));
	Arena *arena = CreateArenaDebug(mem, MB(32), 1);

	isize renderer_mem_size = MB(16);
	isize game_mem_size = MB(16);

	rawptr renderer_mem = ArenaAlloc(arena, renderer_mem_size);
	Arena *renderer_arena = CreateArenaDebug(renderer_mem, renderer_mem_size, 2);

	rawptr game_mem = ArenaAlloc(arena, game_mem_size);
	Arena *game_arena = CreateArenaDebug(game_mem, game_mem_size, 3);

	Assert(CreatePlatformWindow(WINDOW_NAME), "Failed to initialize window");

	GameInput *inputs = MakeArray(arena, GameInput, 10);
	u32 i_count = 0;
	
	InitializeGame(renderer_arena);

	while (!global_quit)
	{
		GetWindowEvents();
		RunCycle(game_arena, inputs, i_count);
	}

	DestroyGame();
}

#endif // _WIN32
