|
|
| GuiElement (float PosX, float PosY, float SizeX, float SizeY) |
|
| GuiElement (GuiElement &)=delete |
|
GuiElement & | operator= (const GuiElement &)=delete |
|
| GuiElement (GuiElement &&)=default |
|
GuiElement & | operator= (GuiElement &&)=default |
|
virtual void | setup (GuiElementHandler *Handler) |
|
virtual void | setup (JMwindow *Window) |
|
float | width () const |
|
float | height () const |
|
float | xPos () const |
|
float | yPos () const |
|
void | setPosition (float x, float y) |
|
void | setSize (float x, float y) |
|
void | setSizeX (float x) |
|
void | setSizeY (float y) |
|
bool | mouseOver () const |
| | returns true if the mouse is over the element.
|
|
float | localMouseX () const |
| | Returns the mouse position relative to the bottom left corner of the element.
|
|
float | localMouseY () const |
| | Returns the mouse position relative to the bottom left corner of the element.
|
|
bool | clicked () const |
| | returns true if the mouse is over the element and the left button is pressed and released.
|
|
bool | rightClicked () const |
| | returns true if the mouse is over the element and the right button is pressed and released.
|
|
bool | pressed () const |
| | returns true if the mouse is over the element and the left button is pressed.
|
| virtual void | display () |
| | is called by the element handler to display the element on the screen.
|
|
int | renderLayer () |
| virtual void | render () |
| | draw the element to the buffer. Override this to make the element custom.
|
|
|
float | dispTitleX = 0.0f |
|
float | dispTitleY = 0.0f |
|
bool | allowInput = true |
| | used to prevent user input to this element if needed.
|
|
bool | forceAllowInput = false |
| | if true, when the element handlers allowInput is set to false, this element will be exempt.
|
|
bool | hide = false |
| | the element is not updated or displayed if true
|
|
bool | constantUpdate = false |
| | Set this to true to re-render the element every frame. By default, the element is only re-rendered when animating (mouse over animation and pressed animation).
|
|
bool | staticElement = false |
| | if true, the element will only be rendered for the startup animation or if the window is resized, then displayed staticly. User input will not work.
|
|
bool | reRender = false |
| | If set to true, the element is re-rendered once, then this is set to false.
|
|
std::string | helpMessage = "" |
| | The help message that displays when the mouse is hovered over the object.
|
|
JMwindow * | window = nullptr |
| | the window that this element is drawn to.
|
|
ClickEvent * | event_clicked = nullptr |
|
RightClickEvent * | event_rightClicked = nullptr |
|
std::string | displayTitle = "" |
|
|
int | RenderLayer = 0 |
|
GuiElementHandler * | handler = nullptr |
| | the handler object that this element is drawn by.
|
|
JMGraphics * | gr = nullptr |
| | the graphics object of the parent window. use this objects graphics functions to draw the ui element.
|
|
JMGraphics::Buffer * | graphicsBuffer = nullptr |
| | the element is drawn to a graphics buffer so that the graphics only have to be generated when nescecary, and still displayed on the screen every frame.
|
|
JMGraphics::Font * | dispTitleFont = nullptr |
| | The font used to render the title.
|
|
float | posX = 0.0f |
|
float | posY = 0.0f |
|
float | sizeX = 0.0f |
|
float | sizeY = 0.0f |
|
glm::vec2 | dispTitleSize = glm::vec2(0.0f, 0.0f) |
| | stores the physical size of the displayed title
|
|
float | dispTitleScale = 1.0f |
| | sets the physical size of the title
|
|
float | anim_start = 0.0f |
| | use to create a startup animation. Increases from 0.0f to 1.0f over time when the element is first displayed.
|
|
float | anim_mouseOver = 0.0f |
| | use to create a mouse over animation. Increases from 0.0f to 1.0f over time when the mouse is over the element.
|
|
float | anim_pressed = 0.0f |
| | use to create a pressed animation. Increases from 0.0f to 1.0f over time when the element is pressed with the mouse.
|
|
float | anim_clicked = 0.0f |
| | use to create a clicked animation. When the element is clicked, it will be set to 1.0f, then decrease to 0.0f over time.
|
|
bool | fixedX = false |
| | If true, the element cannot be resized on the x axis.
|
|
bool | fixedY = false |
| | If true, the element cannot be resized on the y axis.
|
The base class that gui elements are derived from. All gui elements must be added to a GuiElementHandler to function. The handler handles rendering, event dispatching and destruction of the gui elements so keeping a seperate pointer to it is not usually necessary.
For efficiency, the gui element is rendered to an internal graphics buffer and only updated when any of the animation variables != 0.0 by default.
To set up events, call JMEventDispatcher::Event::addListener on the gui elements member event instance. Pass a function or lambda with a JMeventDispatcher::Event pointer as its only parameter. When called, the event instance will pass itself so in order to access any stored data in the event, static cast it to the derived event class.