xoreos
0.0.5
|
The graphics manager. More...
#include <windowman.h>
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< DisplayMode > | getDisplayModes () |
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 () |
The graphics manager.
Definition at line 39 of file windowman.h.
|
private |
Enumerator | |
---|---|
kCursorStateStay | |
kCursorStateSwitchOn | |
kCursorStateSwitchOff |
Definition at line 102 of file windowman.h.
Enumerator | |
---|---|
kOpenGL21 | |
kOpenGL21Core | |
kOpenGL32Compat |
Definition at line 41 of file windowman.h.
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.
Graphics::WindowManager::~WindowManager | ( | ) |
Definition at line 64 of file windowman.cpp.
void Graphics::WindowManager::beginScene | ( | ) |
Definition at line 369 of file windowman.cpp.
References handleCursorSwitch().
void Graphics::WindowManager::deinit | ( | ) |
Deinitialize the window manager.
Definition at line 85 of file windowman.cpp.
|
private |
Definition at line 292 of file windowman.cpp.
References _glContext, and _window.
Referenced by initRender().
void Graphics::WindowManager::endScene | ( | ) |
Definition at line 374 of file windowman.cpp.
References _window.
std::vector< DisplayMode > Graphics::WindowManager::getDisplayModes | ( | ) |
Get all possible display modes.
Definition at line 230 of file windowman.cpp.
float Graphics::WindowManager::getGamma | ( | ) | const |
int Graphics::WindowManager::getMaxFSAA | ( | ) | const |
Return the max supported FSAA level.
Definition at line 265 of file windowman.cpp.
References _fsaaMax.
int Graphics::WindowManager::getSystemHeight | ( | ) | const |
Return the system's screen height.
Definition at line 256 of file windowman.cpp.
References _window.
int Graphics::WindowManager::getSystemWidth | ( | ) | const |
int Graphics::WindowManager::getWindowHeight | ( | ) | const |
Return the current window height.
Definition at line 189 of file windowman.cpp.
References _height.
Referenced by initWindow().
int Graphics::WindowManager::getWindowWidth | ( | ) | const |
Return the current window width.
Definition at line 185 of file windowman.cpp.
References _width.
Referenced by initWindow().
|
private |
Definition at line 378 of file windowman.cpp.
References _cursorMutex, _cursorState, kCursorStateStay, kCursorStateSwitchOff, and kCursorStateSwitchOn.
Referenced by beginScene().
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().
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().
|
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().
bool Graphics::WindowManager::isFullScreen | ( | ) | const |
Are we currently in full screen mode?
Definition at line 142 of file windowman.cpp.
References _fullScreen.
|
private |
Definition at line 301 of file windowman.cpp.
References _fsaaMax, and status().
Referenced by init().
void Graphics::WindowManager::setCursorPosition | ( | int | x, |
int | y | ||
) |
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().
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().
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.
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().
void Graphics::WindowManager::showCursor | ( | bool | show | ) |
Show/Hide the cursor.
Definition at line 396 of file windowman.cpp.
References _cursorMutex, _cursorState, kCursorStateSwitchOff, and kCursorStateSwitchOn.
void Graphics::WindowManager::toggleFullScreen | ( | ) |
Toggle between full screen and windowed mode.
Definition at line 181 of file windowman.cpp.
References _fullScreen, and setFullScreen().
void Graphics::WindowManager::toggleMouseGrab | ( | ) |
|
private |
Definition at line 269 of file windowman.cpp.
References _fullScreen, and _window.
Referenced by initRender().
|
private |
A mutex locked for the cursor.
Definition at line 122 of file windowman.h.
Referenced by handleCursorSwitch(), and showCursor().
|
private |
What to do with the cursor.
Definition at line 123 of file windowman.h.
Referenced by handleCursorSwitch(), showCursor(), and WindowManager().
|
private |
Max supported FSAA level.
Definition at line 110 of file windowman.h.
Referenced by getMaxFSAA(), probeFSAA(), and WindowManager().
|
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().
|
private |
The current gamma correction value.
Definition at line 115 of file windowman.h.
Referenced by getGamma(), init(), initWindow(), setGamma(), and WindowManager().
|
private |
Definition at line 120 of file windowman.h.
Referenced by deinitWindow(), initRender(), and WindowManager().
|
private |
The game's window height.
Definition at line 113 of file windowman.h.
Referenced by getWindowHeight(), init(), setFullScreen(), setWindowSize(), and WindowManager().
|
private |
The game's window width.
Definition at line 112 of file windowman.h.
Referenced by getWindowWidth(), init(), setFullScreen(), setWindowSize(), and WindowManager().
|
private |
The OpenGL hardware surface.
Definition at line 119 of file windowman.h.
Referenced by deinitWindow(), endScene(), getSystemHeight(), getSystemWidth(), initRender(), initWindow(), setCursorPosition(), setFullScreen(), setGamma(), setWindowSize(), setWindowTitle(), toggleMouseGrab(), windowFlags(), and WindowManager().
|
private |
The current window title.
Definition at line 117 of file windowman.h.
Referenced by initWindow(), setWindowTitle(), and WindowManager().