-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_dialog.h
52 lines (44 loc) · 1.24 KB
/
game_dialog.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
#ifndef SF_CHESSGAMEDIALOG_H
#define SF_CHESSGAMEDIALOG_H
#include <set>
#include "command.h"
#include "game.h"
#include "game_state.h"
#include "textures.h"
#include <SFML/Graphics/Sprite.hpp>
namespace sf { struct RenderWindow; }
namespace sf { struct Texture; }
class game_dialog
{
public:
game_dialog(const int window_width, const int window_height);
void add_command(const command c);
void click_mouse(const int x, const int y);
void draw(sf::RenderWindow& window);
piece_color get_whose_turn() const { return m_game.get_whose_turn(); }
void tick();
private:
std::set<command> m_commands;
int m_cursor_x;
int m_cursor_y;
chess_game m_game;
game_state m_game_state;
int m_select_x;
int m_select_y;
textures m_textures;
int m_window_height;
int m_window_width;
void do_move();
void do_move(const chess_move& move);
void do_select(const int cursorX, const int cursorY);
const sf::Texture& get_texture(
const bool inSight,
const chess_piece& piece
) const;
void draw_game(sf::RenderWindow& window) const;
void draw_player_won(sf::RenderWindow& window, const int player) const;
void draw_start_turn(sf::RenderWindow& window) const;
void process_commands();
void process_command(const command c);
};
#endif