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

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

#include <Button.h>

Inheritance diagram for JAM_Button:
Inheritance graph
Collaboration diagram for JAM_Button:
Collaboration graph

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_Texttext
 
float border
 
bool state
 

Detailed Description

Creates a Button object that inherits Entity.

Author
Jamie Slowgrove

Constructor & Destructor Documentation

JAM_Button::JAM_Button ( JAM_Texture sprite,
float  x,
float  y,
float  width,
float  height 
)

Constructs the Button object.

Parameters
spriteA pointer to the objects Texture.
xThe x position of the Button.
yThe y position of the Button.
widthThe width of the Button.
heightThe 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.

Parameters
spriteA pointer to the objects Texture.
xThe x position of the Button.
yThe y position of the Button.
messageThe text of the Button.
fontLocationThe location of the font.
rThe blue of the Button font colour.
gThe blue of the Button font colour.
bThe blue of the Button font colour.
rendererA pointer to the renderer.
borderThe size of the border of the Button.
minWidthThe minimum size of the width.
minHeightthe minimum size of the height.

Here is the call graph for this function:

JAM_Button::~JAM_Button ( )

Destructs the Button object.

Member Function Documentation

void JAM_Button::drawText ( SDL_Renderer *  renderer)

Draws the Button text to the screen.

Parameters
rendererA pointer to the SDL renderer.

Here is the call graph for this function:

bool JAM_Button::input ( SDL_Event &  incomingEvent)

A function that handles the Button input.

Parameters
incomingEventA reference to the incoming event.
Returns
The state of the button.

Here is the call graph for this function:

Here is the caller graph for this function:

bool JAM_Button::tapInput ( SDL_Event &  incomingEvent)

A function that handles input for a Button tap.

Parameters
incomingEventA reference to the incoming event.
Returns
If the button is pressed.

Here is the call graph for this function:

void JAM_Button::update ( float  dt)
virtual

A function that updates the Button.

Parameters
dtThe delta time.

Implements JAM_Entity.

Member Data Documentation

float JAM_Button::border
private

The size of the border from the button and the text.

bool JAM_Button::state
private

A boolean for the state of the button.

JAM_Text* JAM_Button::text
private

The text of the button.


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