diff --git a/assets/main.rcss b/assets/main.rcss
index f194327..9fed10b 100644
--- a/assets/main.rcss
+++ b/assets/main.rcss
@@ -42,4 +42,4 @@ p {
.menu-btn:hover {
background-color: #4a7eb5;
-}
+}
\ No newline at end of file
diff --git a/assets/main.rml b/assets/main.rml
index c959486..34ef8ea 100644
--- a/assets/main.rml
+++ b/assets/main.rml
@@ -1,13 +1,15 @@
-
- gamejam
-
-
-
-
-
-
+
+
+ gamejam
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/flake.lock b/flake.lock
index 06d7f8b..7e95a84 100644
--- a/flake.lock
+++ b/flake.lock
@@ -58,4 +58,4 @@
},
"root": "root",
"version": 7
-}
+}
\ No newline at end of file
diff --git a/src/Application.cpp b/src/Application.cpp
index 4d05aaf..3dc58ea 100644
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -2,57 +2,70 @@
#include "Game.h"
#include "backend/RaylibInput.h"
-#include
#include
+#include
#include
+#include
+#include
Game game;
-bool Application::Init(int width, int height, const char* title, const char* documentPath) {
- InitWindow(width, height, title);
- SetTargetFPS(60);
+bool Application::Init(int width, int height, const char *title,
+ const char *documentPath) {
+ InitWindow(width, height, title);
+ SetTargetFPS(60);
- Rml::SetSystemInterface(&system_interface);
- Rml::SetRenderInterface(&render_interface);
- Rml::Initialise();
+ Rml::SetSystemInterface(&system_interface);
+ Rml::SetRenderInterface(&render_interface);
+ Rml::Initialise();
- context = Rml::CreateContext("main", Rml::Vector2i(width, height));
- Rml::Debugger::Initialise(context);
+ context = Rml::CreateContext("main", Rml::Vector2i(width, height));
+ Rml::Debugger::Initialise(context);
- // TODO: load a real font
+ // TODO: load a real font
- if (Rml::ElementDocument* document = context->LoadDocument(documentPath)) {
- document->Show();
- } else {
- TraceLog(LOG_WARNING, "Failed to load %s", documentPath);
- }
+ if (Rml::ElementDocument *document = context->LoadDocument(documentPath)) {
+ document->Show();
+ } else {
+ TraceLog(LOG_WARNING, "Failed to load %s", documentPath);
+ }
- game.Init(context);
+ if (!game.Init(context)) {
+ TraceLog(LOG_ERROR, "Failed to initialize game instance.");
+ return false;
+ }
- return true;
+ Rml::DataModelHandle game_data_model_handle;
+ if (!game.setup_rml_data_binding(context, game_data_model_handle,
+ game.game_data)) {
+ TraceLog(LOG_ERROR, "Failed to initialize data bindings for 'game_data'.");
+ return false;
+ }
+
+ return true;
}
void Application::Frame() {
- if (WindowShouldClose()) {
- running = false;
- return;
- }
+ if (WindowShouldClose()) {
+ running = false;
+ return;
+ }
- ForwardInputToRml(context);
- context->Update();
+ ForwardInputToRml(context);
+ context->Update();
- game.Update();
+ game.Update();
- BeginDrawing();
- ClearBackground(DARKGRAY);
+ BeginDrawing();
+ ClearBackground(DARKGRAY);
- game.Draw2D();
+ game.Draw2D();
- context->Render();
- EndDrawing();
+ context->Render();
+ EndDrawing();
}
void Application::Shutdown() {
- Rml::Shutdown();
- CloseWindow();
+ Rml::Shutdown();
+ CloseWindow();
}
\ No newline at end of file
diff --git a/src/Application.h b/src/Application.h
index 9d96ff7..acea8c8 100644
--- a/src/Application.h
+++ b/src/Application.h
@@ -1,20 +1,20 @@
#pragma once
-#include
-#include "backend/RaylibSystemInterface.h"
-#include "backend/RaylibRenderInterface.h"
#include "Game.h"
+#include "backend/RaylibRenderInterface.h"
+#include "backend/RaylibSystemInterface.h"
+#include
class Application {
public:
- bool Init(int width, int height, const char* title, const char* documentPath);
- void Frame();
- void Shutdown();
+ bool Init(int width, int height, const char *title, const char *documentPath);
+ void Frame();
+ void Shutdown();
- bool IsRunning() const { return running; }
+ bool IsRunning() const { return running; }
private:
- RaylibSystemInterface system_interface;
- RaylibRenderInterface render_interface;
- Rml::Context* context = nullptr;
- bool running = true;
+ RaylibSystemInterface system_interface;
+ RaylibRenderInterface render_interface;
+ Rml::Context *context = nullptr;
+ bool running = true;
};
\ No newline at end of file
diff --git a/src/Game.cpp b/src/Game.cpp
index affe5b0..ebd36e5 100644
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -1,20 +1,51 @@
#include "Game.h"
+#include
#include
+#include
#include
#include
-#include
-void Game::Draw2D() {return;}
+void Game::Draw2D() { return; }
-void Game::Update() {
- // TODO: Remove this debug
- std::cout << "Game update" << std::endl;
- return;
-}
+void Game::Update() { return; }
bool Game::Init(Rml::Context *context) {
- if (!ctx) return false;
-
- ctx = context;
- return true;
+ if (!ctx)
+ return false;
+
+ ctx = context;
+ return true;
+}
+
+bool Game::setup_rml_data_binding(Rml::Context *ctx,
+ Rml::DataModelHandle &model_handle,
+ GameData &game_data) {
+ Rml::DataModelConstructor dmc = ctx->CreateDataModel("game_data");
+ if (!dmc) {
+ TraceLog(LOG_ERROR, "Failed to construct data model..");
+ return false;
+ }
+
+ dmc.Bind("game_state", &game_data.game_state);
+
+ return true;
+}
+
+void Game::ResetGame() {}
+void Game::ShowMainMenu() {}
+
+void Game::TrySetGameState(GameState newState) {
+ GameState currentState = game_data.game_state;
+
+ switch (newState) {
+ case START_MENU:
+ if (currentState == IN_GAME)
+ ResetGame();
+ ShowMainMenu();
+ break;
+ default:
+ break;
+ }
+
+ game_data.game_state = newState;
}
\ No newline at end of file
diff --git a/src/Game.h b/src/Game.h
index 94f6552..62f5819 100644
--- a/src/Game.h
+++ b/src/Game.h
@@ -2,31 +2,33 @@
#include
#include
-enum GameState {
- START_MENU,
- PAUSE_MENU,
- STATS_MENU,
- OPTIONS_MENU,
- IN_GAME
-};
+enum GameState { START_MENU, PAUSE_MENU, STATS_MENU, OPTIONS_MENU, IN_GAME };
struct GameData {
- GameState game_state = START_MENU;
+ GameState game_state = START_MENU;
};
-
-
class Game {
public:
- GameData game_data;
+ GameData game_data;
- bool Init(Rml::Context *context);
+ bool Init(Rml::Context *context);
- bool setup_rml_data_binding(Rml::Context *ctx, Rml::DataModelHandle &model_handle, GameData &game_data);
+ bool setup_rml_data_binding(Rml::Context *ctx,
+ Rml::DataModelHandle &model_handle,
+ GameData &game_data);
- void Update();
- void Draw2D();
+ void Update();
+ void Draw2D();
+
+ void TrySetGameState(GameState newState);
+
+ void StartNewGame();
+ void ResetGame();
+
+ void ShowMainMenu();
+ void ShowPauseMenu();
private:
- Rml::Context *ctx = nullptr;
+ Rml::Context *ctx = nullptr;
};
\ No newline at end of file
diff --git a/src/UiCallbackListener.h b/src/UiCallbackListener.h
index 2832f35..b508ee2 100644
--- a/src/UiCallbackListener.h
+++ b/src/UiCallbackListener.h
@@ -1,22 +1,22 @@
#pragma once
+#include
#include
#include
-#include
#include
class UiCallbackListener : public Rml::EventListener {
public:
- using Callback = std::function;
- explicit UiCallbackListener(Callback callback) : callback(std::move(callback)) {}
+ using Callback = std::function;
+ explicit UiCallbackListener(Callback callback)
+ : callback(std::move(callback)) {}
- void ProcessEvent(Rml::Event& event) override {
- if (callback) callback(event);
- }
+ void ProcessEvent(Rml::Event &event) override {
+ if (callback)
+ callback(event);
+ }
- void OnDetach(Rml::Element* /*element*/) override {
- delete this;
- }
+ void OnDetach(Rml::Element * /*element*/) override { delete this; }
private:
- Callback callback;
+ Callback callback;
};
\ No newline at end of file
diff --git a/src/backend/RaylibInput.cpp b/src/backend/RaylibInput.cpp
index 7c2d267..438e386 100644
--- a/src/backend/RaylibInput.cpp
+++ b/src/backend/RaylibInput.cpp
@@ -2,24 +2,32 @@
#include
namespace {
- int GetRmlKeyModifiers() {
- int mods = 0;
- if (IsKeyDown(KEY_LEFT_SHIFT) || IsKeyDown(KEY_RIGHT_SHIFT)) mods |= Rml::Input::KM_SHIFT;
- if (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL)) mods |= Rml::Input::KM_CTRL;
- if (IsKeyDown(KEY_LEFT_ALT) || IsKeyDown(KEY_RIGHT_ALT)) mods |= Rml::Input::KM_ALT;
- return mods;
- }
-}
+int GetRmlKeyModifiers() {
+ int mods = 0;
+ if (IsKeyDown(KEY_LEFT_SHIFT) || IsKeyDown(KEY_RIGHT_SHIFT))
+ mods |= Rml::Input::KM_SHIFT;
+ if (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))
+ mods |= Rml::Input::KM_CTRL;
+ if (IsKeyDown(KEY_LEFT_ALT) || IsKeyDown(KEY_RIGHT_ALT))
+ mods |= Rml::Input::KM_ALT;
+ return mods;
+}
+} // namespace
-void ForwardInputToRml(Rml::Context* context) {
- Vector2 mouse = GetMousePosition();
- context->ProcessMouseMove((int)mouse.x, (int)mouse.y, GetRmlKeyModifiers());
+void ForwardInputToRml(Rml::Context *context) {
+ Vector2 mouse = GetMousePosition();
+ context->ProcessMouseMove((int)mouse.x, (int)mouse.y, GetRmlKeyModifiers());
- if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) context->ProcessMouseButtonDown(0, GetRmlKeyModifiers());
- if (IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) context->ProcessMouseButtonUp(0, GetRmlKeyModifiers());
- if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) context->ProcessMouseButtonDown(1, GetRmlKeyModifiers());
- if (IsMouseButtonReleased(MOUSE_BUTTON_RIGHT)) context->ProcessMouseButtonUp(1, GetRmlKeyModifiers());
+ if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
+ context->ProcessMouseButtonDown(0, GetRmlKeyModifiers());
+ if (IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
+ context->ProcessMouseButtonUp(0, GetRmlKeyModifiers());
+ if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT))
+ context->ProcessMouseButtonDown(1, GetRmlKeyModifiers());
+ if (IsMouseButtonReleased(MOUSE_BUTTON_RIGHT))
+ context->ProcessMouseButtonUp(1, GetRmlKeyModifiers());
- float wheel = GetMouseWheelMove();
- if (wheel != 0.0f) context->ProcessMouseWheel(-wheel, GetRmlKeyModifiers());
+ float wheel = GetMouseWheelMove();
+ if (wheel != 0.0f)
+ context->ProcessMouseWheel(-wheel, GetRmlKeyModifiers());
}
\ No newline at end of file
diff --git a/src/backend/RaylibInput.h b/src/backend/RaylibInput.h
index 8b553bc..b025474 100644
--- a/src/backend/RaylibInput.h
+++ b/src/backend/RaylibInput.h
@@ -1,4 +1,4 @@
#pragma once
#include
-void ForwardInputToRml(Rml::Context* context);
\ No newline at end of file
+void ForwardInputToRml(Rml::Context *context);
\ No newline at end of file
diff --git a/src/backend/RaylibRenderInterface.cpp b/src/backend/RaylibRenderInterface.cpp
index d1a9d31..affb2bb 100644
--- a/src/backend/RaylibRenderInterface.cpp
+++ b/src/backend/RaylibRenderInterface.cpp
@@ -3,107 +3,114 @@
#include
#include
-#include
#include
+#include
namespace {
- struct GeometryData {
- std::vector vertices;
- std::vector indices;
- };
+struct GeometryData {
+ std::vector vertices;
+ std::vector indices;
+};
-}
+} // namespace
-Rml::CompiledGeometryHandle RaylibRenderInterface::CompileGeometry(
- Rml::Span vertices, Rml::Span indices) {
- auto* geo = new GeometryData();
- geo->vertices.assign(vertices.begin(), vertices.end());
- geo->indices.assign(indices.begin(), indices.end());
- return reinterpret_cast(geo);
+Rml::CompiledGeometryHandle
+RaylibRenderInterface::CompileGeometry(Rml::Span vertices,
+ Rml::Span indices) {
+ auto *geo = new GeometryData();
+ geo->vertices.assign(vertices.begin(), vertices.end());
+ geo->indices.assign(indices.begin(), indices.end());
+ return reinterpret_cast(geo);
}
void RaylibRenderInterface::RenderGeometry(Rml::CompiledGeometryHandle handle,
- Rml::Vector2f translation,
- Rml::TextureHandle texture) {
- auto* geo = reinterpret_cast(handle);
+ Rml::Vector2f translation,
+ Rml::TextureHandle texture) {
+ auto *geo = reinterpret_cast(handle);
- if (texture) {
- Texture2D* tex = reinterpret_cast(texture);
- rlSetTexture(tex->id);
- } else {
- rlSetTexture(rlGetTextureIdDefault());
+ if (texture) {
+ Texture2D *tex = reinterpret_cast(texture);
+ rlSetTexture(tex->id);
+ } else {
+ rlSetTexture(rlGetTextureIdDefault());
+ }
+
+ rlPushMatrix();
+ rlTranslatef(translation.x, translation.y, 0.0f);
+
+ rlBegin(RL_TRIANGLES);
+ for (size_t i = 0; i + 2 < geo->indices.size(); i += 3) {
+ for (int j = 0; j < 3; ++j) {
+ const Rml::Vertex &v = geo->vertices[geo->indices[i + j]];
+ rlColor4ub(v.colour.red, v.colour.green, v.colour.blue, v.colour.alpha);
+ rlTexCoord2f(v.tex_coord.x, v.tex_coord.y);
+ rlVertex2f(v.position.x, v.position.y);
}
+ }
+ rlEnd();
- rlPushMatrix();
- rlTranslatef(translation.x, translation.y, 0.0f);
-
- rlBegin(RL_TRIANGLES);
- for (size_t i = 0; i + 2 < geo->indices.size(); i += 3) {
- for (int j = 0; j < 3; ++j) {
- const Rml::Vertex& v = geo->vertices[geo->indices[i + j]];
- rlColor4ub(v.colour.red, v.colour.green, v.colour.blue, v.colour.alpha);
- rlTexCoord2f(v.tex_coord.x, v.tex_coord.y);
- rlVertex2f(v.position.x, v.position.y);
- }
- }
- rlEnd();
-
- rlPopMatrix();
- rlSetTexture(0);
+ rlPopMatrix();
+ rlSetTexture(0);
}
-void RaylibRenderInterface::ReleaseGeometry(Rml::CompiledGeometryHandle handle) {
- delete reinterpret_cast(handle);
+void RaylibRenderInterface::ReleaseGeometry(
+ Rml::CompiledGeometryHandle handle) {
+ delete reinterpret_cast(handle);
}
-Rml::TextureHandle RaylibRenderInterface::LoadTexture(Rml::Vector2i& texture_dimensions,
- const Rml::String& source) {
- Texture2D tex = ::LoadTexture(source.c_str());
- if (tex.id == 0) {
- TraceLog(LOG_WARNING, "[RmlUi] failed to load texture: %s", source.c_str());
- return 0;
- }
- texture_dimensions = Rml::Vector2i(tex.width, tex.height);
- return reinterpret_cast(new Texture2D(tex));
+Rml::TextureHandle
+RaylibRenderInterface::LoadTexture(Rml::Vector2i &texture_dimensions,
+ const Rml::String &source) {
+ Texture2D tex = ::LoadTexture(source.c_str());
+ if (tex.id == 0) {
+ TraceLog(LOG_WARNING, "[RmlUi] failed to load texture: %s", source.c_str());
+ return 0;
+ }
+ texture_dimensions = Rml::Vector2i(tex.width, tex.height);
+ return reinterpret_cast(new Texture2D(tex));
}
-Rml::TextureHandle RaylibRenderInterface::GenerateTexture(Rml::Span source_data,
- Rml::Vector2i source_dimensions) {
- Image img{};
- img.width = source_dimensions.x;
- img.height = source_dimensions.y;
- img.mipmaps = 1;
- img.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
+Rml::TextureHandle
+RaylibRenderInterface::GenerateTexture(Rml::Span source_data,
+ Rml::Vector2i source_dimensions) {
+ Image img{};
+ img.width = source_dimensions.x;
+ img.height = source_dimensions.y;
+ img.mipmaps = 1;
+ img.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
- size_t byte_count = static_cast(img.width) * img.height * 4;
- img.data = RL_MALLOC(byte_count);
- std::memcpy(img.data, source_data.data(), byte_count);
+ size_t byte_count = static_cast(img.width) * img.height * 4;
+ img.data = RL_MALLOC(byte_count);
+ std::memcpy(img.data, source_data.data(), byte_count);
- Texture2D tex = LoadTextureFromImage(img);
- UnloadImage(img); // frees img.data
+ Texture2D tex = LoadTextureFromImage(img);
+ UnloadImage(img); // frees img.data
- return reinterpret_cast(new Texture2D(tex));
+ return reinterpret_cast(new Texture2D(tex));
}
void RaylibRenderInterface::ReleaseTexture(Rml::TextureHandle handle) {
- Texture2D* tex = reinterpret_cast(handle);
- UnloadTexture(*tex);
- delete tex;
+ Texture2D *tex = reinterpret_cast(handle);
+ UnloadTexture(*tex);
+ delete tex;
}
void RaylibRenderInterface::EnableScissorRegion(bool enable) {
- scissor_enabled = enable;
- if (enable) ApplyScissor();
- else EndScissorMode();
+ scissor_enabled = enable;
+ if (enable)
+ ApplyScissor();
+ else
+ EndScissorMode();
}
void RaylibRenderInterface::SetScissorRegion(Rml::Rectanglei region) {
- scissor_region = region;
- if (scissor_enabled) ApplyScissor();
+ scissor_region = region;
+ if (scissor_enabled)
+ ApplyScissor();
}
void RaylibRenderInterface::ApplyScissor() {
- BeginScissorMode(scissor_region.Left(), scissor_region.Top(),
- scissor_region.Width(), scissor_region.Height());
+ BeginScissorMode(scissor_region.Left(), scissor_region.Top(),
+ scissor_region.Width(), scissor_region.Height());
}
\ No newline at end of file
diff --git a/src/backend/RaylibRenderInterface.h b/src/backend/RaylibRenderInterface.h
index 5ca4273..7253348 100644
--- a/src/backend/RaylibRenderInterface.h
+++ b/src/backend/RaylibRenderInterface.h
@@ -1,7 +1,6 @@
#pragma once
#include
-
// NOTE: RmlUi's RenderInterface signature has shifted across versions
// (raw pointer+count vs. Rml::Span<>). If this fails to compile against
// a different RmlUi commit, check RmlUi/Core/RenderInterface.h and adjust
@@ -10,28 +9,30 @@
class RaylibRenderInterface : public Rml::RenderInterface {
public:
- Rml::CompiledGeometryHandle CompileGeometry(Rml::Span vertices,
- Rml::Span indices) override;
+ Rml::CompiledGeometryHandle
+ CompileGeometry(Rml::Span vertices,
+ Rml::Span indices) override;
- void RenderGeometry(Rml::CompiledGeometryHandle handle, Rml::Vector2f translation,
- Rml::TextureHandle texture) override;
+ void RenderGeometry(Rml::CompiledGeometryHandle handle,
+ Rml::Vector2f translation,
+ Rml::TextureHandle texture) override;
- void ReleaseGeometry(Rml::CompiledGeometryHandle handle) override;
+ void ReleaseGeometry(Rml::CompiledGeometryHandle handle) override;
- Rml::TextureHandle LoadTexture(Rml::Vector2i& texture_dimensions,
- const Rml::String& source) override;
+ Rml::TextureHandle LoadTexture(Rml::Vector2i &texture_dimensions,
+ const Rml::String &source) override;
- Rml::TextureHandle GenerateTexture(Rml::Span source_data,
- Rml::Vector2i source_dimensions) override;
+ Rml::TextureHandle GenerateTexture(Rml::Span source_data,
+ Rml::Vector2i source_dimensions) override;
- void ReleaseTexture(Rml::TextureHandle handle) override;
+ void ReleaseTexture(Rml::TextureHandle handle) override;
- void EnableScissorRegion(bool enable) override;
- void SetScissorRegion(Rml::Rectanglei region) override;
+ void EnableScissorRegion(bool enable) override;
+ void SetScissorRegion(Rml::Rectanglei region) override;
private:
- void ApplyScissor();
+ void ApplyScissor();
- bool scissor_enabled = false;
- Rml::Rectanglei scissor_region;
+ bool scissor_enabled = false;
+ Rml::Rectanglei scissor_region;
};
\ No newline at end of file
diff --git a/src/backend/RaylibSystemInterface.cpp b/src/backend/RaylibSystemInterface.cpp
index b954b5f..9adb6b3 100644
--- a/src/backend/RaylibSystemInterface.cpp
+++ b/src/backend/RaylibSystemInterface.cpp
@@ -1,14 +1,15 @@
#include "RaylibSystemInterface.h"
#include
-double RaylibSystemInterface::GetElapsedTime() {
- return GetTime();
-}
+double RaylibSystemInterface::GetElapsedTime() { return GetTime(); }
-bool RaylibSystemInterface::LogMessage(Rml::Log::Type type, const Rml::String& message) {
- TraceLogLevel level = LOG_INFO;
- if (type == Rml::Log::LT_WARNING) level = LOG_WARNING;
- if (type == Rml::Log::LT_ERROR || type == Rml::Log::LT_ASSERT) level = LOG_ERROR;
- TraceLog(level, "[RmlUi] %s", message.c_str());
- return true;
+bool RaylibSystemInterface::LogMessage(Rml::Log::Type type,
+ const Rml::String &message) {
+ TraceLogLevel level = LOG_INFO;
+ if (type == Rml::Log::LT_WARNING)
+ level = LOG_WARNING;
+ if (type == Rml::Log::LT_ERROR || type == Rml::Log::LT_ASSERT)
+ level = LOG_ERROR;
+ TraceLog(level, "[RmlUi] %s", message.c_str());
+ return true;
}
\ No newline at end of file
diff --git a/src/backend/RaylibSystemInterface.h b/src/backend/RaylibSystemInterface.h
index 4907bb4..1d2c247 100644
--- a/src/backend/RaylibSystemInterface.h
+++ b/src/backend/RaylibSystemInterface.h
@@ -3,6 +3,6 @@
class RaylibSystemInterface : public Rml::SystemInterface {
public:
- double GetElapsedTime() override;
- bool LogMessage(Rml::Log::Type type, const Rml::String& message) override;
+ double GetElapsedTime() override;
+ bool LogMessage(Rml::Log::Type type, const Rml::String &message) override;
};
\ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index 8f74dff..01f05a0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -6,28 +6,26 @@
namespace {
-Application* g_app = nullptr;
+Application *g_app = nullptr;
-void MainLoopStep() {
- g_app->Frame();
-}
+void MainLoopStep() { g_app->Frame(); }
} // namespace
int main() {
- static Application app;
- g_app = &app;
+ static Application app;
+ g_app = &app;
- app.Init(1280, 720, "gamejam", "assets/main.rml");
+ app.Init(1280, 720, "gamejam", "assets/main.rml");
#ifdef __EMSCRIPTEN__
- emscripten_set_main_loop(MainLoopStep, 0, 1);
+ emscripten_set_main_loop(MainLoopStep, 0, 1);
#else
- while (app.IsRunning()) {
- app.Frame();
- }
+ while (app.IsRunning()) {
+ app.Frame();
+ }
#endif
- app.Shutdown();
- return 0;
+ app.Shutdown();
+ return 0;
}
\ No newline at end of file