JMgui
Loading...
Searching...
No Matches
Graph Class Reference

A scrollable graph of data. Data and time steps must be manualy updated. More...

#include <JMgui.h>

Inheritance diagram for Graph:
GuiElement

Public Member Functions

 Graph (float PosX, float PosY, float SizeX, float SizeY)
 Graph (float PosX, float PosY, float SizeX, float SizeY, std::string Title)
void render ()
 draw the element to the buffer. Override this to make the element custom.
void advanceTime ()
 Advances the graphs time by 1.0.
void advanceTime (float time)
 Advanced the graphs time by a specified value.
void setTime (float time)
 Sets the graphs time to be centered on a specific value.
void clearGraph ()
 Clears all graph data and sets time to zero. Does not delete lines.
void resetGraph ()
 Clears all graph data, sets time to zero and deletes lines.
void addLine (glm::vec3 color, std::string name)
 Adds a new line with a specified color and name.
void updateLine (int index, float value)
 Updates the specified line with new data.
Public Member Functions inherited from GuiElement
 GuiElement (float PosX, float PosY, float SizeX, float SizeY)
 GuiElement (GuiElement &)=delete
GuiElementoperator= (const GuiElement &)=delete
 GuiElement (GuiElement &&)=default
GuiElementoperator= (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 ()

Public Attributes

float maxVal = 12.0f
 Values equal to this will be at the top of the graph.
float minVal = 0.0f
 Values equal to this will be at the bottom of the graph.
float minTime = 0.0f
 Values recorded at this time will be on the left of the graph.
float maxTime = 12.0f
 Values recorded at this time will be on the right of the graph.
bool autoScaleX = false
 If true, the graph will auto scale on the X axis to include the whole graph when new data is inputed or on time step.
bool autoScaleY = true
 If true, the graph will auto scale on the Y axis to include the whole graph when new data is inputed or on time step.
bool autoScrollX = true
 If true, the graph will always scroll so that the current time step is on the right side.
std::vector< float > xValues
 Add floats to this to place dashed lines at a fixed value.
std::vector< float > yValues
 Add floats to this to place dashed lines at a fixed value.
Public Attributes inherited from GuiElement
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.
JMwindowwindow = nullptr
 the window that this element is drawn to.
ClickEventevent_clicked = nullptr
RightClickEventevent_rightClicked = nullptr
std::string displayTitle = ""

Additional Inherited Members

Protected Member Functions inherited from GuiElement
void registerEvent (JMeventDispatcher::Event *event)
 adds an event to the window's event handler.
Protected Attributes inherited from GuiElement
int RenderLayer = 0
GuiElementHandlerhandler = 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.

Detailed Description

A scrollable graph of data. Data and time steps must be manualy updated.

Member Function Documentation

◆ render()

void Graph::render ( )
virtual

draw the element to the buffer. Override this to make the element custom.

Reimplemented from GuiElement.


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