-
Notifications
You must be signed in to change notification settings - Fork 0
/
MenuBoard.cpp
56 lines (46 loc) · 1.11 KB
/
MenuBoard.cpp
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
#include "MenuBoard.h"
MenuBoard::MenuBoard(Rect _pos)
{
pos = _pos;
img_board = 0;
img_board = LoadTexture("img//menu//menuboard.bmp");
game_state = MAIN_MENU;
move_color = Color::BLACK;
}
void MenuBoard::Init()
{
}
void MenuBoard::Draw()
{
DrawTexture(pos, img_board);
Point tmp = Point(pos.lx, pos.ly) + Point(65, 100);
DrawString("不围棋", "楷体", 48, tmp.x, tmp.y, 142.0 / 256, 70.0 / 256, 49.0 / 256);
tmp = Point(pos.lx, pos.ly) + Point(20, 370);
if (game_state == GAME_BLACK_WIN)
DrawString("黑棋获胜!", "楷体", 48, tmp.x, tmp.y, 0, 0, 0);
if (game_state == GAME_WHITE_WIN)
DrawString("白棋获胜!", "楷体", 48, tmp.x, tmp.y, 1, 1, 1);
tmp = Point(pos.lx, pos.ly) + Point(35, 310);
if (game_state == IN_GAME)
{
if (move_color == Color::BLACK)
DrawString("等待黑棋", "楷体", 48, tmp.x, tmp.y, 0, 0, 0);
else
DrawString("等待白棋", "楷体", 48, tmp.x, tmp.y, 1, 1, 1);
}
}
void MenuBoard::OnMouseClick(Point a)
{
}
void MenuBoard::SetGameState(int id)
{
game_state = id;
}
void MenuBoard::SetMoveColor(Color id)
{
move_color = id;
}
bool MenuBoard::in(Point a)
{
return pos.inRect(a);
}