tavli

view src/board.h @ 18:986c0b76513f

shadows, not completed
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 29 Jun 2015 01:29:36 +0300
parents f1ecc2439802
children c3fbf9616dbd
line source
1 #ifndef BOARD_H_
2 #define BOARD_H_
4 #include <vector>
5 #include "object.h"
6 #include "image.h"
8 #define NUM_SLOTS 20
9 #define PLAYER_PIECES 15
10 #define MAX_PIECES (PLAYER_PIECES * 2)
12 enum { MINE, OTHER };
14 class Piece {
15 private:
16 int prev_slot, prev_level;
17 unsigned long move_start;
19 public:
20 int owner, slot, level;
22 Piece();
24 void move_to(int slot, int level, bool anim = true);
25 };
28 class Board {
29 private:
30 Piece pieces[MAX_PIECES];
31 int hist[NUM_SLOTS + 1];
33 std::vector<Object*> obj;
34 Object *piece_obj;
36 Image img_wood, img_field, img_hinge;
38 bool generate();
39 bool generate_textures();
41 public:
42 Board();
43 ~Board();
45 bool init();
46 void destroy();
48 void clear();
49 void setup();
51 int slot_pieces(int slot) const;
52 bool move_piece(int id, int slot, bool anim = true);
54 Vector3 piece_pos(int slot, int level = 0) const;
56 void draw() const;
57 };
59 #endif // BOARD_H_