blob: 6ceb6e1185a36d9df3df749010d90896614e9aee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#ifndef PUZZLE_HPP_SENTRY
#define PUZZLE_HPP_SENTRY
#include <FL/Enumerations.H>
#include <FL/Fl_Button.H>
#include <string>
enum {
puzzle_pieces = 15,
puzzles_per_side = 4,
puzzle_size = 75,
spacing = 5
};
class Puzzle : Fl_Button{
unsigned int sequence_number;
std::string path;
Puzzle(int x, int y)
: Fl_Button(x, y, puzzle_size, puzzle_size),
sequence_number(0) {}
friend class GameParams;
};
class GameParams {
struct coordinates {
int x, y;
};
coordinates puzzle_coordinates[puzzle_pieces];
char free_puzzles[puzzle_pieces];
Puzzle *puzzles[puzzle_pieces];
GameParams() : puzzles{nullptr} {}
void ResetFreePuzzles();
void CalculatePuzzlePos();
void CreateNewPuzzles();
public:
void NewGame();
static GameParams *StartParams() {
GameParams *gi = new GameParams;
gi->CalculatePuzzlePos();
return gi;
}
};
#endif
|