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

#include <JMgui.h>

Public Member Functions

 RenderEnvironment (float SizeX, float SizeY, JMwindow *ParentWindow)
 RenderEnvironment (RenderEnvironment &)=delete
RenderEnvironmentoperator= (const RenderEnvironment &)=delete
 RenderEnvironment (RenderEnvironment &&)=default
RenderEnvironmentoperator= (RenderEnvironment &&)=default
void setRenderFunc (std::function< void(JMGraphics *gr)> render)
 set a render function to be run on a seperate thread.
void setSize (float X, float Y)
 Re-set the size of the environment.
void display (float posX, float posY, float sizeX, float sizeY)
 draw the most recently rendered frame.
void display (float posX, float posY)
 draw the most recently rendered frame.
void startLoop ()
 starts the render loop in a seperate thread.
void forceRenderOneFrame ()
 If waitForDisplay is on, this will force render one frame in the background.

Public Attributes

JMGraphics * gr = nullptr
 The renderEnvironments graphics engine instance. This has a shared context with the parent windows JMGraphics object, but runs in a seperate thread.
JMwindowparentWindow = nullptr
bool waitForDisplay = false
 If true, the render environment will only render one frame for every display call, capping the frame rate to the main threads frame rate, and pausing it if display isnt called.

Detailed Description

A rendering environment that renders asynchronously on a seperate thread. A function must set using setRenderFunc(std::function<void (JMGraphics* gr) render>) that will be run in a loop on a seperate thread. After the render function is set, startLoop() must be called to start the render thread. Call display() inside the parent windows draw loop to draw the rendered environment to the main window.


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