#include <gfx.h>
Collaboration diagram for GFX:

Public Member Functions | |
| GFX () | |
| ~GFX () | |
| void | init () |
| initialize SDL_VIDEO, OpenGL, fps counter and create window | |
| void | clean () |
| code at GFX shutdown | |
| SDL_Surface * | getScreen () |
| void | set3DOpenGL () |
| Switch OpenGL rendering to 3D mode. Is used when rendering game world. | |
| void | set2DOpenGL () |
| Switch OpenGL rendering to 2D mode. It is usefull for menu and ingame GUI. | |
| int | getWidth () |
| Get width of screen or -1 if unknown. | |
| int | getHeight () |
| Get height of screen or -1 if unknown. | |
| bool | checkExtension (const char *extensionName) |
| Checks for OpenGL extension given by extensionName. | |
| void | swap_buffers (void) |
| swaps OpenGL buffers. | |
| int | getFps (void) |
| actual fps ratio | |
| void | resetFps (void) |
| resets the fps counter | |
Private Member Functions | |
| void | initOpenGL () |
| OpenGL initialization code. | |
| void | prefetchOpenGLExtensions (void) |
| Gets extension names. | |
| void | loadVideoSettings (void) |
| Loads settings from settings-file (or uses default values if not found). | |
Private Attributes | |
| SDL_Surface * | mScreen |
| bool | mGLMode3D |
| VideoSettings | mVS |
| current video settings | |
| THashedStrings | mOpenGLExtensions |
| list of OpenGL extensions | |
| Fps | fps |
| frames-per-second counter | |
Classes | |
| struct | VideoSettings |
Definition at line 17 of file gfx.h.
|
|
|
|
|
|
|
|
Checks for OpenGL extension given by extensionName.
Definition at line 214 of file gfx.cpp. References mOpenGLExtensions. Referenced by TextureManager::TextureManager(). |
|
|
code at GFX shutdown Releases textures from TextureManager. If there still exist referenced textures, those becomes zombie.
Definition at line 118 of file gfx.cpp. References Singleton< T >::getPtr(), and TIN. Referenced by ApplicationClient::clean(). Here is the call graph for this function: ![]() |
|
|
actual fps ratio
Definition at line 87 of file gfx.h. References fps, and Fps::get(). Here is the call graph for this function: ![]() |
|
|
Get height of screen or -1 if unknown.
Definition at line 207 of file gfx.cpp. References GFX::VideoSettings::height, and mVS. Referenced by GameClient::getCamera(), and TerrainGeoMipMap::TerrainBlock::getViewHRes(). |
|
|
Definition at line 148 of file gfx.cpp. References mScreen. |
|
|
Get width of screen or -1 if unknown.
Definition at line 200 of file gfx.cpp. References mVS, and GFX::VideoSettings::width. Referenced by Console::addConsoleMessage(), and GameClient::getCamera(). |
|
|
initialize SDL_VIDEO, OpenGL, fps counter and create window
Definition at line 53 of file gfx.cpp. References GFX::VideoSettings::attrs, GFX::VideoSettings::bpp, GFX::VideoSettings::height, initOpenGL(), loadVideoSettings(), LOGE, LOGI, mGLMode3D, mScreen, mVS, resetFps(), GFX::VideoSettings::SDL_flags, set3DOpenGL(), TIN, and GFX::VideoSettings::width. Referenced by ApplicationClient::init(). Here is the call graph for this function: ![]() |
|
|
OpenGL initialization code.
Definition at line 126 of file gfx.cpp. References GFX::VideoSettings::height, mVS, prefetchOpenGLExtensions(), TIN, and GFX::VideoSettings::width. Referenced by init(). Here is the call graph for this function: ![]() |
|
|
Loads settings from settings-file (or uses default values if not found).
Definition at line 27 of file gfx.cpp. References GFX::VideoSettings::bpp, g_settings, Settings::getInt(), Settings::getString(), GFX::VideoSettings::height, Settings::isTrue(), mVS, GFX::VideoSettings::SDL_flags, TIN, and GFX::VideoSettings::width. Referenced by init(). Here is the call graph for this function: ![]() |
|
|
Gets extension names.
Definition at line 96 of file gfx.cpp. References LOGI, mOpenGLExtensions, and TIN. Referenced by initOpenGL(). |
|
|
resets the fps counter
Definition at line 229 of file gfx.cpp. References fps, TimeManager::getTicks(), and Fps::init(). Referenced by TaskRender::init(), and init(). Here is the call graph for this function: ![]() |
|
|
Switch OpenGL rendering to 2D mode. It is usefull for menu and ingame GUI.
Definition at line 177 of file gfx.cpp. References GFX::VideoSettings::height, mGLMode3D, mVS, TIN, and GFX::VideoSettings::width. Referenced by Messages::render(), Console::render(), and Layer::setView(). |
|
|
Switch OpenGL rendering to 3D mode. Is used when rendering game world.
Definition at line 154 of file gfx.cpp. References GFX::VideoSettings::height, mGLMode3D, mVS, TIN, and GFX::VideoSettings::width. Referenced by init(), and TaskRender::updateBegin(). |
|
|
swaps OpenGL buffers. This should be called after rendering, when we want to switch front and back buffers. You would preffer calling GFX::swap_buffers rather than SDL_GL_SwapBuffers and vice versa, because this counts frames and updates fps counter. Fps counter could be updated somewhere else, but this is sufficient. Definition at line 220 of file gfx.cpp. References fps, TimeManager::getTicks(), Fps::onFrameRendered(), and Fps::update(). Referenced by TaskRender::updateEnd(). Here is the call graph for this function: ![]() |
|
|
frames-per-second counter
Definition at line 139 of file gfx.h. Referenced by getFps(), resetFps(), and swap_buffers(). |
|
|
Determines in what state the OpenGL is. 2D or 3D. It is used in set2DOpenGL() and set3DOpenGL() to not waist OpenGL commands. Definition at line 120 of file gfx.h. Referenced by init(), set2DOpenGL(), and set3DOpenGL(). |
|
|
list of OpenGL extensions
Definition at line 138 of file gfx.h. Referenced by checkExtension(), and prefetchOpenGLExtensions(). |
|
|
Definition at line 113 of file gfx.h. Referenced by getScreen(), and init(). |
|
|
current video settings
Definition at line 137 of file gfx.h. Referenced by getHeight(), getWidth(), init(), initOpenGL(), loadVideoSettings(), set2DOpenGL(), and set3DOpenGL(). |
1.4.5