SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
ImGui Interface class for forwarding all events to the original ImGui Handlers. More...
#include <SLImGui.h>
Public Member Functions | |
SLImGui (cbOnImGuiBuild buildCB, cbOnImGuiLoadConfig loadConfigCB, cbOnImGuiSaveConfig saveConfigCB, int dpi, SLIOBuffer fontDataProp, SLIOBuffer fontDataFixed) | |
~SLImGui () override | |
void | init (const string &configPath) override |
Initializes OpenGL handles to zero and sets the ImGui key map. More... | |
void | onInitNewFrame (SLScene *s, SLSceneView *sv) override |
Inits a new frame for the ImGui system. More... | |
void | onResize (const SLRecti &viewport) override |
Callback if window got resized. More... | |
void | onPaint (const SLRecti &viewport) override |
Callback for main rendering for the ImGui GUI system. More... | |
void | onMouseDown (SLMouseButton button, SLint x, SLint y) override |
Callback on mouse button down event. More... | |
void | onMouseUp (SLMouseButton button, SLint x, SLint y) override |
Callback on mouse button up event. More... | |
void | onMouseMove (SLint xPos, SLint yPos) override |
Updates the mouse cursor position. More... | |
void | onMouseWheel (SLfloat yoffset) override |
Callback for the mouse scroll movement. More... | |
void | onKeyPress (SLKey key, SLKey mod) override |
Callback on key press event. More... | |
void | onKeyRelease (SLKey key, SLKey mod) override |
Callback on key release event. More... | |
void | onCharInput (SLuint c) override |
Callback on character input. More... | |
void | onClose () override |
Callback on closing the application. More... | |
void | renderExtraFrame (SLScene *s, SLSceneView *sv, SLint mouseX, SLint mouseY) override |
Renders an extra frame with the current mouse position. More... | |
bool | doNotDispatchKeyboard () override |
inform if user keyboard input was consumed by the ui More... | |
bool | doNotDispatchMouse () override |
inform if user mouse input was consumed by the ui More... | |
void | loadFonts (SLfloat fontPropDots, SLfloat fontFixedDots) |
Loads the proportional and fixed size font depending on the passed DPI. More... | |
void | drawMouseCursor (bool doDraw) override |
Turns on or off the mouse cursor drawing. More... | |
Public Member Functions inherited from SLUiInterface | |
virtual | ~SLUiInterface () |
Static Public Attributes | |
static SLfloat | fontPropDots = 16.0f |
Default font size of proportional font. More... | |
static SLfloat | fontFixedDots = 13.0f |
Default font size of fixed size font. More... | |
Private Member Functions | |
void | deleteOpenGLObjects () |
void | createOpenGLObjects () |
void | printCompileErrors (SLint shaderHandle, const SLchar *src) |
Prints the compile errors in case of a GLSL compile failure. More... | |
Private Attributes | |
cbOnImGuiBuild | _build = nullptr |
cbOnImGuiSaveConfig | _saveConfig = nullptr |
SLfloat | _timeSec |
Time in seconds. More... | |
SLVec2f | _mousePosPX |
Mouse cursor position. More... | |
SLfloat | _mouseWheel |
Mouse wheel position. More... | |
SLbool | _mousePressed [3] |
Mouse button press state. More... | |
SLfloat | _fontPropDots |
Active font size of proportional font. More... | |
SLfloat | _fontFixedDots |
Active font size of fixed size font. More... | |
SLstring | _configPath |
Path to config files. More... | |
SLIOBuffer | _fontDataProp |
Raw data of proportional font file. More... | |
SLIOBuffer | _fontDataFixed |
Raw data of fixed size font file. More... | |
ImGui Interface class for forwarding all events to the original ImGui Handlers.
ImGui is a super easy GUI library for the rendering of a UI with OpenGL. For more information see: https://github.com/ocornut/imgui
This class provides only the interface into ImGui. In the event handlers of SLSceneView the according callback in ImGui is called.
Compared to the older SLGLImGui class this class contains no OpenGL code and only calls the original backend functions in ImGui_impl_OpenGL3.cpp provided by the ImGui framework.
There is no UI drawn with this class. It must be defined in another class that provides the build function. For the Demo apps this is done in the file AppDemoGui and the build function is passed e.g. in glfwMain function of the app-demo project.
The full call stack for rendering one frame is:
SLImGui::SLImGui | ( | cbOnImGuiBuild | buildCB, |
cbOnImGuiLoadConfig | loadConfigCB, | ||
cbOnImGuiSaveConfig | saveConfigCB, | ||
int | dpi, | ||
SLIOBuffer | fontDataProp, | ||
SLIOBuffer | fontDataFixed | ||
) |
Definition at line 27 of file SLImGui.cpp.
|
override |
Definition at line 75 of file SLImGui.cpp.
|
private |
|
private |
|
inlineoverridevirtual |
inform if user keyboard input was consumed by the ui
Reimplemented from SLUiInterface.
|
inlineoverridevirtual |
inform if user mouse input was consumed by the ui
(e.g. the ui was hit by a mouse click. In this case the user input would not be forwarded to 3D scene graph)
Reimplemented from SLUiInterface.
|
inlineoverridevirtual |
Turns on or off the mouse cursor drawing.
Reimplemented from SLUiInterface.
|
overridevirtual |
Initializes OpenGL handles to zero and sets the ImGui key map.
Reimplemented from SLUiInterface.
Definition at line 81 of file SLImGui.cpp.
Loads the proportional and fixed size font depending on the passed DPI.
Definition at line 151 of file SLImGui.cpp.
Callback on character input.
Reimplemented from SLUiInterface.
Definition at line 298 of file SLImGui.cpp.
|
overridevirtual |
Callback on closing the application.
Reimplemented from SLUiInterface.
Definition at line 141 of file SLImGui.cpp.
|
overridevirtual |
Inits a new frame for the ImGui system.
Reimplemented from SLUiInterface.
Definition at line 183 of file SLImGui.cpp.
Callback on key press event.
Reimplemented from SLUiInterface.
Definition at line 278 of file SLImGui.cpp.
Callback on key release event.
Reimplemented from SLUiInterface.
Definition at line 288 of file SLImGui.cpp.
|
overridevirtual |
Callback on mouse button down event.
Reimplemented from SLUiInterface.
Definition at line 242 of file SLImGui.cpp.
Updates the mouse cursor position.
Reimplemented from SLUiInterface.
Definition at line 264 of file SLImGui.cpp.
|
overridevirtual |
Callback on mouse button up event.
Reimplemented from SLUiInterface.
Definition at line 253 of file SLImGui.cpp.
Callback for the mouse scroll movement.
Reimplemented from SLUiInterface.
Definition at line 271 of file SLImGui.cpp.
Callback for main rendering for the ImGui GUI system.
Reimplemented from SLUiInterface.
Definition at line 234 of file SLImGui.cpp.
Callback if window got resized.
Reimplemented from SLUiInterface.
Definition at line 225 of file SLImGui.cpp.
Prints the compile errors in case of a GLSL compile failure.
Definition at line 178 of file SLImGui.cpp.
|
overridevirtual |
Renders an extra frame with the current mouse position.
Reimplemented from SLUiInterface.
Definition at line 306 of file SLImGui.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |
|
static |