back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/puzzle.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'puzzle.hpp')
-rw-r--r--puzzle.hpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/puzzle.hpp b/puzzle.hpp
index e44efd4..9b01cc6 100644
--- a/puzzle.hpp
+++ b/puzzle.hpp
@@ -4,12 +4,13 @@
#include <FL/Enumerations.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Window.H>
+#include <FL/Fl_PNG_Image.H>
#include <string>
#include <vector>
#include <memory>
enum {
- puzzle_pieces = 9,
+ puzzle_pieces = 9, // including empty puzzle
puzzles_per_side = 3,
puzzle_size = 100,
spacing = 5
@@ -19,8 +20,12 @@ class Puzzle : public Fl_Button{
public:
unsigned char sequence_number;
std::string path;
+ Fl_PNG_Image *stored_img_pointer;
Puzzle(int x, int y)
- : Fl_Button(x, y, puzzle_size, puzzle_size) {}
+ : Fl_Button(x, y, puzzle_size, puzzle_size),
+ stored_img_pointer(nullptr) {
+ }
+ ~Puzzle() { delete stored_img_pointer; }
};
class GameParams {
@@ -40,7 +45,9 @@ private:
Fl_Window *win;
std::string cur_directory;
- GameParams(Fl_Window *a_win = nullptr) : win(a_win) {}
+ GameParams(Fl_Window *a_win = nullptr)
+ : win(a_win)
+ {}
void CalculateStandardPuzzlePos();
void ResetFreePuzzles();
void NextUntestedPuzzles();