#include "Application.h" #include "Game.h" #include "backend/RaylibInput.h" #include #include #include Game game; 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(); context = Rml::CreateContext("main", Rml::Vector2i(width, height)); Rml::Debugger::Initialise(context); // TODO: load a real font if (Rml::ElementDocument* document = context->LoadDocument(documentPath)) { document->Show(); } else { TraceLog(LOG_WARNING, "Failed to load %s", documentPath); } game.Init(context); return true; } void Application::Frame() { if (WindowShouldClose()) { running = false; return; } ForwardInputToRml(context); context->Update(); game.Update(); BeginDrawing(); ClearBackground(DARKGRAY); game.Draw2D(); context->Render(); EndDrawing(); } void Application::Shutdown() { Rml::Shutdown(); CloseWindow(); }