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