Sky Zone Omega - PC Version
 All Classes Namespaces Files Functions Variables Macros
Public Member Functions | Private Attributes | List of all members
UI_Button Class Reference

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

#include <UI_Button.h>

Inheritance diagram for UI_Button:
Inheritance graph
Collaboration diagram for UI_Button:
Collaboration graph

Public Member Functions

 UI_Button (C_Texture *spritesheet, C_Vec2 pos, C_Vec2 dimensions, C_Vec2 spriteDimensions, float *universalSpeed)
 
 UI_Button (C_Texture *sprite, C_Vec2 spriteDimensions, C_Vec2 pos, std::string message, std::string fontLocation, int fontSize, int r, int g, int b, SDL_Renderer *renderer, float border, C_Vec2 minDimensions, float *universalSpeed)
 
 UI_Button (int buttonR, int buttonG, int buttonB, C_Vec2 pos, std::string message, std::string fontLocation, int fontSize, int r, int g, int b, SDL_Renderer *renderer, float border, C_Vec2 minDimensions, float *universalSpeed)
 
 ~UI_Button ()
 
void update (float dt)
 
bool input (SDL_Event &incomingEvent)
 
void draw (SDL_Renderer *renderer)
 
- Public Member Functions inherited from EB_Entity
 EB_Entity (C_Texture *sprite, C_Vec2 pos, C_Vec2 dimensions, std::string iD, float *universalSpeed)
 Constructs the Entity object. More...
 
 ~EB_Entity ()
 Destructs the Entity object. More...
 
void setPosition (C_Vec2 pos)
 Sets the position of the Entity. More...
 
void setX (float x)
 Sets the x position of the Entity. More...
 
void setY (float y)
 Sets the y position of the Entity. More...
 
void setDimensions (C_Vec2 dimensions)
 Sets the dimensions of the Entity. More...
 
void setWidth (float width)
 Sets the width of the Entity. More...
 
void setHeight (float height)
 Sets the height of the Entity. More...
 
C_Vec2 getPosition ()
 Gets the position of the Entity. More...
 
C_Vec2 getDimensions ()
 Gets the dimensions of the Entity. More...
 

Private Attributes

C_Vec2 spriteDimensions
 The dimensions of the sprites. More...
 
C_Texttext
 The text of the button. More...
 
float border
 The size of the border from the button and the text. More...
 
bool spritesheet
 A boolean for if the button is using an spritesheet. More...
 
bool usingText
 A boolean for if the button is using text. More...
 
bool pressed
 A boolean for if the button has been pressed. More...
 
int spriteIndex
 The x index of the sprite in the spritesheet if on is used. More...
 

Additional Inherited Members

- Protected Attributes inherited from EB_Entity
C_Texturesprite
 A pointer to the Entity Texture. More...
 
C_Vec2 pos
 The position of the Entity. More...
 
C_Vec2 dimensions
 The dimensions of the Entity. More...
 
std::string iD
 The ID of the type of Entity. More...
 
float * universalSpeed
 A pointer for the universal speed of the game. More...
 

Detailed Description

Creates a Button object that inherits Entity.

Author
Jamie Slowgrove

Constructor & Destructor Documentation

UI_Button::UI_Button ( C_Texture spritesheet,
C_Vec2  pos,
C_Vec2  dimensions,
C_Vec2  spriteDimensions,
float *  universalSpeed 
)

Constructs the Button object with an image.

Parameters
spritesheetA pointer to the objects Texture.
posThe position of the Button.
dimensionsThe dimensions of the Button.
spriteDimensionsThe dimensions of the sprite.
universalSpeedA pointer for the universal speed of the game.
UI_Button::UI_Button ( C_Texture sprite,
C_Vec2  spriteDimensions,
C_Vec2  pos,
std::string  message,
std::string  fontLocation,
int  fontSize,
int  r,
int  g,
int  b,
SDL_Renderer *  renderer,
float  border,
C_Vec2  minDimensions,
float *  universalSpeed 
)

Constructs the Button object with an image and text.

Parameters
spritesheetA pointer to the objects Texture.
spriteDimensionsThe dimensions of the sprite.
posThe 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.
minDimensionsThe minimum dimensions of the Button.
universalSpeedA pointer for the universal speed of the game.

Here is the call graph for this function:

UI_Button::UI_Button ( int  buttonR,
int  buttonG,
int  buttonB,
C_Vec2  pos,
std::string  message,
std::string  fontLocation,
int  fontSize,
int  r,
int  g,
int  b,
SDL_Renderer *  renderer,
float  border,
C_Vec2  minDimensions,
float *  universalSpeed 
)

Constructs the Button object with a colour and text.

Parameters
buttonRThe red of the Button colour.
buttonGThe green of the Button colour.
buttonBThe blue of the Button colour.
posThe position of the Button.
messageThe text of the Button.
fontLocationThe location of the font.
rThe red of the Button font colour.
gThe green 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.
minDimensionsThe minimum dimensions of the Button.
universalSpeedA pointer for the universal speed of the game.

Here is the call graph for this function:

UI_Button::~UI_Button ( )

Destructs the Button object.

Member Function Documentation

void UI_Button::draw ( SDL_Renderer *  renderer)
virtual

Draws the Button to the screen.

Parameters
rendererA pointer to the SDL renderer.

Reimplemented from EB_Entity.

Here is the call graph for this function:

Here is the caller graph for this function:

bool UI_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:

void UI_Button::update ( float  dt)
virtual

A function that updates the Button.

Parameters
dtThe delta time.

Implements EB_Entity.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

float UI_Button::border
private

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

bool UI_Button::pressed
private

A boolean for if the button has been pressed.

C_Vec2 UI_Button::spriteDimensions
private

The dimensions of the sprites.

int UI_Button::spriteIndex
private

The x index of the sprite in the spritesheet if on is used.

bool UI_Button::spritesheet
private

A boolean for if the button is using an spritesheet.

C_Text* UI_Button::text
private

The text of the button.

bool UI_Button::usingText
private

A boolean for if the button is using text.


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