-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoard.h
More file actions
43 lines (40 loc) · 952 Bytes
/
Board.h
File metadata and controls
43 lines (40 loc) · 952 Bytes
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
#pragma once
#include "Shader.h"
#include <gl/freeglut.h>
#include <iostream>
#include "RawLoader.h"
#include "Shapes.h"
class Board
{
public:
Board(void);
~Board(void);
enum Place {FORBIDDEN, EMPTY, PIECE};
void display();
void init(void);
bool movePiece(int fromX, int fromY, int toX, int toY);
void setSelected(int x, int y);
void revertSelection(void);
int getSelectedX(void);
int getSelectedY(void);
bool validLocation(int x, int y, Place type);
bool validSelection(void);
int getRemainingPieces(void);
bool checkForWin(void);
bool checkForLose(void);
bool tryMovePiece(int fromX, int fromY, int toX, int toY, bool suppressText);
void setupWinCondition();
void rotate(bool right);
void setupLoseCondition();
private:
Place places[7][7];
int selectedX;
int selectedY;
int lastSelectedX;
int lastSelectedY;
GLuint woodTexture;
GLuint ballTexture;
GLUquadricObj* quadric;
float highlightAngle;
float boardRotation;
};