Bowls
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Game.h
Go to the documentation of this file.
1 #include <time.h>
2 #include "cgg/cgg.h"
3 
4 #include "Kinect.h"
5 #include "Timer.h"
6 
7 #include "Bowl.h"
8 #include "Jack.h"
9 #include "Physics.h"
10 
13 {
16 };
17 
21 class Game
22 {
23 public:
29  Game(bool, TrackingPoint);
30 
34  ~Game();
35 
43  void update(float dt, cgg::MayaCamera &g_camera);
44 
48  void loadWorld();
49 
55  void render(gl::Primitives*);
56 
60  void startGame();
61 private:
62  int stage = 0;
63  float lockedZ = 0.0f;
64  float lockedX = 0.0f;
65 
67  std::vector<Bowl*> redBowls;
68  std::vector<Bowl*> blueBowls;
69  std::vector<Ball*> scoreDisplay;
70  Box * cues[2];
71  Ball * cueHat[2];
79 
82 
84  int blueScore;
85  int redScore;
86 
88  const cgg::Vec3 redColour = { 1, 0, 0 };
89  const cgg::Vec3 blueColour = { 0, 0, 1 };
90  const cgg::Vec3 yellowColour = { 1, 1, 0 };
91  const cgg::Vec3 greenColour = { 0, 1, 0 };
92  const cgg::Vec3 whiteColour = { 1, 1, 1 };
93 
95  const float aimStage = 10.0f;
96  const float pullBackStage = 5.0f;
97  const float throwStage = 10.0f;
98  const float autoThrowTime = 10.0f;
99  const float delayBeforeNextTurn = 10.0f;
100  const float bowlRadius = 0.4;
101  const float jackRadius = 0.3;
102 
104  float handOffset = -1.7f;
105 
109  void playerTurnStart();
110 
116  char getClosestBallType();
117 
123  void resetPositions(cgg::MayaCamera &g_camera);
124 
131  void ballWallCollisionTests(Ball *, float);
132 
136  void gameOver();
137 
141  void displayScore();
142 
149  inline int randomNumber(int minimum, int maximum)
150  {
151  return rand() % (maximum - minimum + 1) + minimum;
152  }
153 
154 };
Game(bool, TrackingPoint)
void playerTurnStart()
PlayerName
an eNum to identify the current players turn
Definition: Game.h:12
std::vector< Ball * > scoreDisplay
Definition: Game.h:69
float handOffset
the offset between the ball in hand and the floor, initially the jack
Definition: Game.h:104
Class that represents a Ball.
Definition: Ball.h:14
Ball * cueHat[2]
Definition: Game.h:71
float lockedX
the z position to be used with input maths
Definition: Game.h:64
Definition: Game.h:14
void render(gl::Primitives *)
void resetPositions(cgg::MayaCamera &g_camera)
std::vector< Bowl * > redBowls
the x position to be used with input maths
Definition: Game.h:67
int redScore
Definition: Game.h:85
int blueScore
scores
Definition: Game.h:84
Box * endWall
Definition: Game.h:76
void startGame()
void displayScore()
std::vector< Bowl * > blueBowls
Definition: Game.h:68
const cgg::Vec3 redColour
colours
Definition: Game.h:88
const float bowlRadius
Definition: Game.h:100
const float autoThrowTime
Definition: Game.h:98
const float delayBeforeNextTurn
Definition: Game.h:99
Box * cues[2]
Definition: Game.h:70
Box * sideWall2
Definition: Game.h:78
void update(float dt, cgg::MayaCamera &g_camera)
TrackingPoint
Kinect Tracking Points.
Definition: Kinect.h:7
const float pullBackStage
Definition: Game.h:96
Jack * jack
Definition: Game.h:72
Box * ground
Definition: Game.h:75
void ballWallCollisionTests(Ball *, float)
const cgg::Vec3 yellowColour
Definition: Game.h:90
const float aimStage
constants
Definition: Game.h:95
the Game object where all of the functions of the game is stored.
Definition: Game.h:21
void loadWorld()
PlayerName currentTurn
Definition: Game.h:73
const cgg::Vec3 greenColour
Definition: Game.h:91
const float throwStage
Definition: Game.h:97
const cgg::Vec3 whiteColour
Definition: Game.h:92
const float jackRadius
Definition: Game.h:101
int randomNumber(int minimum, int maximum)
Definition: Game.h:149
void gameOver()
KinectInput * kinectSensor
kinect data
Definition: Game.h:81
Class that represents a Box.
Definition: Box.h:13
Class that represents a Jack.
Definition: Jack.h:13
int stage
Definition: Game.h:62
float lockedZ
the current cue stage
Definition: Game.h:63
const cgg::Vec3 blueColour
Definition: Game.h:89
Ball * hand
Definition: Game.h:74
char getClosestBallType()
Kinect Input Manager.
Definition: Kinect.h:18
Box * sideWall1
Definition: Game.h:77