Skip to content

Commit

Permalink
UI Settings: add style editor button
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Jan 17, 2025
1 parent 9d5c7bd commit 73a0a40
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/overlay/overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

Notifications Notifications::instance;

bool show_demo_window = true;

bool f11_prev_state = false; // previously seen F11 state

bool overlay_visible = false; // user wants overlay to show?
Expand Down Expand Up @@ -49,7 +47,7 @@ class GlobalsWindow : public OverlayWindow

GameStage cur_stage_num = *Game::stg_stage_num;
ImGui::Text("Loaded Stage: %d (%s / %s)", cur_stage_num, Game::GetStageFriendlyName(cur_stage_num), Game::GetStageUniqueName(cur_stage_num));

if (Settings::DrawDistanceIncrease > 0)
if (ImGui::Button("Open Draw Distance Debugger"))
Game::DrawDistanceDebugEnabled = true;
Expand Down Expand Up @@ -93,13 +91,22 @@ GlobalsWindow GlobalsWindow::instance;

class UISettingsWindow : public OverlayWindow
{
bool ShowStyleEditor = false;

public:
void init() override {}
void render(bool overlayEnabled) override
{
if (!overlayEnabled)
return;

if (ShowStyleEditor)
{
if (ImGui::Begin("UI Style Editor", &ShowStyleEditor))
ImGui::ShowStyleEditor();
ImGui::End();
}

ImVec2 screenSize = ImGui::GetIO().DisplaySize;

// Calculate starting position for the latest notification
Expand All @@ -121,6 +128,9 @@ class UISettingsWindow : public OverlayWindow

if (ImGui::TreeNodeEx("Global", ImGuiTreeNodeFlags_DefaultOpen))
{
if (ImGui::Button("Open UI Style Editor"))
ShowStyleEditor = true;

static bool fontScaleChanged = false;
if (ImGui::SliderFloat("Font Scale", &Overlay::GlobalFontScale, 0.5f, 2.5f))
fontScaleChanged |= true;
Expand Down

0 comments on commit 73a0a40

Please sign in to comment.