xoreos  0.0.5
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Graphics::WindowManager Class Reference

The graphics manager. More...

#include <windowman.h>

Inheritance diagram for Graphics::WindowManager:
Inheritance graph
[legend]
Collaboration diagram for Graphics::WindowManager:
Collaboration graph
[legend]

Public Types

enum  RenderType { kOpenGL21 = 0, kOpenGL21Core, kOpenGL32Compat }
 

Public Member Functions

 WindowManager ()
 
 ~WindowManager ()
 
void init ()
 Initialize the window manager. More...
 
void deinit ()
 Deinitialize the window manager. More...
 
bool initRender (RenderType type, bool useDebug, int fsaa)
 Setup the Render Context on the window. More...
 
bool isFullScreen () const
 Are we currently in full screen mode? More...
 
void setFullScreen (bool fullScreen)
 Set full screen/windowed mode. More...
 
void toggleFullScreen ()
 Toggle between full screen and windowed mode. More...
 
int getWindowWidth () const
 Return the current window width. More...
 
int getWindowHeight () const
 Return the current window height. More...
 
void setWindowSize (int width, int height)
 Set the window size. More...
 
std::vector< DisplayModegetDisplayModes ()
 Get all possible display modes. More...
 
int getSystemWidth () const
 Return the system's screen width. More...
 
int getSystemHeight () const
 Return the system's screen height. More...
 
int getMaxFSAA () const
 Return the max supported FSAA level. More...
 
void toggleMouseGrab ()
 Toggle mouse grab. More...
 
void setWindowTitle (const Common::UString &title="")
 Set the window's title. More...
 
float getGamma () const
 Get the overall gamma correction. More...
 
void setGamma (float gamma)
 Set the overall gamma correction. More...
 
void showCursor (bool show)
 Show/Hide the cursor. More...
 
void setCursorPosition (int x, int y)
 Set position to the cursor. More...
 
void beginScene ()
 
void endScene ()
 

Private Types

enum  CursorState { kCursorStateStay, kCursorStateSwitchOn, kCursorStateSwitchOff }
 

Private Member Functions

uint32 windowFlags ()
 
void initWindow (uint32 flags)
 
void deinitWindow ()
 
void probeFSAA ()
 
void handleCursorSwitch ()
 

Private Attributes

bool _fullScreen
 Are we currently in fullscreen mode? More...
 
int _fsaaMax
 Max supported FSAA level. More...
 
int _width
 The game's window width. More...
 
int _height
 The game's window height. More...
 
float _gamma
 The current gamma correction value. More...
 
Common::UString _windowTitle
 The current window title. More...
 
SDL_Window * _window
 The OpenGL hardware surface. More...
 
SDL_GLContext _glContext
 
Common::Mutex _cursorMutex
 A mutex locked for the cursor. More...
 
CursorState _cursorState
 What to do with the cursor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Common::Singleton< WindowManager >
static WindowManager & instance ()
 
static void destroy ()
 
- Protected Types inherited from Common::Singleton< WindowManager >
typedef WindowManager SingletonBaseType
 
- Protected Member Functions inherited from Common::Singleton< WindowManager >
 Singleton ()
 
virtual ~Singleton ()
 

Detailed Description

The graphics manager.

Definition at line 39 of file windowman.h.

Member Enumeration Documentation

◆ CursorState

Enumerator
kCursorStateStay 
kCursorStateSwitchOn 
kCursorStateSwitchOff 

Definition at line 102 of file windowman.h.

◆ RenderType

Enumerator
kOpenGL21 
kOpenGL21Core 
kOpenGL32Compat 

Definition at line 41 of file windowman.h.

Constructor & Destructor Documentation

◆ WindowManager()

Graphics::WindowManager::WindowManager ( )

Definition at line 46 of file windowman.cpp.

References _cursorState, _fsaaMax, _fullScreen, _gamma, _glContext, _height, _width, _window, _windowTitle, Version::getProjectNameVersion(), and kCursorStateStay.

Here is the call graph for this function:

◆ ~WindowManager()

Graphics::WindowManager::~WindowManager ( )

Definition at line 64 of file windowman.cpp.

Member Function Documentation

◆ beginScene()

void Graphics::WindowManager::beginScene ( )

Definition at line 369 of file windowman.cpp.

References handleCursorSwitch().

Here is the call graph for this function:

◆ deinit()

void Graphics::WindowManager::deinit ( )

Deinitialize the window manager.

Definition at line 85 of file windowman.cpp.

◆ deinitWindow()

void Graphics::WindowManager::deinitWindow ( )
private

Definition at line 292 of file windowman.cpp.

References _glContext, and _window.

Referenced by initRender().

Here is the caller graph for this function:

◆ endScene()

void Graphics::WindowManager::endScene ( )

Definition at line 374 of file windowman.cpp.

References _window.

◆ getDisplayModes()

std::vector< DisplayMode > Graphics::WindowManager::getDisplayModes ( )

Get all possible display modes.

Definition at line 230 of file windowman.cpp.

◆ getGamma()

float Graphics::WindowManager::getGamma ( ) const

Get the overall gamma correction.

Definition at line 339 of file windowman.cpp.

References _gamma.

◆ getMaxFSAA()

int Graphics::WindowManager::getMaxFSAA ( ) const

Return the max supported FSAA level.

Definition at line 265 of file windowman.cpp.

References _fsaaMax.

◆ getSystemHeight()

int Graphics::WindowManager::getSystemHeight ( ) const

Return the system's screen height.

Definition at line 256 of file windowman.cpp.

References _window.

◆ getSystemWidth()

int Graphics::WindowManager::getSystemWidth ( ) const

Return the system's screen width.

Definition at line 247 of file windowman.cpp.

References _window.

◆ getWindowHeight()

int Graphics::WindowManager::getWindowHeight ( ) const

Return the current window height.

Definition at line 189 of file windowman.cpp.

References _height.

Referenced by initWindow().

Here is the caller graph for this function:

◆ getWindowWidth()

int Graphics::WindowManager::getWindowWidth ( ) const

Return the current window width.

Definition at line 185 of file windowman.cpp.

References _width.

Referenced by initWindow().

Here is the caller graph for this function:

◆ handleCursorSwitch()

void Graphics::WindowManager::handleCursorSwitch ( )
private

Definition at line 378 of file windowman.cpp.

References _cursorMutex, _cursorState, kCursorStateStay, kCursorStateSwitchOff, and kCursorStateSwitchOn.

Referenced by beginScene().

Here is the caller graph for this function:

◆ init()

void Graphics::WindowManager::init ( )

Initialize the window manager.

Definition at line 67 of file windowman.cpp.

References _fullScreen, _gamma, _height, _width, ConfigMan, Common::enforceMainThread(), and probeFSAA().

Here is the call graph for this function:

◆ initRender()

bool Graphics::WindowManager::initRender ( RenderType  type,
bool  useDebug,
int  fsaa 
)

Setup the Render Context on the window.

Definition at line 89 of file windowman.cpp.

References _glContext, _window, Common::UString::beginsWith(), deinitWindow(), initWindow(), kOpenGL21Core, kOpenGL32Compat, status(), warning(), and windowFlags().

Here is the call graph for this function:

◆ initWindow()

void Graphics::WindowManager::initWindow ( uint32  flags)
private

Definition at line 279 of file windowman.cpp.

References _gamma, _window, _windowTitle, Common::UString::c_str(), ConfigMan, getWindowHeight(), getWindowWidth(), setGamma(), and Graphics::setWindowIcon().

Referenced by initRender().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isFullScreen()

bool Graphics::WindowManager::isFullScreen ( ) const

Are we currently in full screen mode?

Definition at line 142 of file windowman.cpp.

References _fullScreen.

◆ probeFSAA()

void Graphics::WindowManager::probeFSAA ( )
private

Definition at line 301 of file windowman.cpp.

References _fsaaMax, and status().

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCursorPosition()

void Graphics::WindowManager::setCursorPosition ( int  x,
int  y 
)

Set position to the cursor.

Definition at line 365 of file windowman.cpp.

References _window.

◆ setFullScreen()

void Graphics::WindowManager::setFullScreen ( bool  fullScreen)

Set full screen/windowed mode.

Definition at line 146 of file windowman.cpp.

References _fullScreen, _height, _width, _window, Common::isMainThread(), NotificationMan, and RequestMan.

Referenced by toggleFullScreen().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGamma()

void Graphics::WindowManager::setGamma ( float  gamma)

Set the overall gamma correction.

Definition at line 343 of file windowman.cpp.

References _gamma, _window, error(), Common::isMainThread(), and RequestMan.

Referenced by initWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setWindowSize()

void Graphics::WindowManager::setWindowSize ( int  width,
int  height 
)

Set the window size.

Definition at line 193 of file windowman.cpp.

References _fullScreen, _height, _width, _window, Common::isMainThread(), NotificationMan, and RequestMan.

Here is the call graph for this function:

◆ setWindowTitle()

void Graphics::WindowManager::setWindowTitle ( const Common::UString title = "")

Set the window's title.

Definition at line 331 of file windowman.cpp.

References _window, _windowTitle, Common::UString::c_str(), Common::UString::empty(), and Version::getProjectNameVersion().

Here is the call graph for this function:

◆ showCursor()

void Graphics::WindowManager::showCursor ( bool  show)

Show/Hide the cursor.

Definition at line 396 of file windowman.cpp.

References _cursorMutex, _cursorState, kCursorStateSwitchOff, and kCursorStateSwitchOn.

◆ toggleFullScreen()

void Graphics::WindowManager::toggleFullScreen ( )

Toggle between full screen and windowed mode.

Definition at line 181 of file windowman.cpp.

References _fullScreen, and setFullScreen().

Here is the call graph for this function:

◆ toggleMouseGrab()

void Graphics::WindowManager::toggleMouseGrab ( )

Toggle mouse grab.

Definition at line 392 of file windowman.cpp.

References _window.

◆ windowFlags()

uint32 Graphics::WindowManager::windowFlags ( )
private

Definition at line 269 of file windowman.cpp.

References _fullScreen, and _window.

Referenced by initRender().

Here is the caller graph for this function:

Member Data Documentation

◆ _cursorMutex

Common::Mutex Graphics::WindowManager::_cursorMutex
private

A mutex locked for the cursor.

Definition at line 122 of file windowman.h.

Referenced by handleCursorSwitch(), and showCursor().

◆ _cursorState

CursorState Graphics::WindowManager::_cursorState
private

What to do with the cursor.

Definition at line 123 of file windowman.h.

Referenced by handleCursorSwitch(), showCursor(), and WindowManager().

◆ _fsaaMax

int Graphics::WindowManager::_fsaaMax
private

Max supported FSAA level.

Definition at line 110 of file windowman.h.

Referenced by getMaxFSAA(), probeFSAA(), and WindowManager().

◆ _fullScreen

bool Graphics::WindowManager::_fullScreen
private

Are we currently in fullscreen mode?

Definition at line 108 of file windowman.h.

Referenced by init(), isFullScreen(), setFullScreen(), setWindowSize(), toggleFullScreen(), windowFlags(), and WindowManager().

◆ _gamma

float Graphics::WindowManager::_gamma
private

The current gamma correction value.

Definition at line 115 of file windowman.h.

Referenced by getGamma(), init(), initWindow(), setGamma(), and WindowManager().

◆ _glContext

SDL_GLContext Graphics::WindowManager::_glContext
private

Definition at line 120 of file windowman.h.

Referenced by deinitWindow(), initRender(), and WindowManager().

◆ _height

int Graphics::WindowManager::_height
private

The game's window height.

Definition at line 113 of file windowman.h.

Referenced by getWindowHeight(), init(), setFullScreen(), setWindowSize(), and WindowManager().

◆ _width

int Graphics::WindowManager::_width
private

The game's window width.

Definition at line 112 of file windowman.h.

Referenced by getWindowWidth(), init(), setFullScreen(), setWindowSize(), and WindowManager().

◆ _window

SDL_Window* Graphics::WindowManager::_window
private

◆ _windowTitle

Common::UString Graphics::WindowManager::_windowTitle
private

The current window title.

Definition at line 117 of file windowman.h.

Referenced by initWindow(), setWindowTitle(), and WindowManager().


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