12 #ifndef IMGUIWRAPPER_H
13 #define IMGUIWRAPPER_H
98 _context = ImGui::CreateContext(fontAtlas);
119 void init(
const std::string& configPath);
167 float dt = t -
_tOld;
174 float diffMW =
_diff / (fontSize * 5.f);
255 void init(
const std::string& configPath)
override;
static SLint mouseX
Last mouse position x in pixels.
static SLint mouseY
Last mouse position y in pixels.
SLMouseButton
Mouse button codes.
SLKey
Keyboard key codes enumeration.
ImGuiContext * context() const
void init(const std::string &configPath)
ImGuiRenderer * _renderer
ImGuiEngine(std::string configDir, ImFontAtlas *fontAtlas)
ImGuiRenderer * renderer() const
ImGuiRenderer(ImGuiContext *context)
virtual void render(const SLRecti &viewportRect)
int _fragHandle
OpenGL handle for fragment shader.
int _attribLocPosition
OpenGL attribute location for vertex pos.
void printCompileErrors(SLint shaderHandle, const SLchar *src)
Prints the compile errors in case of a GLSL compile failure.
int _vertHandle
OpenGL handle for vertex shader.
int _attribLocColor
OpenGL attribute location for color.
int _attribLocUV
OpenGL attribute location for texture coords.
int _attribLocTex
OpenGL attribute location for texture.
unsigned int _elementsHandle
OpenGL handle for vertex indexes.
int _attribLocProjMtx
OpenGL attribute location for ???
unsigned int _fontTexture
OpenGL texture id for font.
ImGuiRendererOpenGL(ImGuiContext *context)
void deleteOpenGLObjects()
Deletes all OpenGL objects for drawing the imGui.
int _progHandle
OpenGL handle for shader program.
unsigned int _vboHandle
OpenGL handle for vertex buffer object.
void render(const SLRecti &viewportRect) override
void createOpenGLObjects()
Creates all OpenGL objects for drawing the imGui.
unsigned int _vaoHandle
OpenGL vertex array object handle.
ImGui Interface class for forwarding all events to the ImGui Handlers.
void onMouseDown(SLMouseButton button, SLint x, SLint y) override
Callback on mouse button down event.
ImGuiWrapper(ImGuiContext *context, ImGuiRenderer *renderer)
virtual void build(SLScene *s, SLSceneView *sv)=0
void init(const std::string &configPath) override
Initializes OpenGL handles to zero and sets the ImGui key map.
void onMouseWheel(SLfloat yoffset) override
Callback for the mouse scroll movement.
void onMouseUp(SLMouseButton button, SLint x, SLint y) override
Callback on mouse button up event.
void onKeyPress(SLKey key, SLKey mod) override
Callback on key press event.
void onResize(SLint scrW, SLint scrH) override
Callback if window got resized.
void onClose() override
Callback on closing the application.
void onMouseMove(SLint xPos, SLint yPos) override
Updates the mouse cursor position.
SLfloat _timeSec
Time in seconds.
bool doNotDispatchKeyboard() override
inform if user keyboard input was consumed by the ui
SLfloat _mouseWheel
Mouse wheel position.
void onPaint(const SLRecti &viewport) override
Callback for main rendering for the ImGui GUI system.
void onInitNewFrame(SLScene *s, SLSceneView *sv) override
Inits a new frame for the ImGui system.
void onCharInput(SLuint c) override
Callback on character input.
void renderExtraFrame(SLScene *s, SLSceneView *sv, SLint mouseX, SLint mouseY) override
Renders an extra frame with the current mouse position.
ImGuiRenderer * _renderer
void onKeyRelease(SLKey key, SLKey mod) override
Callback on key release event.
bool doNotDispatchMouse() override
inform if user mouse input was consumed by the ui
The SLScene class represents the top level instance holding the scene structure.
SceneView class represents a dynamic real time 3D view onto the scene.
Interface for ui integration in SLSceneView.