19 #include <mrpt/config.h> 21 #include <nanogui/nanogui.h> 79 const std::string& caption = std::string(),
unsigned int width = 400,
80 unsigned int height = 300,
86 template <
typename... Args>
89 return std::make_shared<CDisplayWindowGUI>(std::forward<Args>(args)...);
93 void resize(
unsigned int width,
unsigned int height);
148 int key,
int scancode,
int action,
int modifiers)
override;
154 const nanogui::Vector2i& p,
const nanogui::Vector2i& rel,
int button,
155 int modifiers)
override;
157 const nanogui::Vector2i& p,
int button,
bool down,
158 int modifiers)
override;
160 const nanogui::Vector2i& p,
const nanogui::Vector2f& rel)
override;
171 #endif // MRPT_HAS_NANOGUI
virtual bool mouseMotionEvent(const nanogui::Vector2i &p, const nanogui::Vector2i &rel, int button, int modifiers) override
std::function< void(void)> m_loopCallback
void resize(unsigned int width, unsigned int height)
Resizes the window.
CDisplayWindowGUI & operator=(const CDisplayWindowGUI &)=delete
virtual ~CDisplayWindowGUI() override
#define ASSERT_(f)
Defines an assertion mechanism.
nanogui::Window * m_window
the pointer is owned by the parent class Screen, no need to delete it
void setWindowTitle(const std::string &str)
Changes the window title.
CDisplayWindowGUI(const std::string &caption=std::string(), unsigned int width=400, unsigned int height=300, const CDisplayWindowGUI_Params &p=CDisplayWindowGUI_Params())
const CGlCanvasBase & camera() const
static Ptr Create(Args &&... args)
Class factory returning a smart pointer.
virtual bool scrollEvent(const nanogui::Vector2i &p, const nanogui::Vector2f &rel) override
const std::function< void(void)> & loopCallback() const
std::mutex background_scene_mtx
internal::NanoGUICanvasHeadless m_background_canvas
Used to keep track of mouse events on the camera.
void setPos(int x, int y)
Changes the position of the window on the screen.
mrpt::opengl::COpenGLScene::Ptr background_scene
virtual void drawContents() override
Additional parameters to change the window behavior and OpenGL context.
virtual bool keyboardEvent(int key, int scancode, int action, int modifiers) override
void setLoopCallback(const std::function< void(void)> &callback)
Every time the window is about to be repainted, an optional callback can be called, if provided via this method.
CDisplayWindowGUI_Params()=default
virtual bool mouseButtonEvent(const nanogui::Vector2i &p, int button, bool down, int modifiers) override
Classes for creating GUI windows for 2D and 3D visualization.
Specialization of CGlCanvasBaseHeadless for nanogui events.
This base class implements a working with opengl::Camera and a OpenGL canvas, and it's used in gui::C...
A window with powerful GUI capabilities, via the nanogui library.
nanogui::Window * nanogui_win()