Rendu
A lightweight rendering engine for experimentations
|
Represents a button in a menu. More...
#include <GameMenu.hpp>
Public Types | |
enum class | State : uint { OFF , HOVER , ON } |
Button state. | |
Public Member Functions | |
MenuButton (const glm::vec2 &screenPos, const glm::vec2 &meshSize, float screenScale, int actionTag, const Texture *texture) | |
bool | contains (const glm::vec2 &mousePos) const |
Public Attributes | |
State | state = State::OFF |
The button interaction state. | |
glm::vec2 | pos = glm::vec2(0.0f) |
Screen position. | |
glm::vec2 | size = glm::vec2(1.0f) |
Screen size. | |
glm::vec2 | scale = glm::vec2(1.0f) |
Screen scale. | |
float | displayScale = 1.0f |
Initial display scale. | |
int | tag = 0 |
Action ID. | |
const Texture * | tid = nullptr |
Text texture. | |
Represents a button in a menu.
Inherited by MenuToggle.
MenuButton::MenuButton | ( | const glm::vec2 & | screenPos, |
const glm::vec2 & | meshSize, | ||
float | screenScale, | ||
int | actionTag, | ||
const Texture * | texture | ||
) |
Creates a new momentaneous button.
screenPos | position on screen in absolute units |
meshSize | the size of the button mesh |
screenScale | scaling to apply to the toggle on the X axis |
actionTag | the ID of the action associated to this button |
texture | the text texture on the button |
bool MenuButton::contains | ( | const glm::vec2 & | mousePos | ) | const |
Check if a position is inside the button.
mousePos | the position to test (in absolute units) |