Flock You!
 All Classes Files Functions Variables
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Game Class Reference

Creates an Game object that inherits State Creates an Game object that inherits State and runs the Game. DISCLAMER: Created using Pseudo code from https://www.macs.hw.ac.uk/~dwcorne/Teaching/Boids%20Pseudocode.htm. More...

#include <game.h>

Inheritance diagram for Game:
Inheritance graph
Collaboration diagram for Game:
Collaboration graph

Public Member Functions

 Game (StateManager *, SDL_Renderer *, int, int)
 
 ~Game ()
 
bool input ()
 
void update (float deltaTime)
 
void draw ()
 
- Public Member Functions inherited from State
 State (StateManager *, SDL_Renderer *, int, int)
 
virtual ~State ()
 

Private Member Functions

Vec2 rule1 (int)
 
Vec2 rule2 (int)
 
Vec2 rule3 (int)
 
Vec2 roughBoundaries (int)
 
void limitVelocity (int)
 

Private Attributes

TexturewhiteSquare
 
std::vector< Boid * > boids
 
int applyRule1
 
int applyRule2
 
int applyRule3
 
std::vector< Text * > text
 

Additional Inherited Members

- Protected Attributes inherited from State
StateManagerstateManager
 
SDL_Renderer * renderer
 
int screenWidth
 
int screenHeight
 

Detailed Description

Creates an Game object that inherits State Creates an Game object that inherits State and runs the Game. DISCLAMER: Created using Pseudo code from https://www.macs.hw.ac.uk/~dwcorne/Teaching/Boids%20Pseudocode.htm.

Constructor & Destructor Documentation

Game::Game ( StateManager inStateManager,
SDL_Renderer *  inRenderer,
int  inWidth,
int  inHeight 
)

Constructs an Game object

Parameters
StateManager* a pointer to the StateManager
SDL_Renderer* a pointer to the renderer
intthe screen width
intthe screen height
Game::~Game ( )

Destructs an Game object

Member Function Documentation

void Game::draw ( )
virtual

A function to draw to the screen

Implements State.

bool Game::input ( )
virtual

Handles the Game input

Returns
bool if false the quit the Game State

Implements State.

Here is the call graph for this function:

void Game::limitVelocity ( int  boidIndex)
private

Limits the Boid velocity

Parameters
intthe index of the Boid to test

Here is the caller graph for this function:

Vec2 Game::roughBoundaries ( int  boidIndex)
private

Applies Boid rough boundaries

Parameters
intthe index of the Boid to test
Returns
Vec2 the resultant velocity of the boundary

Here is the caller graph for this function:

Vec2 Game::rule1 ( int  boidIndex)
private

Applies Boid Rule 1

Parameters
intthe index of the Boid to test
Returns
Vec2 the resultant velocity of the rule

Here is the caller graph for this function:

Vec2 Game::rule2 ( int  boidIndex)
private

Applies Boid Rule 2

Parameters
intthe index of the Boid to test
Returns
Vec2 the resultant velocity of the rule

Here is the caller graph for this function:

Vec2 Game::rule3 ( int  boidIndex)
private

Applies Boid Rule 3

Parameters
intthe index of the Boid to test
Returns
Vec2 the resultant velocity of the rule

Here is the caller graph for this function:

void Game::update ( float  deltaTime)
virtual

A function to update the Game A function to update the Game to allow the Game to run

Parameters
floatthe delta time

Implements State.

Here is the call graph for this function:

Member Data Documentation

int Game::applyRule1
private
int Game::applyRule2
private
int Game::applyRule3
private
std::vector<Boid*> Game::boids
private
std::vector<Text *> Game::text
private
Texture* Game::whiteSquare
private

The documentation for this class was generated from the following files: