-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpawn.h
executable file
·58 lines (41 loc) · 992 Bytes
/
pawn.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef PAWN_H
#define PAWN_H
#include <SDL/SDL.h>
#include <vector>
#include "base/object.h"
// Piece du jeu
class Piece : public GameObject {
public:
enum { black, white };
/**
* @param _x, _y : position of the piece in board coordinates
* @param color couleur de la pièce
*/
Piece(int, int, bool);
~Piece();
void draw(SDL_Surface*);
void move(int, int);
void update();
void bump(const std::string& flag = "");
int get_x() const;
int get_y() const;
static bool valid(int, int, int, int);
static bool allMoved(int);
static void unselect();
static bool ready();
static Piece *selected, *moving;
static int diameter, *game_turn, **board;
static SDL_Rect board_top_left;
private:
enum { IDLE, MOVING, SELECTED };
// relative coordinates
int r_x, r_y, d_x, d_y;
int state;
SDL_Surface *shadow, *light, *zoom;
float x_vel, y_vel, acceleration;
bool moved;
static int instance;
static int move_cnt[2];
SDL_Rect get_SDL_coord(int, int);
};
#endif