commit af6d5a44
Add test button
Changed files
| M | source/code/main.cpp before |
| M | source/code/puzzle_editor/PuzzleEditorState.cpp before |
diff --git a/source/code/main.cpp b/source/code/main.cpp
index a0f888c..6eed9b3 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -1395,6 +1395,11 @@ int main(int argc, char* argv[]) {
return 0;
}
+void SetSinglePuzzleMode(int level) {
+ singlePuzzle = true;
+ singlePuzzleNr = level;
+}
+
int runGame(Gametype gametype, int level) {
drawBalls = true;
puzzleLoaded = false;
diff --git a/source/code/puzzle_editor/PuzzleEditorState.cpp b/source/code/puzzle_editor/PuzzleEditorState.cpp
index 3d40c5a..42b8200 100644
--- a/source/code/puzzle_editor/PuzzleEditorState.cpp
+++ b/source/code/puzzle_editor/PuzzleEditorState.cpp
@@ -34,6 +34,8 @@ https://blockattack.net
#include "../puzzlehandler.hpp"
+void SetSinglePuzzleMode(int level);
+
PuzzleEditorState::PuzzleEditorState() {
this->window_resize = sago::SagoLogicalResize(BOARD_WIDTH+5, BOARD_HEIGHT+5);
}
@@ -294,6 +296,10 @@ void PuzzleEditorState::Draw(SDL_Renderer* target) {
ImGui::LabelText("Read Only", "");
ImGui::Separator();
}
+ if (ImGui::Button("Play")) {
+ SetSinglePuzzleMode(this->selected_puzzle);
+ runGame(Gametype::Puzzle, this->selected_puzzle);
+ }
ImGui::End();
}