]> Shamusworld >> Repos - warehouse-man-deluxe/blob - src/boards.h
Moved level storage to global location.
[warehouse-man-deluxe] / src / boards.h
1 #ifndef __BOARDS_H__
2 #define __BOARDS_H__
3
4 #include <vector>
5 #include <stdint.h>
6
7 // Okay, this is ugly but works and I can't think of any better way to handle
8 // this. So what we do when we pass the anonymous structs into a function is
9 // pass them as a (void *) and then cast them as type (Board *) in order to
10 // use them. Yes, it's ugly. Come up with something better!
11
12 struct Board {
13         unsigned int width;             // Width of the board
14         unsigned int height;    // Height of the board
15         unsigned char state[];  // Board data
16 };
17
18 #define BOARDSIZE 128
19
20 struct Point
21 {
22         Point(int xx = 0, int yy = 0) { x = xx; y = yy; }
23         int x, y;
24 };
25
26 struct Level
27 {
28         uint8_t board[BOARDSIZE][BOARDSIZE];
29         char name[41];
30         Point corner;           // Corner dimensions on screen
31         Point cursor;           // Cursor location
32 };
33
34 #define NUMBER_OF_BOARDS        42
35 extern const void * boards[];
36 extern std::vector<Level> levelStorage;
37
38 #endif  // __BOARDS_H__
39