gramods
|
The base of graphics Window implementations. More...
#include <Window.hh>
Classes | |
struct | event |
struct | key_event |
Public Member Functions | |
void | renderFullPipeline (ViewSettings settings) override |
Dispatches specified renders, both method argument and class members, to the views in this window. More... | |
void | traverse (Visitor *visitor) override |
Propagates the specified visitor. More... | |
void | addView (std::shared_ptr< View > view) |
Adds a view to the window. More... | |
virtual void | makeGLContextCurrent ()=0 |
Asks the Window to make its GL context current. More... | |
virtual void | close ()=0 |
Asks the Window to close itself. More... | |
virtual void | setFullscreen (bool on) |
Activates or deactivates fullscreen mode. More... | |
virtual void | setDisplay (size_t N) |
Set on which display the window should be shown. More... | |
virtual void | setSize (gmCore::size2 s) |
Sets the size of the drawable canvas of this window, in pixels. More... | |
virtual void | setPosition (gmCore::int2 p) |
Sets the position of the window. More... | |
virtual gmCore::size2 | getSize () |
Returns the size of the drawable canvas of this window, in pixels. More... | |
virtual void | setTitle (std::string t) |
Sets the title of the windows. More... | |
virtual void | setBackgroundColor (gmCore::float4 c) |
Set the background color of the window. More... | |
virtual void | processEvents ()=0 |
Triggers the windows to process its incoming events. More... | |
virtual bool | handleEvent (event *) |
Internal events handler, called from processEvents(). More... | |
void | addEventHandler (std::function< bool(const event *)> fun, void *tag) |
Registers an event handler associated with the specified tag. More... | |
void | removeEventHandler (void *tag) |
Removes the event handler associnated with the specified tag. More... | |
virtual bool | isOpen () |
Returns true as long as the window is open. More... | |
virtual void | swap ()=0 |
Posts a swap buffers command to the underlying windowing system, to show the newly rendered material. More... | |
virtual void | sync () |
Calls glFinish on the GL context. More... | |
![]() | |
void | addNode (std::shared_ptr< Node > node) |
Adds a scenegraph to the view. More... | |
void | setViewpoint (std::shared_ptr< Viewpoint > viewpoint) |
Sets the viewpoint to use in the views rendered by this ViewBase. More... | |
void | addViewpoint (std::shared_ptr< Viewpoint > viewpoint) |
Adds a viewpoint to use in the views rendered by this ViewBase. More... | |
![]() | |
Object () | |
Initializes internal data. More... | |
virtual | ~Object () |
Cleaning up internal data. More... | |
virtual void | initialize () |
Called to initialize the Object. More... | |
virtual void | accept (Visitor *visitor) |
Calls the visitors apply method with this as argument. More... | |
virtual std::string | getDefaultKey () |
Returns the default key for the Object when automatically instantiated in a Configuration, i.e. More... | |
bool | isInitialized () |
Returns true if the Object is initialized. More... | |
Static Public Attributes | |
static gramods::gmCore::OFactory::OFactoryInformation | _gm_ofi |
![]() | |
static gramods::gmCore::OFactory::OFactoryInformation | _gm_ofi |
Protected Attributes | |
std::vector< std::shared_ptr< View > > | views |
bool | fullscreen = false |
size_t | display = 0 |
std::string | title = "untitled gramods window" |
gmCore::size2 | size = {640, 480} |
gmCore::int2 | position |
gmCore::float4 | background_color = {0.f, 0.f, 0.f, 0.f} |
std::unordered_map< void *, std::function< bool(const event *)> > | event_handlers |
![]() | |
Node::list | nodes |
std::vector< std::shared_ptr< Viewpoint > > | viewpoints |
Additional Inherited Members | |
![]() | |
void | populateViewSettings (ViewSettings &settings) |
Adds the dispatcher's local renderers and viewpoint, if set. More... | |
The base of graphics Window implementations.
void gramods::gmGraphics::Window::addEventHandler | ( | std::function< bool(const event *)> | fun, |
void * | tag | ||
) |
Registers an event handler associated with the specified tag.
The tag can be a pointer to any object and is only used for calls to removeEventHandler.
|
inline |
Adds a view to the window.
A window without views will render nothing - it is the tiles that provide the graphics. If multiple views are added, then these will be rendered over each other.
XML-attribute: view
|
pure virtual |
Asks the Window to close itself.
This should be overloaded by sub classes to support run-time changes.
Implemented in gramods::gmGraphics::SdlWindow.
|
inlinevirtual |
Returns the size of the drawable canvas of this window, in pixels.
This should be overloaded by sub classes to also support run-time changes.
Reimplemented in gramods::gmGraphics::SdlWindow.
|
virtual |
Internal events handler, called from processEvents().
This will in turn call any registered event handler.
|
inlinevirtual |
Returns true as long as the window is open.
This does not necessarily mean that the window is visible and it may even be minimized.
Reimplemented in gramods::gmGraphics::SdlWindow.
|
pure virtual |
Asks the Window to make its GL context current.
This is called automatically by the renderFullPipeline method.
Implemented in gramods::gmGraphics::SdlWindow.
|
pure virtual |
Triggers the windows to process its incoming events.
This must be called at even intervals for the window to behave properly.
Implemented in gramods::gmGraphics::SdlWindow.
void gramods::gmGraphics::Window::removeEventHandler | ( | void * | tag | ) |
Removes the event handler associnated with the specified tag.
|
overridevirtual |
Dispatches specified renders, both method argument and class members, to the views in this window.
Reimplemented from gramods::gmGraphics::ViewBase.
|
inlinevirtual |
Set the background color of the window.
XML-attribute: backgroundColor
|
inlinevirtual |
Set on which display the window should be shown.
XML-attribute: display
|
inlinevirtual |
Activates or deactivates fullscreen mode.
This should be overloaded by sub classes to also support run-time changes.
XML-attribute: fullscreen
|
inlinevirtual |
Sets the position of the window.
XML-attribute: position
|
inlinevirtual |
Sets the size of the drawable canvas of this window, in pixels.
This should be overloaded by sub classes to also support run-time changes.
XML-attribute: size
|
inlinevirtual |
Sets the title of the windows.
This should be overloaded by sub classes to also support run-time changes.
XML-attribute: title
|
pure virtual |
Posts a swap buffers command to the underlying windowing system, to show the newly rendered material.
Most drivers allow this command to return immediately, however subsequent calls to render to the same context may stall to wait for vertical scan synchronization (v-sync).
Implemented in gramods::gmGraphics::SdlWindow.
|
virtual |
Calls glFinish on the GL context.
The only reason to call this method is if the application needs to wait for vertical scan synchronization (v-sync), for example for timing reasons.
|
overridevirtual |
Propagates the specified visitor.
Reimplemented from gramods::gmGraphics::ViewBase.
|
protected |