git repos / sago_multi_scrambler_puzzle2

commit fa3dfbef

Poul Sander · 2025-11-20 17:34
fa3dfbef248125c50d8f0427dfb62585db5ef269 patch · browse files
parent d1756896b6686ec36957f8350742e0648936f4c3

Add button to the middle of the screen to lunch random from favorites

Changed files

M src/MainGameState.cpp before
diff --git a/src/MainGameState.cpp b/src/MainGameState.cpp index cf43645..ed85896 100644 --- a/src/MainGameState.cpp +++ b/src/MainGameState.cpp
@@ -60,6 +60,16 @@ void MainGameState::Draw(SDL_Renderer* target) {
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
+
+ // Center a window with the button
+ ImGui::SetNextWindowPos(ImVec2(globalData.xsize / 2.0f, globalData.ysize / 2.0f), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
+ ImGui::Begin("Main Menu", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove);
+
+ if (ImGui::Button("Random image from favorites", ImVec2(300, 50))) {
+ shouldLoadRandomFavorite = true;
+ }
+
+ ImGui::End();
}