Creates a Button object that inherits Entity. More...
#include <Button.h>
Public Member Functions | |
JAM_Button (JAM_Texture *sprite, float x, float y, float width, float height) | |
JAM_Button (JAM_Texture *sprite, float x, float y, std::string message, std::string fontLocation, int fontSize, int r, int g, int b, SDL_Renderer *renderer, float border, float minWidth, float minHeight) | |
~JAM_Button () | |
void | update (float dt) |
bool | input (SDL_Event &incomingEvent) |
bool | tapInput (SDL_Event &incomingEvent) |
void | drawText (SDL_Renderer *renderer) |
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 Attributes | |
JAM_Text * | text |
float | border |
bool | state |
Creates a Button object that inherits Entity.
JAM_Button::JAM_Button | ( | JAM_Texture * | sprite, |
float | x, | ||
float | y, | ||
float | width, | ||
float | height | ||
) |
Constructs the Button object.
sprite | A pointer to the objects Texture. |
x | The x position of the Button. |
y | The y position of the Button. |
width | The width of the Button. |
height | The height of the Button. |
JAM_Button::JAM_Button | ( | JAM_Texture * | sprite, |
float | x, | ||
float | y, | ||
std::string | message, | ||
std::string | fontLocation, | ||
int | fontSize, | ||
int | r, | ||
int | g, | ||
int | b, | ||
SDL_Renderer * | renderer, | ||
float | border, | ||
float | minWidth, | ||
float | minHeight | ||
) |
Constructs the Button object.
sprite | A pointer to the objects Texture. |
x | The x position of the Button. |
y | The y position of the Button. |
message | The text of the Button. |
fontLocation | The location of the font. |
r | The blue of the Button font colour. |
g | The blue of the Button font colour. |
b | The blue of the Button font colour. |
renderer | A pointer to the renderer. |
border | The size of the border of the Button. |
minWidth | The minimum size of the width. |
minHeight | the minimum size of the height. |
JAM_Button::~JAM_Button | ( | ) |
Destructs the Button object.
void JAM_Button::drawText | ( | SDL_Renderer * | renderer | ) |
Draws the Button text to the screen.
renderer | A pointer to the SDL renderer. |
bool JAM_Button::input | ( | SDL_Event & | incomingEvent | ) |
A function that handles the Button input.
incomingEvent | A reference to the incoming event. |
bool JAM_Button::tapInput | ( | SDL_Event & | incomingEvent | ) |
A function that handles input for a Button tap.
incomingEvent | A reference to the incoming event. |
|
virtual |
|
private |
The size of the border from the button and the text.
|
private |
A boolean for the state of the button.
|
private |
The text of the button.