#include #include #include namespace { String GetGameModeName(GameMode gameMode) { switch (gameMode) { case GameMode::Editor: return WrapString("Editor"); case GameMode::Play: return WrapString("Play"); case GameMode::Debug: return WrapString("Debug"); default: return WrapString("Unknown ERROR"); } } } // namespace void DrawTopBar() { auto* gameState = GetGameState(); ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(viewport->Pos); ImGui::SetNextWindowSize(ImVec2(viewport->Size.x, 10.0f)); ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav; ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 0.6f)); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f, 5.0f)); if (ImGui::Begin("TopBarOverlay", nullptr, flags)) { ImGui::Text("Game Mode: %s", CStr(GetGameModeName(gameState->Mode))); char fps_text[32]; snprintf(fps_text, sizeof(fps_text), "FPS: %.1f (%.2f ms)", ImGui::GetIO().Framerate, 1000.0f / ImGui::GetIO().Framerate); float text_width = ImGui::CalcTextSize(fps_text).x; ImGui::SameLine(viewport->Size.x - text_width - 15.0f); // 15px right padding // Render FPS text ImGui::Text("%s", fps_text); } ImGui::End(); ImGui::PopStyleVar(); ImGui::PopStyleColor(); }