diff --git a/src/experimental/meshlets/main.cpp b/src/experimental/meshlets/main.cpp index 7c047e6..3acf7c7 100644 --- a/src/experimental/meshlets/main.cpp +++ b/src/experimental/meshlets/main.cpp @@ -234,7 +234,5 @@ LOAD_GAME_API_FUNC { .Update = MeshletsUpdate, .Render = MeshletsRender, .OnGameObjectFree = NULL, - .OnReload = NULL, - .OnUnload = NULL, }; } diff --git a/src/launcher/game_api.h b/src/launcher/game_api.h index adf7115..9880d1d 100644 --- a/src/launcher/game_api.h +++ b/src/launcher/game_api.h @@ -66,12 +66,6 @@ typedef struct { /* Called by rt_laucher_api::AllocGameObject, if an old object is freed. */ rt_game_on_game_object_free_fn *OnGameObjectFree; - - /* Called after the game was reloaded during live re-compilation */ - rt_game_on_reload_fn *OnReload; - - /* Called before the game gets unloaded during live re-compilation */ - rt_game_on_unload_fn *OnUnload; } rt_game_api; diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 9b12bc7..364b1c0 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -17,11 +17,15 @@ #include #include #include +#include + #include #include +#include #include "game_api.h" + RT_CVAR_S(rt_Renderer, "The used renderer. Available options: vk, dx11. (Default: vk)", "vk"); RT_CVAR_S(rt_WindowTitle, "The title used for the game window. (Default: rtengine)", "rtengine"); RT_CVAR_I(rt_WindowWidth, "The window width. (Default: 1024)", 1024); @@ -37,7 +41,7 @@ RT_CVAR_I(rt_LauncherCreateGLContext, "Create an OpenGL context in the launcher. RT_CVAR_I(rt_LauncherGLContextMajor, "OpenGL Major version. (Default: 4)", 4); RT_CVAR_I(rt_LauncherGLContextMinor, "OpenGL minor version. (Default: 5)", 5); -RT_CVAR_S(rt_GameLib, "Path to the game library. Only usable in internal builds. (Default: "")", ""); +RT_CVAR_S(rt_GameLib, "Path to the game library. Only usable in internal builds. (Default: \"\")", ""); enum { WINDOW_MODE_WINDOWED, @@ -52,6 +56,10 @@ enum { #endif static rt_dynlib *_game_lib = NULL; +static rt_game_api _game; +static rt_window _window; +static void *_game_obj = NULL; +static rt_launcher_api _launcher_api; #ifdef _WIN32 static HINSTANCE _hInstance; @@ -128,6 +136,15 @@ static void __NullGame_Shutdown(rt_launcher_api *api, void *game_obj) {} static void __NullGame_Update(rt_launcher_api *api, rt_time_delta delta, void *game_obj) { RT_UNUSED(delta); } static void __NullGame_Render(rt_launcher_api *api, void *game_obj) {} +static rt_game_api _null_api = { + .RegisterCVARs = __NullGame_RegisterCVARs, + .Init = __NullGame_Init, + .Shutdown = __NullGame_Shutdown, + .Update = __NullGame_Update, + .Render = __NullGame_Render, + .OnGameObjectFree = NULL, +}; + static rt_game_api LoadGame(const char *cmdline_gamelib) { const char *game_lib = RT_GAME_LIB_PATH; #ifdef RT_DEBUG @@ -140,9 +157,6 @@ static rt_game_api LoadGame(const char *cmdline_gamelib) { #endif if (strcmp(game_lib, "(null)") != 0) { -#if defined(RT_DEBUG) && !defined(RT_DISABLE_LIVE_RECOMPILATION) - /* Copy to temporary location to enable rebuilds */ -#endif _game_lib = rtOpenLib(game_lib); if (!_game_lib) { rtReportError("LAUNCHER", "Failed to open game library: %s", game_lib); @@ -160,23 +174,9 @@ static rt_game_api LoadGame(const char *cmdline_gamelib) { out: /* Fall back to null implementation. */ - return (rt_game_api){ - .RegisterCVARs = __NullGame_RegisterCVARs, - .Init = __NullGame_Init, - .Shutdown = __NullGame_Shutdown, - .Update = __NullGame_Update, - .Render = __NullGame_Render, - .OnGameObjectFree = NULL, - .OnReload = NULL, - .OnUnload = NULL, - }; + return _null_api; } -static rt_game_api _game; -static rt_window _window; -static void *_game_obj = NULL; -static rt_launcher_api _launcher_api; - static rt_window LauncherAPIGetWindow(void) { return _window; } @@ -367,10 +367,6 @@ static int Entry(int argc, char **argv) { rt_timestamp previous = rtTimeNow(); rt_time_delta lag = time_per_update; while (!glfwWindowShouldClose(window)) { -#ifdef RT_DEBUG - -#endif - glfwPollEvents(); rt_timestamp current = rtTimeNow(); @@ -387,7 +383,6 @@ static int Entry(int argc, char **argv) { int disp_w, disp_h; glfwGetFramebufferSize(window, &disp_w, &disp_h); - rtLog("LAUNCHER", "%d %d", disp_w, disp_h); _game.Render(&_launcher_api, _game_obj); if (rt_LauncherCreateGLContext.i) {