2024-09-09 12:54:06 +00:00
|
|
|
#include <voxula/internals/core.h>
|
|
|
|
|
2024-09-09 22:16:06 +00:00
|
|
|
void vx_handle_window_close(vx_window_s *window, vx_window_event_s event)
|
|
|
|
{
|
|
|
|
if(event.type == VX_WINDOW_EVENT_CLOSE)
|
|
|
|
{
|
|
|
|
vx_core_s *core = window->userdata;
|
|
|
|
core->input_controller->running = false;
|
|
|
|
vx_win_hide(core->main_window);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(event.type == VX_WINDOW_EVENT_QUIT)
|
|
|
|
{
|
|
|
|
vx_core_s *core = window->userdata;;
|
|
|
|
core->input_controller->running = false;
|
|
|
|
core->running = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-09 12:54:06 +00:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2024-09-09 22:16:06 +00:00
|
|
|
if(argc > 1)
|
|
|
|
{
|
|
|
|
if( ! strcmp(argv[1], "--help"))
|
|
|
|
{
|
|
|
|
puts("The Voxula voxel-game engine.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
vx_core_s core;
|
|
|
|
core.uuid_table = vx_new_uuid_table();
|
|
|
|
core.input_controller = vx_new_input_controller();
|
|
|
|
core.main_window = vx_new_window(core.input_controller);
|
|
|
|
core.main_window->fn_handle_input = vx_handle_window_close;
|
|
|
|
core.main_window->userdata = &core;
|
|
|
|
core.running = true;
|
|
|
|
vx_start_input_controller(core.input_controller);
|
|
|
|
while(core.running)
|
|
|
|
{
|
|
|
|
vx_win_show(core.main_window);
|
|
|
|
vx_win_present(core.main_window);
|
|
|
|
SDL_Delay(1000 / 30);
|
|
|
|
}
|
|
|
|
vx_free_window(core.main_window);
|
|
|
|
|
|
|
|
return 0;
|
2024-09-09 12:54:06 +00:00
|
|
|
}
|