class
AbstractXApplicationBase for X11-based applications.
Contents
Supports keyboard and mouse handling. See Platform support for brief introduction.
Derived classes
- class GlxApplication
- GLX application.
- class XEglApplication
- X/EGL application.
Public types
- struct Arguments
- Application arguments.
- class Configuration
- Configuration.
- class GLConfiguration
- OpenGL context configuration.
- class InputEvent
- Base for input events.
- class KeyEvent
- Key event.
- class MouseEvent
- Mouse event.
- class MouseMoveEvent
- Mouse move event.
Constructors, destructors, conversion operators
- AbstractXApplication(const AbstractXApplication&) deleted
- Copying is not allowed.
- AbstractXApplication(AbstractXApplication&&) deleted
- Moving is not allowed.
Public functions
- auto operator=(const AbstractXApplication&) -> AbstractXApplication& deleted
- Copying is not allowed.
- auto operator=(AbstractXApplication&&) -> AbstractXApplication& deleted
- Moving is not allowed.
- auto exec() -> int
- Execute main loop.
- void exit()
- Exit application main loop.
Protected functions
- void create(const Configuration& configuration, const GLConfiguration& glConfiguration)
- Create a window with given configuration for OpenGL context.
- void create(const Configuration& configuration)
- Create a window with given configuration and OpenGL context.
- void create()
- Create a window with default configuration and OpenGL context.
- void createContext(const Configuration& configuration) deprecated
- Create a window with given configuration for OpenGL context.
- void createContext() deprecated
- Create a window with default configuration and OpenGL context.
- auto tryCreate(const Configuration& configuration, const GLConfiguration& glConfiguration) -> bool
- Try to create context with given configuration for OpenGL context.
- auto tryCreate(const Configuration& configuration) -> bool
- Try to create context with given configuration and OpenGL context.
- auto tryCreateContext(const Configuration& configuration) -> bool deprecated
- Try to create context with given configuration for OpenGL context.
Screen handling
- void swapBuffers() protected
- Swap buffers.
- void redraw() protected
- Redraw immediately.
- void viewportEvent(const Vector2i& size) protected virtual
- Viewport event.
- void drawEvent() protected pure virtual
- Draw event.
Keyboard handling
- void keyPressEvent(KeyEvent& event) protected virtual
- Key press event.
- void keyReleaseEvent(KeyEvent& event) protected virtual
- Key release event.
Mouse handling
- void mousePressEvent(MouseEvent& event) protected virtual
- Mouse press event.
- void mouseReleaseEvent(MouseEvent& event) protected virtual
- Mouse release event.
- void mouseMoveEvent(MouseMoveEvent& event) protected virtual
- Mouse move event.
Function documentation
int Magnum:: Platform:: AbstractXApplication:: exec()
Execute main loop.
Returns | Value for returning from main() |
---|
See MAGNUM_
void Magnum:: Platform:: AbstractXApplication:: create(const Configuration& configuration,
const GLConfiguration& glConfiguration) protected
Create a window with given configuration for OpenGL context.
Parameters | |
---|---|
configuration | Application configuration |
glConfiguration | OpenGL context configuration |
Must be called only if the context wasn't created by the constructor itself, i.e. when passing NoCreate to it. Error message is printed and the program exits if the context cannot be created, see tryCreate() for an alternative.
void Magnum:: Platform:: AbstractXApplication:: create(const Configuration& configuration) protected
Create a window with given configuration and OpenGL context.
Equivalent to calling create(const Configuration&, const GLConfiguration&) with default-constructed GLConfiguration.
void Magnum:: Platform:: AbstractXApplication:: create() protected
Create a window with default configuration and OpenGL context.
Equivalent to calling create(const Configuration&) with default-constructed Configuration.
void Magnum:: Platform:: AbstractXApplication:: createContext(const Configuration& configuration) protected
Create a window with given configuration for OpenGL context.
void Magnum:: Platform:: AbstractXApplication:: createContext() protected
Create a window with default configuration and OpenGL context.
bool Magnum:: Platform:: AbstractXApplication:: tryCreate(const Configuration& configuration,
const GLConfiguration& glConfiguration) protected
Try to create context with given configuration for OpenGL context.
Unlike create(const Configuration&, const GLConfiguration&) returns false
if the context cannot be created, true
otherwise.
bool Magnum:: Platform:: AbstractXApplication:: tryCreate(const Configuration& configuration) protected
Try to create context with given configuration and OpenGL context.
Unlike create(const Configuration&) returns false
if the context cannot be created, true
otherwise.
bool Magnum:: Platform:: AbstractXApplication:: tryCreateContext(const Configuration& configuration) protected
Try to create context with given configuration for OpenGL context.
void Magnum:: Platform:: AbstractXApplication:: swapBuffers() protected
Swap buffers.
Paints currently rendered framebuffer on screen.
void Magnum:: Platform:: AbstractXApplication:: redraw() protected
Redraw immediately.
Marks the window for redrawing, resulting in call to drawEvent() in the next iteration. You can call it from drawEvent() itself to redraw immediately without waiting for user input.
void Magnum:: Platform:: AbstractXApplication:: viewportEvent(const Vector2i& size) virtual protected
Viewport event.
Called when window size changes. The default implementation does nothing. If you want to respond to size changes, you should pass the new size to GL::
Note that this function might not get called at all if the window size doesn't change. You should configure the initial state of your cameras, framebuffers etc. in application constructor rather than relying on this function to be called. Viewport of default framebuffer can be retrieved via GL::
void Magnum:: Platform:: AbstractXApplication:: drawEvent() pure virtual protected
Draw event.
Called when the screen is redrawn. You should clean the framebuffer using GL::
void Magnum:: Platform:: AbstractXApplication:: keyPressEvent(KeyEvent& event) virtual protected
Key press event.
Called when an key is pressed. Default implementation does nothing.
void Magnum:: Platform:: AbstractXApplication:: keyReleaseEvent(KeyEvent& event) virtual protected
Key release event.
Called when an key is released. Default implementation does nothing.
void Magnum:: Platform:: AbstractXApplication:: mousePressEvent(MouseEvent& event) virtual protected
Mouse press event.
Called when mouse button is pressed. Default implementation does nothing.
void Magnum:: Platform:: AbstractXApplication:: mouseReleaseEvent(MouseEvent& event) virtual protected
Mouse release event.
Called when mouse button is released. Default implementation does nothing.
void Magnum:: Platform:: AbstractXApplication:: mouseMoveEvent(MouseMoveEvent& event) virtual protected
Mouse move event.
Called when mouse is moved. Default implementation does nothing.