Creates a Player object that inherits Entity. More...
#include <Player.h>
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) |
![]() | |
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_ArrowPad * | arrowPad |
Creates a Player object that inherits Entity.
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.
sprite | A pointer to the objects Texture. |
x | The x position of the Player. |
y | The y position of the Player. |
width | The width of the Player. |
height | The height of the Player. |
velocity | The velocity of the Player. |
screenWidth | The width of the screen. |
screenHeight | The height of the screen. |
arrowPad | A pointer to the arrow pad. |
Player::~Player | ( | ) |
Destructs the Player object.
|
private |
Handles the Android Player input.
incomingEvent | A reference to the incoming SDL event. |
void Player::input | ( | SDL_Event | incomingEvent | ) |
A function that handles the input for the Player.
incomingEvent | The incoming SDL event. |
|
virtual |
A function that updates the Player.
dt | The delta time. |
Implements JAM_Entity.
|
private |
Handles the Windows Player input.
incomingEvent | A reference to the incoming SDL event. |
|
private |
A pointer to the arrowPad.
|
private |
The down user command for the Player.
|
private |
The left user command for the Player.
|
private |
The right user command for the Player.
|
private |
The height of the screen.
|
private |
The width of the screen.
|
private |
The up user command for the Player.