MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | 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 ()
 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.
 
Boolean 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 DestroyViewport (Viewport *ToBeDestroyed)
 Destroys a viewport within this window. More...
 
void EnableVsync (bool 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.
 
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 current level of Anti-Aliasing enabled on this Window. More...
 
bool GetFullscreen () const
 Gets the Fullscreen Setting. 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...
 
Whole GetRenderHeight () const
 Gets the Height of the Rendering Area. More...
 
Whole GetRenderWidth () const
 Gets the Width of the Rendering Area. 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...
 
const StringGetWindowCaption ()
 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...
 
Boolean IsBorderless () const
 Gets whether this window is borderless. More...
 
Boolean IsHidden () const
 Gets whether this window is hidden. 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 SetFullscreen (const bool Fullscreen)
 Set the Fullscreen Setting. More...
 
void SetHidden (bool Hidden)
 Hides (shows) the window. More...
 
void SetRenderHeight (const Whole &Height)
 Sets the Height. More...
 
void SetRenderOptions (const WindowSettings &NewSettings)
 Changes the X Resolution, Y Resolution, and fullscreen at the same time. More...
 
void SetRenderResolution (const Whole &Width, const Whole &Height)
 Changes the X and Y Resolution at the same time. More...
 
void SetRenderWidth (const Whole &Width)
 Sets the Width. More...
 
Boolean VsyncEnabled () const
 Gets whether or not vsync is currently enabled on this window. More...
 

Protected Member Functions

void CreateGameWindow (const String &WindowCaption, const Whole Width, const Whole Height, const Whole Flags)
 Convenience method for constructing a window. More...
 
int IsLargerThenDesktop (const Whole Width, const Whole Height)
 Checks to see if a resolution is larger than the currently set desktop resolution. 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...
 
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 62 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 72 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 434 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 437 of file gamewindow.cpp.

Boolean 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 404 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 92 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 188 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 230 of file gamewindow.cpp.

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

Enables (or disables) vsync on this window.

Parameters
EnableWhether or not to enable vsync.

Definition at line 392 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 416 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 419 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 425 of file gamewindow.cpp.

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

Gets the current level of Anti-Aliasing enabled on this Window.

Returns
Returns a Whole indicating which level of AA is enabled on this window, or 0 if AA is disabled.

Definition at line 389 of file gamewindow.cpp.

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

Gets the Fullscreen Setting.

Gets the Fullscreen Setting

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

Definition at line 367 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 413 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 225 of file gamewindow.cpp.

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

Gets the Height of the Rendering Area.

Gets the Height of the Rendering Area

Returns
This returns the Height of the Rendering Area

Definition at line 290 of file gamewindow.cpp.

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

Gets the Width of the Rendering Area.

Gets the Width of the Rendering Area

Returns
This returns the Width of the Rendering Area

Definition at line 277 of file gamewindow.cpp.

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

Gets the current window settings.

Parameters
Returnsa WindowSettings struct with the current window settings.

Definition at line 378 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 204 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 214 of file gamewindow.cpp.

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

Gets the the text in the titlebar.

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

Definition at line 386 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 422 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 428 of file gamewindow.cpp.

Boolean 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 407 of file gamewindow.cpp.

Boolean 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 401 of file gamewindow.cpp.

int Mezzanine::Graphics::GameWindow::IsLargerThenDesktop ( const Whole  Width,
const Whole  Height 
)
protected

Checks to see if a resolution is larger than the currently set desktop resolution.

Remarks
This method is used for a check that is only really needed on Windows XP. When a resolution is selected that is larger than the desktop resolution then the app hardlocks somewhere inside of SDL.
Parameters
WidthThe number of horizontal pixels to check against the desktop.
HeightThe number of vertical pixels to check against the desktop.
Returns
Returns "1" if the resolution provided is larger, "-1" if the resolution is smaller, and "0" if the resolution is the same.

Definition at line 173 of file gamewindow.cpp.

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

Set the Fullscreen Setting.

Set the Fullscreen Setting

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

Definition at line 333 of file gamewindow.cpp.

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

Hides (shows) the window.

Parameters
HiddenWhether or not to hide the window.

Definition at line 398 of file gamewindow.cpp.

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

Sets the Height.

Set the Render Height inside the window in windowed mode, set the resolution of the screen in fullscreen

Parameters
HeightThis accepts a Whole.

Definition at line 282 of file gamewindow.cpp.

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

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

This should be useful in situations where it is not possible to update all of the options separately.

Definition at line 372 of file gamewindow.cpp.

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

Changes the X and Y Resolution at the same time.

This should be useful in situations where it is not possible to update the width and height separately.

Parameters
WidthThe new desired Width for the rendering area as a whole number
HeightThe new desired Width for the rendering area as a whole number

Definition at line 295 of file gamewindow.cpp.

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

Sets the Width.

Set the Render Width inside the window in windowed mode, set the resolution of the screen in fullscreen

Parameters
WidthThis accepts a Whole.

Definition at line 269 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 163 of file gamewindow.cpp.

Boolean 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 395 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 109 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.

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: