#include "app.h" #include "physics.h" #include "res.h" #include "ent.h" #include "game.h" #include "env.h" #include "cam.h" #include "editor.h" #define RAYGUI_IMPLEMENTATION #include "raygui.h" App app = {0}; static void app_init(void) { SetTraceLogLevel(LOG_WARNING); SetConfigFlags(FLAG_MSAA_4X_HINT | FLAG_VSYNC_HINT | FLAG_WINDOW_RESIZABLE); InitWindow(1280, 720, "Fun Game"); SetExitKey(KEY_NULL); SetTargetFPS(60); app.run = true; FLAG_SET(app.flags, BIT(APP_FLAG_EDIT)); FLAG_SET(app.flags, BIT(APP_FLAG_DEBUG)); physics_init(); res_init(); env_init(); entity_system_init(); game_init(); editor_init(); cam_init(); } static void app_exit(void) { editor_exit(); game_exit(); entity_system_exit(); env_exit(); res_exit(); physics_exit(); } static void app_loop(void) { app.run = !WindowShouldClose(); /* this is some hypothetical bullshit, probably will change */ if (app.mode != APP_MODE_PLAY) { editor_update(); } physics_update(); res_update(); env_update(); entity_system_update(); BeginDrawing(); ClearBackground(RAYWHITE); env_draw_sky(main_cam.cam); BeginMode3D(main_cam.cam); entity_system_draw_3d(); EndMode3D(); if (FLAG_CHECK(app.flags, BIT(APP_FLAG_DEBUG)) || FLAG_CHECK(app.flags, BIT(APP_FLAG_EDIT))) { BeginMode3D(main_cam.cam); rlDisableDepthTest(); editor_draw_3d(); EndMode3D(); } editor_draw_ui(); EndDrawing(); } int main(void) { app_init(); while (app.run) { app_loop(); } app_exit(); return 0; }