Jamie Slowgrove - MGP Assignment 2 - JAM
 All Classes Namespaces Files Functions Variables Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Player Class Reference

Creates a Player object that inherits Entity. More...

#include <Player.h>

Inheritance diagram for Player:
Inheritance graph
Collaboration diagram for Player:
Collaboration graph

Public Member Functions

 Player (JAM_Texture *sprite, float x, float y, float width, float height, JAM_Vec2 velocity, float screenWidth, float screenHeight, JAM_ArrowPad *arrowPad)
 
 ~Player ()
 
void input (SDL_Event incomingEvent)
 
void update (float dt)
 
- Public Member Functions inherited from JAM_Entity
 JAM_Entity (JAM_Texture *sprite, float x, float y, float width, float height)
 
 ~JAM_Entity ()
 
void draw (SDL_Renderer *renderer)
 
void setPosition (float x, float y)
 
void setPosition (JAM_Vec2 position)
 
void setX (float x)
 
void setY (float y)
 
void setDimensions (float width, float height)
 
void setDimensions (JAM_Vec2 dimensions)
 
void setWidth (float width)
 
void setHeight (float height)
 
JAM_Vec2 getPosition ()
 
JAM_Vec2 getDimensions ()
 

Private Member Functions

void windowsInput (SDL_Event &incomingEvent)
 
void androidInput (SDL_Event &incomingEvent)
 

Private Attributes

JAM_Vec2 velocity
 
bool up
 
bool down
 
bool left
 
bool right
 
float screenWidth
 
float screenHeight
 
JAM_ArrowPadarrowPad
 

Detailed Description

Creates a Player object that inherits Entity.

Author
Jamie Slowgrove

Constructor & Destructor Documentation

Player::Player ( JAM_Texture sprite,
float  x,
float  y,
float  width,
float  height,
JAM_Vec2  velocity,
float  screenWidth,
float  screenHeight,
JAM_ArrowPad arrowPad 
)

Constructs the Player object.

Parameters
spriteA pointer to the objects Texture.
xThe x position of the Player.
yThe y position of the Player.
widthThe width of the Player.
heightThe height of the Player.
velocityThe velocity of the Player.
screenWidthThe width of the screen.
screenHeightThe height of the screen.
arrowPadA pointer to the arrow pad.
Player::~Player ( )

Destructs the Player object.

Member Function Documentation

void Player::androidInput ( SDL_Event &  incomingEvent)
private

Handles the Android Player input.

Parameters
incomingEventA reference to the incoming SDL event.

Here is the call graph for this function:

Here is the caller graph for this function:

void Player::input ( SDL_Event  incomingEvent)

A function that handles the input for the Player.

Parameters
incomingEventThe incoming SDL event.

Here is the call graph for this function:

Here is the caller graph for this function:

void Player::update ( float  dt)
virtual

A function that updates the Player.

Parameters
dtThe delta time.

Implements JAM_Entity.

Here is the call graph for this function:

Here is the caller graph for this function:

void Player::windowsInput ( SDL_Event &  incomingEvent)
private

Handles the Windows Player input.

Parameters
incomingEventA reference to the incoming SDL event.

Here is the caller graph for this function:

Member Data Documentation

JAM_ArrowPad* Player::arrowPad
private

A pointer to the arrowPad.

bool Player::down
private

The down user command for the Player.

bool Player::left
private

The left user command for the Player.

bool Player::right
private

The right user command for the Player.

float Player::screenHeight
private

The height of the screen.

float Player::screenWidth
private

The width of the screen.

bool Player::up
private

The up user command for the Player.

JAM_Vec2 Player::velocity
private

The velocity of the Player.


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