commit 56e2d5db
Started adding an image select section
Changed files
| A | .dockerignore |
| M | CMakeLists.txt before |
| A | src/ImageSelectState.cpp |
| A | src/ImageSelectState.hpp |
| M | src/sago_common.cpp before |
| M | src/sago_multi_scrambler_puzzle2.cpp before |
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..bc46101
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,8 @@
+*.o
+*.cmake
+*.exe
+nbproject
+Makefile
+CMakeCache.txt
+CMakeFiles
+CPack*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d2aad18..ecb4c06 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.9)
+cmake_minimum_required(VERSION 3.10.2)
project (sago_multi_scrambler_puzzle2)
find_package(Boost COMPONENTS program_options REQUIRED)
diff --git a/src/ImageSelectState.cpp b/src/ImageSelectState.cpp
new file mode 100644
index 0000000..c3870a6
--- /dev/null
+++ b/src/ImageSelectState.cpp
@@ -0,0 +1,48 @@
+/*
+===========================================================================
+ * Sago Multi Scrambler Puzzle
+Copyright (C) 2022 Poul Sander
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see http://www.gnu.org/licenses/
+
+Source information and contacts persons can be found at
+https://github.com/sago007/saland
+===========================================================================
+*/
+
+#include "ImageSelectState.hpp"
+
+ImageSelectState::ImageSelectState() {
+}
+
+
+ImageSelectState::~ImageSelectState() {
+}
+
+bool ImageSelectState::IsActive() {
+ return true;
+}
+
+void ImageSelectState::ProcessInput(const SDL_Event& event, bool &processed) {
+
+}
+
+void ImageSelectState::Draw(SDL_Renderer* target) {
+
+}
+
+
+void ImageSelectState::Update() {
+
+}
\ No newline at end of file
diff --git a/src/ImageSelectState.hpp b/src/ImageSelectState.hpp
new file mode 100644
index 0000000..406288a
--- /dev/null
+++ b/src/ImageSelectState.hpp
@@ -0,0 +1,43 @@
+/*
+===========================================================================
+ * Sago Multi Scrambler Puzzle
+Copyright (C) 2022 Poul Sander
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see http://www.gnu.org/licenses/
+
+Source information and contacts persons can be found at
+https://github.com/sago007/saland
+===========================================================================
+*/
+
+#include "sago/GameStateInterface.hpp"
+
+
+#pragma once
+
+class ImageSelectState : public sago::GameStateInterface {
+public:
+ ImageSelectState();
+ ImageSelectState(const ImageSelectState& orig) = delete;
+ virtual ~ImageSelectState();
+
+ bool IsActive() override;
+ void ProcessInput(const SDL_Event& event, bool &processed) override;
+ void Draw(SDL_Renderer* target) override;
+ void Update() override;
+
+private:
+ bool isActive = true;
+};
+
diff --git a/src/sago_common.cpp b/src/sago_common.cpp
index 4232d57..e762901 100644
--- a/src/sago_common.cpp
+++ b/src/sago_common.cpp
@@ -39,7 +39,7 @@ void RunGameState(sago::GameStateInterface& state ) {
SDL_RenderClear(globalData.screen);
state.Draw(globalData.screen);
- SDL_Delay(1);
+ SDL_Delay(5);
SDL_Event event;
bool mustWriteScreenshot = false;
diff --git a/src/sago_multi_scrambler_puzzle2.cpp b/src/sago_multi_scrambler_puzzle2.cpp
index 7a2129c..dff52de 100644
--- a/src/sago_multi_scrambler_puzzle2.cpp
+++ b/src/sago_multi_scrambler_puzzle2.cpp
@@ -29,6 +29,7 @@ https://github.com/sago007/saland
#include "sago/SagoTextField.hpp"
#include "globals.hpp"
#include "PuzzleSingleImageState.hpp"
+#include "ImageSelectState.hpp"
#include "sago_common.hpp"
#include "MainGameState.hpp"
@@ -55,6 +56,13 @@ void runGame() {
UninitGame();
}
+void runCollection(const std::string& collection_name) {
+ ImageSelectState iss;
+ InitGame();
+ RunGameState(iss);
+ UninitGame();
+}
+
int main(int argc, const char* argv[]) {
boost::program_options::options_description desc("Options");
@@ -64,6 +72,7 @@ int main(int argc, const char* argv[]) {
("version", "Print version information and quit")
("help,h", "Print basic usage information to stdout and quit")
("input-file", boost::program_options::value< std::vector<std::string> >(), "Image to open directly")
+ ("collection", boost::program_options::value< std::string >(), "Jump straigt to a named collection. Like \"fairy_tales\"")
;
boost::program_options::variables_map vm;
boost::program_options::store(boost::program_options::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
@@ -80,9 +89,13 @@ int main(int argc, const char* argv[]) {
if (vm.count("input-file")) {
const std::vector<std::string>& input_files = vm["input-file"].as<std::vector<std::string> >();
runSinglePuzzle(input_files.at(0));
+ return 0;
}
- else {
- runGame();
+ if (vm.count("collection")) {
+ const std::string& collection_name = vm["collection"].as<std::string>();
+ runCollection(collection_name);
+ return 0;
}
+ runGame();
return 0;
}