gramods
Public Member Functions | Static Public Attributes | List of all members
gramods::gmGraphics::SdlWindow Class Reference

An SDL window implementation. More...

#include <SdlWindow.hh>

Inheritance diagram for gramods::gmGraphics::SdlWindow:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmGraphics::SdlWindow:
Collaboration graph
[legend]

Public Member Functions

void initialize () override
 Called to initialize the Object. More...
 
void makeGLContextCurrent () override
 Asks the Window to make its GL context current. More...
 
gmCore::size2 getSize ()
 Returns the size of the drawable canvas of this window, in pixels. More...
 
void close () override
 Close window. More...
 
void setUseQuadBuffers (bool on)
 Sets if quad buffers should be requested for the GL context. More...
 
void setGLMajor (int v)
 Sets the major version to be requested for the GL context in this Window. More...
 
void setGLMinor (int v)
 Sets the minor version to be requested for the GL context in this Window. More...
 
void setGLProfile (std::string s)
 Sets the profile to be requested for the GL context in this Window. More...
 
void setContext (std::shared_ptr< gmCore::SdlContext > ctx)
 The SDL context. More...
 
void processEvents () override
 Triggers the windows to process its incoming events. More...
 
bool isOpen () override
 Returns true as long as the window is open. More...
 
void swap () override
 Finalizes the rendering and swaps the render buffers to show the newly rendered material. More...
 
void traverse (Visitor *visitor) override
 Propagates the specified visitor. More...
 
- Public Member Functions inherited from gramods::gmGraphics::Window
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 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 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 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 void sync ()
 Calls glFinish on the GL context. More...
 
- Public Member Functions inherited from gramods::gmGraphics::ViewBase
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...
 
- Public Member Functions inherited from gramods::gmCore::Object
 Object ()
 Initializes internal data. More...
 
virtual ~Object ()
 Cleaning up internal data. 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 Public Attributes inherited from gramods::gmGraphics::Window
static gramods::gmCore::OFactory::OFactoryInformation _gm_ofi
 
- Static Public Attributes inherited from gramods::gmGraphics::ViewBase
static gramods::gmCore::OFactory::OFactoryInformation _gm_ofi
 

Additional Inherited Members

- Protected Member Functions inherited from gramods::gmGraphics::ViewBase
void populateViewSettings (ViewSettings &settings)
 Adds the dispatcher's local renderers and viewpoint, if set. More...
 
- Protected Attributes inherited from gramods::gmGraphics::Window
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
 
- Protected Attributes inherited from gramods::gmGraphics::ViewBase
Node::list nodes
 
std::vector< std::shared_ptr< Viewpoint > > viewpoints
 

Detailed Description

An SDL window implementation.

Member Function Documentation

◆ close()

void gramods::gmGraphics::SdlWindow::close ( )
overridevirtual

Close window.

Implements gramods::gmGraphics::Window.

◆ getSize()

gmCore::size2 gramods::gmGraphics::SdlWindow::getSize ( )
virtual

Returns the size of the drawable canvas of this window, in pixels.

Reimplemented from gramods::gmGraphics::Window.

◆ initialize()

void gramods::gmGraphics::SdlWindow::initialize ( )
overridevirtual

Called to initialize the Object.

This should be called once only!

Sub classes should override this method to make use of set parameter data. They should also always call its base class' implementation as well.

Reimplemented from gramods::gmCore::Object.

◆ isOpen()

bool gramods::gmGraphics::SdlWindow::isOpen ( )
overridevirtual

Returns true as long as the window is open.

This does not necessarily mean that the window is visible.

Reimplemented from gramods::gmGraphics::Window.

◆ makeGLContextCurrent()

void gramods::gmGraphics::SdlWindow::makeGLContextCurrent ( )
overridevirtual

Asks the Window to make its GL context current.

This is called automatically by the renderFullPipeline method.

Implements gramods::gmGraphics::Window.

◆ processEvents()

void gramods::gmGraphics::SdlWindow::processEvents ( )
overridevirtual

Triggers the windows to process its incoming events.

This must be called at even intervals for the window to behave properly.

Implements gramods::gmGraphics::Window.

◆ setContext()

gramods::gmCore::OFactory::PointerSetterInsert gm_ofi_SdlWindow_pointer_context &SdlWindow::_gm_ofi(& gramods::gmGraphics::SdlWindow::setContext ( std::shared_ptr< gmCore::SdlContext ctx)
inline

The SDL context.

Providing the context pointer to the SDL window is not strictly necessary, but putting the SDL context here ensures that it is not destroyed until the SdlWindow has been destroyed.

XML-attribute: context

◆ setGLMajor()

gramods::gmCore::OFactory::ParamSetterInsert gm_ofi_SdlWindow_param_GLMajor &SdlWindow::_gm_ofi(& gramods::gmGraphics::SdlWindow::setGLMajor ( int  v)
inline

Sets the major version to be requested for the GL context in this Window.

XML-attribute: GLMajor

◆ setGLMinor()

gramods::gmCore::OFactory::ParamSetterInsert gm_ofi_SdlWindow_param_GLMinor &SdlWindow::_gm_ofi(& gramods::gmGraphics::SdlWindow::setGLMinor ( int  v)
inline

Sets the minor version to be requested for the GL context in this Window.

XML-attribute: GLMinor

◆ setGLProfile()

gramods::gmCore::OFactory::ParamSetterInsert gm_ofi_SdlWindow_param_GLProfile &SdlWindow::_gm_ofi(& gramods::gmGraphics::SdlWindow::setGLProfile ( std::string  s)
inline

Sets the profile to be requested for the GL context in this Window.

Valid values are CORE, ES and COMPATIBILITY.

XML-attribute: GLProfile

◆ setUseQuadBuffers()

gramods::gmCore::OFactory::ParamSetterInsert gm_ofi_SdlWindow_param_useQuadBuffers &SdlWindow::_gm_ofi(& gramods::gmGraphics::SdlWindow::setUseQuadBuffers ( bool  on)
inline

Sets if quad buffers should be requested for the GL context.

XML-attribute: useQuadBuffers

◆ swap()

void gramods::gmGraphics::SdlWindow::swap ( )
overridevirtual

Finalizes the rendering and swaps the render buffers to show the newly rendered material.

Implements gramods::gmGraphics::Window.

◆ traverse()

void gramods::gmGraphics::SdlWindow::traverse ( Visitor visitor)
overridevirtual

Propagates the specified visitor.

See also
Object::Visitor

Reimplemented from gramods::gmCore::Object.


The documentation for this class was generated from the following files: