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 ImGui Handlers. More...
#include <ImGuiWrapper.h>
Public Member Functions | |
ImGuiWrapper (ImGuiContext *context, ImGuiRenderer *renderer) | |
~ImGuiWrapper () override | |
void | init (const std::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 (SLint scrW, SLint scrH) 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... | |
virtual void | build (SLScene *s, SLSceneView *sv)=0 |
Public Member Functions inherited from SLUiInterface | |
virtual | ~SLUiInterface () |
virtual void | init (const string &configPath) |
initialization (called by SLSceneView init) More... | |
virtual void | onResize (const SLRecti &viewportRect) |
inform the ui about scene view size change More... | |
virtual void | drawMouseCursor (bool doDraw) |
Turns on or off the mouse cursor drawing. More... | |
Protected Attributes | |
PanScrolling | _panScroll |
ImGuiContext * | _context {nullptr} |
Private Attributes | |
SLfloat | _timeSec |
Time in seconds. More... | |
SLfloat | _mouseWheel {0} |
Mouse wheel position. More... | |
ImGuiRenderer * | _renderer {nullptr} |
ImGui Interface class for forwarding all events to the 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.
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 class SLDemoGui 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:
The interface function are called by a SLSceneView instance
Definition at line 250 of file ImGuiWrapper.h.
ImGuiWrapper::ImGuiWrapper | ( | ImGuiContext * | context, |
ImGuiRenderer * | renderer | ||
) |
Definition at line 431 of file ImGuiWrapper.cpp.
|
override |
Definition at line 439 of file ImGuiWrapper.cpp.
|
pure virtual |
|
overridevirtual |
inform if user keyboard input was consumed by the ui
Reimplemented from SLUiInterface.
Definition at line 592 of file ImGuiWrapper.cpp.
|
overridevirtual |
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.
Definition at line 597 of file ImGuiWrapper.cpp.
|
override |
Initializes OpenGL handles to zero and sets the ImGui key map.
Definition at line 444 of file ImGuiWrapper.cpp.
Callback on character input.
Reimplemented from SLUiInterface.
Definition at line 571 of file ImGuiWrapper.cpp.
|
overridevirtual |
Callback on closing the application.
Reimplemented from SLUiInterface.
Definition at line 579 of file ImGuiWrapper.cpp.
|
overridevirtual |
Inits a new frame for the ImGui system.
Reimplemented from SLUiInterface.
Definition at line 450 of file ImGuiWrapper.cpp.
Callback on key press event.
Reimplemented from SLUiInterface.
Definition at line 551 of file ImGuiWrapper.cpp.
Callback on key release event.
Reimplemented from SLUiInterface.
Definition at line 561 of file ImGuiWrapper.cpp.
|
overridevirtual |
Callback on mouse button down event.
Reimplemented from SLUiInterface.
Definition at line 507 of file ImGuiWrapper.cpp.
Updates the mouse cursor position.
Reimplemented from SLUiInterface.
Definition at line 534 of file ImGuiWrapper.cpp.
|
overridevirtual |
Callback on mouse button up event.
Reimplemented from SLUiInterface.
Definition at line 523 of file ImGuiWrapper.cpp.
Callback for the mouse scroll movement.
Reimplemented from SLUiInterface.
Definition at line 544 of file ImGuiWrapper.cpp.
Callback for main rendering for the ImGui GUI system.
Reimplemented from SLUiInterface.
Definition at line 500 of file ImGuiWrapper.cpp.
Callback if window got resized.
Definition at line 491 of file ImGuiWrapper.cpp.
|
overridevirtual |
Renders an extra frame with the current mouse position.
Reimplemented from SLUiInterface.
Definition at line 584 of file ImGuiWrapper.cpp.
|
protected |
Definition at line 278 of file ImGuiWrapper.h.
|
private |
Mouse wheel position.
Definition at line 282 of file ImGuiWrapper.h.
|
protected |
Definition at line 277 of file ImGuiWrapper.h.
|
private |
Definition at line 284 of file ImGuiWrapper.h.
|
private |
Time in seconds.
Definition at line 281 of file ImGuiWrapper.h.