Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::Graphics::GameWindow Class Reference

This class is for creating and managing game windows. More...

#include <gamewindow.h>

+ Collaboration diagram for Mezzanine::Graphics::GameWindow:

Public Types

typedef ViewportContainer::const_reverse_iterator ConstReverseViewportIterator
 Const Reverse Iterator type for Viewport instances stored by this class.
 
typedef ViewportContainer::const_iterator ConstViewportIterator
 Const Iterator type for Viewport instances stored by this class.
 
typedef ViewportContainer::reverse_iterator ReverseViewportIterator
 Reverse Iterator type for Viewport instances stored by this class.
 
typedef std::list< Viewport * > ViewportContainer
 Basic container type for Viewport storage by this class.
 
typedef ViewportContainer::iterator ViewportIterator
 Iterator type for Viewport instances stored by this class.
 
enum  WindowFlags {
  WF_Fullscreen = 1, WF_Hidden = 2, WF_VsyncEnabled = 4, WF_FSAA_2 = 8,
  WF_FSAA_4 = 16, WF_FSAA_8 = 32, WF_FSAA_16 = 64, WF_Resizeable = 128,
  WF_Maximized = 256, WF_Borderless = 512
}
 A listing of potential options for configuring a game window during construction. More...
 

Public Member Functions

 GameWindow (const String &WindowCaption, const Whole Width, const Whole Height, const Whole Flags)
 Class constructor. More...
 
 GameWindow (const XML::Node &XMLNode)
 XML constructor. More...
 
 ~GameWindow ()
 Class destructor.
 
Ogre::RenderWindow * _GetOgreWindowPointer ()
 This will get a pointer to the Ogre RenderWindow. More...
 
SDL_Window * _GetSDLWindowPointer ()
 This will get a pointer to the SDL Window. More...
 
ViewportIterator BeginViewport ()
 Gets an iterator to the first viewport in this window.
 
ConstViewportIterator BeginViewport () const
 Gets a const iterator to the first viewport in this window.
 
Boole BorderIsResizeable () const
 Gets whether or not this window has a resizeable border. More...
 
ViewportCreateViewport (CameraProxy *ViewportCamera, const Integer ZOrder)
 Creates an additional Viewport within a created render window. More...
 
void DestroyAllViewports ()
 Destroys every viewport within this window.
 
void DestroyViewport (Viewport *ToBeDestroyed)
 Destroys a viewport within this window. More...
 
void EnableVsync (Boole Enable)
 Enables (or disables) vsync on this window. More...
 
ViewportIterator EndViewport ()
 Gets an iterator to one passed the last viewport in this window.
 
ConstViewportIterator EndViewport () const
 Gets a const iterator to one passed the last viewport in this window.
 
Whole GetActualFSAALevel () const
 Gets the actual Anti-Aliasing level currently being used by this game window. More...
 
Real GetAverageFPS () const
 Gets the Average FPS. More...
 
Real GetBestFPS () const
 Gets the Best FPS. More...
 
Real GetBestFrameTime () const
 Gets the shortest amount of time it's taken to render a frame. More...
 
Whole GetFSAALevel () const
 Gets the last set Anti-Aliasing level on this Window. More...
 
Boole GetFullscreen () const
 Gets the Fullscreen Setting. More...
 
Whole GetHeight () const
 Gets the height of the game window. More...
 
Real GetLastFPS () const
 Gets the FPS based on the last frame rendered. More...
 
Whole GetNumViewports () const
 Gets the number of viewports within this window. More...
 
const ResolutionGetResolution () const
 Gets the width and height of the game window. More...
 
const WindowSettingsGetSettings ()
 Gets the current window settings. More...
 
ViewportGetViewport (const Whole Index) const
 Gets a viewport by index. More...
 
ViewportGetViewportByZOrder (const Integer ZOrder) const
 Gets a viewport by ZOrder. More...
 
Whole GetWidth () const
 Gets the Width of the game window. More...
 
const StringGetWindowCaption () const
 Gets the the text in the titlebar. More...
 
Real GetWorstFPS () const
 Gets the Worst FPS. More...
 
Real GetWorstFrameTime () const
 Gets the longest amount of time it's taken to render a frame. More...
 
Boole IsBorderless () const
 Gets whether this window is borderless. More...
 
Boole IsHidden () const
 Gets whether this window is hidden. More...
 
void ProtoDeSerialize (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite this object with it. More...
 
void ProtoDeSerializeProperties (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite the properties of this object with it. More...
 
void ProtoDeSerializeViewports (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite the viewports of this object with it. More...
 
void ProtoSerialize (XML::Node &ParentNode) const
 Convert this class to an XML::Node ready for serialization. More...
 
void ProtoSerializeProperties (XML::Node &SelfRoot) const
 Convert the properties of this class to an XML::Node ready for serialization. More...
 
void ProtoSerializeViewports (XML::Node &SelfRoot) const
 Convert the viewports of this class to an XML::Node ready for serialization. More...
 
ReverseViewportIterator ReverseBeginViewport ()
 Gets an iterator to the last viewport in this window.
 
ConstReverseViewportIterator ReverseBeginViewport () const
 Gets a const iterator to the last viewport in this window.
 
ReverseViewportIterator ReverseEndViewport ()
 Gets an iterator to one before the first viewport in this window.
 
ConstReverseViewportIterator ReverseEndViewport () const
 Gets a const iterator to one before the first viewport in this window.
 
void SetFSAALevel (const Whole FSAA)
 Sets the level of Full Scale Anti-Aliasing to be used when rendering to this window. More...
 
void SetFullscreen (const Boole Fullscreen)
 Set the Fullscreen Setting. More...
 
void SetHeight (const Whole &Height)
 Sets the height of the game window. More...
 
void SetHidden (Boole Hidden)
 Hides (shows) the window. More...
 
void SetRenderOptions (const WindowSettings &NewSettings)
 Changes the X Resolution, Y Resolution, and fullscreen at the same time. More...
 
void SetResolution (const Resolution &WinRes)
 Sets the width and height of the game window. More...
 
void SetResolution (const Whole &Width, const Whole &Height)
 Sets the width and height of the game window. More...
 
void SetWidth (const Whole &Width)
 Sets the width of the game window. More...
 
Boole VsyncEnabled () const
 Gets whether or not vsync is currently enabled on this window. More...
 

Static Public Member Functions

static String GetSerializableName ()
 Get the name of the the XML tag the Renderable class will leave behind as its instances are serialized. More...
 

Protected Member Functions

void AddViewport (Viewport *NewVP)
 Inserts a Viewport into this window based on it's ZOrder. More...
 
void CreateGameWindow (const String &WindowCaption, const Whole Width, const Whole Height, const Whole Flags)
 Convenience method for constructing a window. More...
 
void UpdateViewportsAndCameras ()
 Updates all the viewports of this window and the cameras attached to them after a change in window geometry. More...
 

Protected Attributes

Whole CreationFlags
 A bit field containing all the flags used in the construction of this GameWindow. More...
 
GraphicsManagerManager
 A pointer to the manager that created this window. More...
 
Ogre::RenderWindow * OgreWindow
 A pointer to the internal window used for rendering. More...
 
Whole RequestedFSAA
 The last set FSAA level for this gamewindow (used for serialization). More...
 
SDL_Window * SDLWindow
 A pointer to the internal window used for collecting input. More...
 
WindowSettings Settings
 A struct storing all the window dimensions and update settings. More...
 
ViewportContainer Viewports
 A container storing all the viewports belonging to this window. More...
 

Detailed Description

This class is for creating and managing game windows.

Definition at line 63 of file gamewindow.h.

Member Enumeration Documentation

A listing of potential options for configuring a game window during construction.

Enumerator
WF_Fullscreen 

This enables fullscreen on the window.

WF_Hidden 

This hides the window so that it isn't visible.

WF_VsyncEnabled 

This enables vsync for the window.

WF_FSAA_2 

Enables Fullscreen Anti-Aliasing level 2 for the window.

WF_FSAA_4 

Enables Fullscreen Anti-Aliasing level 4 for the window.

WF_FSAA_8 

Enables Fullscreen Anti-Aliasing level 8 for the window.

WF_FSAA_16 

Enables Fullscreen Anti-Aliasing level 16 for the window.

WF_Resizeable 

Creates a window with resizable borders, otherwise it is fixed size.

WF_Maximized 

Maximizes the window immediately after construction.

WF_Borderless 

Removes all window decorations from the window(titlebar, borders, etc.).

Definition at line 78 of file gamewindow.h.

Constructor & Destructor Documentation

Mezzanine::Graphics::GameWindow::GameWindow ( const String WindowCaption,
const Whole  Width,
const Whole  Height,
const Whole  Flags 
)

Class constructor.

Parameters
WindowCaptionThe caption to be set in the window titlebar.
WidthThe desired width in pixels.
HeightThe desired height in pixels.
FlagsAdditional misc parameters, see WindowFlags enum for more info.

Definition at line 75 of file gamewindow.cpp.

Mezzanine::Graphics::GameWindow::GameWindow ( const XML::Node XMLNode)

XML constructor.

Parameters
XMLNodeThe node of the xml document to construct from.

Definition at line 82 of file gamewindow.cpp.

Member Function Documentation

Ogre::RenderWindow * Mezzanine::Graphics::GameWindow::_GetOgreWindowPointer ( )

This will get a pointer to the Ogre RenderWindow.

Returns
Returns a pointer to the Ogre RenderWindow class in use.

Definition at line 580 of file gamewindow.cpp.

SDL_Window * Mezzanine::Graphics::GameWindow::_GetSDLWindowPointer ( )

This will get a pointer to the SDL Window.

Returns
Returns a pointer to the SDL Window class in use.

Definition at line 583 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::AddViewport ( Viewport NewVP)
protected

Inserts a Viewport into this window based on it's ZOrder.

Parameters
NewVPA pointer to the Viewport being added to this window.

Definition at line 176 of file gamewindow.cpp.

Boole Mezzanine::Graphics::GameWindow::BorderIsResizeable ( ) const

Gets whether or not this window has a resizeable border.

Returns
Returns true if this window has a border when not fullscreen and it can be resized, false otherwise.

Definition at line 403 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::CreateGameWindow ( const String WindowCaption,
const Whole  Width,
const Whole  Height,
const Whole  Flags 
)
protected

Convenience method for constructing a window.

Parameters
WindowCaptionThe caption to be set in the window titlebar.
WidthThe desired width in pixels.
HeightThe desired height in pixels.
FlagsAdditional misc parameters, see WindowFlags enum for more info.

Definition at line 105 of file gamewindow.cpp.

Viewport * Mezzanine::Graphics::GameWindow::CreateViewport ( CameraProxy ViewportCamera,
const Integer  ZOrder 
)

Creates an additional Viewport within a created render window.

Parameters
VeiwportCameraThe camera that is to be attached to this Viewport.
ZOrderThe render order of this viewport relative to other viewports in this window.
Returns
Returns a pointer to the created Viewport.

Definition at line 201 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::DestroyViewport ( Viewport ToBeDestroyed)

Destroys a viewport within this window.

Parameters
ToBeDestroyedThe viewport that will be destroyed.

Definition at line 234 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::EnableVsync ( Boole  Enable)

Enables (or disables) vsync on this window.

Parameters
EnableWhether or not to enable vsync.

Definition at line 391 of file gamewindow.cpp.

Whole Mezzanine::Graphics::GameWindow::GetActualFSAALevel ( ) const

Gets the actual Anti-Aliasing level currently being used by this game window.

Returns
Returns the FSAA level currently being used to render this window, or 0 if FSAA is disabled.

Definition at line 388 of file gamewindow.cpp.

Real Mezzanine::Graphics::GameWindow::GetAverageFPS ( ) const

Gets the Average FPS.

Returns
Returns a Real representing the average framerate.

Definition at line 415 of file gamewindow.cpp.

Real Mezzanine::Graphics::GameWindow::GetBestFPS ( ) const

Gets the Best FPS.

Returns
Returns a Real representing the best framerate.

Definition at line 418 of file gamewindow.cpp.

Real Mezzanine::Graphics::GameWindow::GetBestFrameTime ( ) const

Gets the shortest amount of time it's taken to render a frame.

Returns
Returns a Real representing the best time for rendering a frame.

Definition at line 424 of file gamewindow.cpp.

Whole Mezzanine::Graphics::GameWindow::GetFSAALevel ( ) const

Gets the last set Anti-Aliasing level on this Window.

Note
This may or may not be the same as the current FSAA level setting.
Returns
Returns a Whole indicating which level of AA is set on this window.

Definition at line 385 of file gamewindow.cpp.

Boole Mezzanine::Graphics::GameWindow::GetFullscreen ( ) const

Gets the Fullscreen Setting.

Returns
This returns a Boole, true if fullscreen is set, false otherwise

Definition at line 360 of file gamewindow.cpp.

Whole Mezzanine::Graphics::GameWindow::GetHeight ( ) const

Gets the height of the game window.

Returns
Returns a Whole containing the size of the game window on the Y axis.

Definition at line 291 of file gamewindow.cpp.

Real Mezzanine::Graphics::GameWindow::GetLastFPS ( ) const

Gets the FPS based on the last frame rendered.

This essentially determines how many frames could be rendered if all frames within a second rendered at the same speed.

Returns
Returns a Real representing the framerate.

Definition at line 412 of file gamewindow.cpp.

Whole Mezzanine::Graphics::GameWindow::GetNumViewports ( ) const

Gets the number of viewports within this window.

Returns
Returns a Whole representing the number of viewports within this window.

Definition at line 229 of file gamewindow.cpp.

const Resolution & Mezzanine::Graphics::GameWindow::GetResolution ( ) const

Gets the width and height of the game window.

Returns
Returns a const Resolution reference containing the pixel size of the window on the X and Y axes.

Definition at line 322 of file gamewindow.cpp.

String Mezzanine::Graphics::GameWindow::GetSerializableName ( )
static

Get the name of the the XML tag the Renderable class will leave behind as its instances are serialized.

Returns
A string containing the name of this class.

Definition at line 574 of file gamewindow.cpp.

const WindowSettings & Mezzanine::Graphics::GameWindow::GetSettings ( )

Gets the current window settings.

Returns
Returns a WindowSettings struct with the current window settings.

Definition at line 371 of file gamewindow.cpp.

Viewport * Mezzanine::Graphics::GameWindow::GetViewport ( const Whole  Index) const

Gets a viewport by index.

Parameters
IndexThe index of the Viewport to retrieve.
Returns
Returns a pointer to the viewport requested.

Definition at line 208 of file gamewindow.cpp.

Viewport * Mezzanine::Graphics::GameWindow::GetViewportByZOrder ( const Integer  ZOrder) const

Gets a viewport by ZOrder.

Parameters
ZOrderThe ZOrder of the Viewport to retrieve.
Returns
Returns a pointer at the specified ZOrder, or NULL if no Viewports use that ZOrder.

Definition at line 218 of file gamewindow.cpp.

Whole Mezzanine::Graphics::GameWindow::GetWidth ( ) const

Gets the Width of the game window.

Returns
Returns a Whole containing the size of the game window on the X axis.

Definition at line 285 of file gamewindow.cpp.

const String & Mezzanine::Graphics::GameWindow::GetWindowCaption ( ) const

Gets the the text in the titlebar.

Returns
Returns a const string ref of the text in the titlebar.

Definition at line 379 of file gamewindow.cpp.

Real Mezzanine::Graphics::GameWindow::GetWorstFPS ( ) const

Gets the Worst FPS.

Returns
Returns a Real representing the worst framerate.

Definition at line 421 of file gamewindow.cpp.

Real Mezzanine::Graphics::GameWindow::GetWorstFrameTime ( ) const

Gets the longest amount of time it's taken to render a frame.

Returns
Returns a Real representing the worst time for rendering a frame.

Definition at line 427 of file gamewindow.cpp.

Boole Mezzanine::Graphics::GameWindow::IsBorderless ( ) const

Gets whether this window is borderless.

Returns
Returns true if this window has no border, false otherwise.

Definition at line 406 of file gamewindow.cpp.

Boole Mezzanine::Graphics::GameWindow::IsHidden ( ) const

Gets whether this window is hidden.

Returns
Returns true if this window is being hidden, false otherwise.

Definition at line 400 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::ProtoDeSerialize ( const XML::Node SelfRoot)

Take the data stored in an XML Node and overwrite this object with it.

Parameters
SelfRootAn XML::Node containing the data to populate this class with.

Definition at line 477 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::ProtoDeSerializeProperties ( const XML::Node SelfRoot)

Take the data stored in an XML Node and overwrite the properties of this object with it.

Parameters
SelfRootAn XML::Node containing the data to populate this class with.

Definition at line 483 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::ProtoDeSerializeViewports ( const XML::Node SelfRoot)

Take the data stored in an XML Node and overwrite the viewports of this object with it.

Parameters
SelfRootAn XML::Node containing the data to populate this class with.

Definition at line 554 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::ProtoSerialize ( XML::Node ParentNode) const

Convert this class to an XML::Node ready for serialization.

Parameters
ParentNodeThe point in the XML hierarchy that all this GameWindow should be appended to.

Definition at line 433 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::ProtoSerializeProperties ( XML::Node SelfRoot) const

Convert the properties of this class to an XML::Node ready for serialization.

Parameters
SelfRootThe root node containing all the serialized data for this instance.
Todo:
Currently the maximized setting does nothing in the gamewindow. If it gets implemented, so does this.

Definition at line 441 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::ProtoSerializeViewports ( XML::Node SelfRoot) const

Convert the viewports of this class to an XML::Node ready for serialization.

Parameters
SelfRootThe root node containing all the serialized data for this instance.

Definition at line 464 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::SetFSAALevel ( const Whole  FSAA)

Sets the level of Full Scale Anti-Aliasing to be used when rendering to this window.

Note
Generally when this gets set it will not be applied. Anti-Aliasing is a construction time property of a window. However this will be saved when the game window and it's settings are serialized, which will be used when it is reloaded.
Parameters
FSAAThe Anti-Aliasing level to be used, generally one of these values: 0, 2, 4, 8, or 16.

Definition at line 382 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::SetFullscreen ( const Boole  Fullscreen)

Set the Fullscreen Setting.

Parameters
FullscreenThis accepts a Boole. True for fullscreen, false for windowed.

Definition at line 327 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::SetHeight ( const Whole Height)

Sets the height of the game window.

Parameters
HeightThe pixel size of the game window on the Y axis.

Definition at line 288 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::SetHidden ( Boole  Hidden)

Hides (shows) the window.

Parameters
HiddenWhether or not to hide the window.

Definition at line 397 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::SetRenderOptions ( const WindowSettings NewSettings)

Changes the X Resolution, Y Resolution, and fullscreen at the same time.

Parameters
NewSettingsA WindowSettings struct containing all of the window settings to be applied.

Definition at line 365 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::SetResolution ( const Resolution WinRes)

Sets the width and height of the game window.

Parameters
WinResA Resolution containing the width and height to be applied.

Definition at line 294 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::SetResolution ( const Whole Width,
const Whole Height 
)

Sets the width and height of the game window.

Parameters
WidthThe pixel size of the game window on the X axis.
HeightThe pixel size of the game window on the Y axis.

Definition at line 297 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::SetWidth ( const Whole Width)

Sets the width of the game window.

Parameters
WidthThe pixel size of the game window on the X axis.

Definition at line 282 of file gamewindow.cpp.

void Mezzanine::Graphics::GameWindow::UpdateViewportsAndCameras ( )
protected

Updates all the viewports of this window and the cameras attached to them after a change in window geometry.

Definition at line 188 of file gamewindow.cpp.

Boole Mezzanine::Graphics::GameWindow::VsyncEnabled ( ) const

Gets whether or not vsync is currently enabled on this window.

Returns
Returns true if vsync is currently enabled, false otherwise.

Definition at line 394 of file gamewindow.cpp.

Member Data Documentation

Whole Mezzanine::Graphics::GameWindow::CreationFlags
protected

A bit field containing all the flags used in the construction of this GameWindow.

Definition at line 112 of file gamewindow.h.

GraphicsManager* Mezzanine::Graphics::GameWindow::Manager
protected

A pointer to the manager that created this window.

Definition at line 100 of file gamewindow.h.

Ogre::RenderWindow* Mezzanine::Graphics::GameWindow::OgreWindow
protected

A pointer to the internal window used for rendering.

Definition at line 103 of file gamewindow.h.

Whole Mezzanine::Graphics::GameWindow::RequestedFSAA
protected

The last set FSAA level for this gamewindow (used for serialization).

Definition at line 109 of file gamewindow.h.

SDL_Window* Mezzanine::Graphics::GameWindow::SDLWindow
protected

A pointer to the internal window used for collecting input.

Definition at line 106 of file gamewindow.h.

WindowSettings Mezzanine::Graphics::GameWindow::Settings
protected

A struct storing all the window dimensions and update settings.

Definition at line 94 of file gamewindow.h.

ViewportContainer Mezzanine::Graphics::GameWindow::Viewports
protected

A container storing all the viewports belonging to this window.

Definition at line 97 of file gamewindow.h.


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