Add underscore prefix to globals in game.h

This commit is contained in:
2023-12-21 16:02:40 +01:00
parent 852a3f7b5a
commit 886d6ba79b

View File

@@ -63,28 +63,28 @@ static void bzRaylibLogger(int msgType, const char *text, va_list args) {
bzLoggerOnlyLogV(level, text, args); bzLoggerOnlyLogV(level, text, args);
} }
static BzAppDesc appDesc = {0, 0}; static BzAppDesc _appDesc;
static bool running = true; static bool _running = true;
void bzGameExit() { void bzGameExit() {
running = false; _running = false;
} }
static void bzGameLoopTick() { static void bzGameLoopTick() {
float dt = GetFrameTime(); float dt = GetFrameTime();
if (appDesc.update) if (_appDesc.update)
appDesc.update(dt, appDesc.userData); _appDesc.update(dt, _appDesc.userData);
//if (ECS) //if (ECS)
// ecs_progress(ECS, dt); // ecs_progress(ECS, dt);
BeginDrawing(); BeginDrawing();
if (appDesc.render) if (_appDesc.render)
appDesc.render(dt, appDesc.userData); _appDesc.render(dt, _appDesc.userData);
if (appDesc.imguiRender) { if (_appDesc.imguiRender) {
rlImGuiBegin(); rlImGuiBegin();
appDesc.imguiRender(dt, appDesc.userData); _appDesc.imguiRender(dt, _appDesc.userData);
rlImGuiEnd(); rlImGuiEnd();
} }
EndDrawing(); EndDrawing();
@@ -99,48 +99,48 @@ int main(int argc, const char **argv) {
SetTraceLogCallback(bzRaylibLogger); SetTraceLogCallback(bzRaylibLogger);
appDesc = (BzAppDesc){ _appDesc = (BzAppDesc){
1280, 1280,
720, 720,
"Breeze Engine", "Breeze Engine",
60 60
}; };
bool successful = bzMain(&appDesc, argc, argv); bool successful = bzMain(&_appDesc, argc, argv);
if (!successful) return 1; if (!successful) return 1;
// Validate // Validate
if (!appDesc.render) { if (!_appDesc.render) {
bzLogFatal("[Breeze] No render function specifies."); bzLogFatal("[Breeze] No render function specifies.");
return 1; return 1;
} }
bzLogInfo("[Breeze] User initialization (bzMain) successful."); bzLogInfo("[Breeze] User initialization (bzMain) successful.");
InitWindow(appDesc.width, appDesc.height, appDesc.title); InitWindow(_appDesc.width, _appDesc.height, _appDesc.title);
SetTargetFPS(appDesc.fps); SetTargetFPS(_appDesc.fps);
// Initialize modules // Initialize modules
if (appDesc.imguiRender) if (_appDesc.imguiRender)
rlImGuiSetup(true); rlImGuiSetup(true);
// User initialize // User initialize
if (appDesc.init && !appDesc.init(appDesc.userData)) { if (_appDesc.init && !_appDesc.init(_appDesc.userData)) {
return 1; return 1;
} }
#ifdef PLATFORM_WEB #ifdef PLATFORM_WEB
emscripten_set_main_loop(bzGameLoopTick, 0, 1); emscripten_set_main_loop(bzGameLoopTick, 0, 1);
#else #else
while (!WindowShouldClose() && running) { while (!WindowShouldClose() && _running) {
bzGameLoopTick(); bzGameLoopTick();
} }
// User deinitialize // User deinitialize
if (appDesc.deinit) if (_appDesc.deinit)
appDesc.deinit(appDesc.userData); _appDesc.deinit(_appDesc.userData);
// Deinitialize modules // Deinitialize modules
if (appDesc.imguiRender) if (_appDesc.imguiRender)
rlImGuiShutdown(); rlImGuiShutdown();
CloseWindow(); CloseWindow();