Sky Zone Omega - PC Version
 All Classes Namespaces Files Functions Variables Macros
UI_Button.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include "../Enitites/Base/EB_Entity.h"
5 #include "../Core/C_Text.h"
6 
11 class UI_Button : public EB_Entity
12 {
13 public:
23 
39  UI_Button(C_Texture* sprite, C_Vec2 spriteDimensions, C_Vec2 pos, std::string message, std::string fontLocation,
40  int fontSize, int r, int g, int b, SDL_Renderer* renderer, float border, C_Vec2 minDimensions,
41  float* universalSpeed);
42 
59  UI_Button(int buttonR, int buttonG, int buttonB, C_Vec2 pos, std::string message, std::string fontLocation, int fontSize,
60  int r, int g, int b, SDL_Renderer* renderer, float border, C_Vec2 minDimensions, float* universalSpeed);
61 
65  ~UI_Button();
66 
71  void update(float dt);
72 
78  bool input(SDL_Event& incomingEvent);
79 
84  void draw(SDL_Renderer* renderer);
85 
86 private:
92  float border;
96  bool usingText;
98  bool pressed;
101 };
Creates a Button object that inherits Entity.
Definition: UI_Button.h:11
bool input(SDL_Event &incomingEvent)
Definition: UI_Button.cpp:96
void draw(SDL_Renderer *renderer)
Definition: UI_Button.cpp:154
C_Vec2 spriteDimensions
The dimensions of the sprites.
Definition: UI_Button.h:88
Creates a Text Texture for use with a renderer using the Text formating.
Definition: C_Text.h:13
C_Text * text
The text of the button.
Definition: UI_Button.h:90
C_Vec2 dimensions
The dimensions of the Entity.
Definition: EB_Entity.h:94
Contains variables and functions to be inherited by classes that are about Entities.
Definition: EB_Entity.h:10
Contains the Vec2 structure with functions and overloaded operators.
Definition: C_Vec2.h:7
bool pressed
A boolean for if the button has been pressed.
Definition: UI_Button.h:98
float border
The size of the border from the button and the text.
Definition: UI_Button.h:92
bool usingText
A boolean for if the button is using text.
Definition: UI_Button.h:96
~UI_Button()
Definition: UI_Button.cpp:60
C_Vec2 pos
The position of the Entity.
Definition: EB_Entity.h:92
int spriteIndex
The x index of the sprite in the spritesheet if on is used.
Definition: UI_Button.h:100
void update(float dt)
Definition: UI_Button.cpp:71
C_Texture * sprite
A pointer to the Entity Texture.
Definition: EB_Entity.h:90
UI_Button(C_Texture *spritesheet, C_Vec2 pos, C_Vec2 dimensions, C_Vec2 spriteDimensions, float *universalSpeed)
Definition: UI_Button.cpp:3
bool spritesheet
A boolean for if the button is using an spritesheet.
Definition: UI_Button.h:94
float * universalSpeed
A pointer for the universal speed of the game.
Definition: EB_Entity.h:98
Creates a Texture for use with a renderer.
Definition: C_Texture.h:13