#include <CoreEngine.h>
Collaboration diagram for pge::CoreEngine:
Public Member Functions | |
virtual | ~CoreEngine (void) |
Destructor. | |
void | init (GLApplication *owner, int resX, int resY) |
bool | init (void) |
void | render (void) |
void | reshape (GLsizei width, GLsizei height) |
void | shutdown (void) |
void | mainLoop (void) |
void | action (InputSystem::InputAction type, int param0, int param1) |
int | getResolutionWidth (void) |
int | getResolutionHeight (void) |
int | getFPS (void) |
void | setCurrentWorld (World *world) |
World * | getCurrentWorld (void) |
bool | hasActiveWorld (void) |
Static Public Member Functions | |
CoreEngine * | getInstance (void) |
Private Member Functions | |
CoreEngine (void) | |
void | timer (unsigned int delay) |
Private Attributes | |
GLApplication * | m_owner |
The owning GL Application. | |
int | m_resX |
int | m_resY |
unsigned int | m_delay |
unsigned int | m_lastTime |
bool | m_engineRunning |
bool | m_initDone |
int | m_fps |
unsigned int | m_fpsLoop |
int | m_fpsResult |
World * | m_currentWorld |
|
Destructor.
Definition at line 46 of file CoreEngine.cpp. References m_currentWorld.
00046 { 00047 if(m_currentWorld != NULL) { 00048 delete m_currentWorld; 00049 m_currentWorld = NULL; 00050 } 00051 00052 TextureDatabase::getInstance()->destroy(); 00053 } |
|
Definition at line 20 of file CoreEngine.cpp. References pge::SDLApplication::getTicks(), m_currentWorld, m_delay, m_engineRunning, m_fps, m_fpsLoop, m_fpsResult, m_initDone, m_lastTime, m_owner, m_resX, and m_resY.
00020 { 00021 m_owner = NULL; 00022 m_resX = 0; 00023 m_resY = 0; 00024 00025 // Frames per second 00026 m_fps = 0; 00027 m_fpsLoop = 0; 00028 m_fpsResult = 0; 00029 00030 m_lastTime = m_owner->getTicks(); 00031 m_delay = 15; 00032 00033 m_engineRunning = false; 00034 00035 m_initDone = false; 00036 00037 m_currentWorld = NULL; 00038 } |
Here is the call graph for this function:
|
Definition at line 245 of file CoreEngine.cpp. References pge::World::action(), and m_currentWorld.
00245 { 00246 if(m_currentWorld != NULL) { 00247 m_currentWorld->action(type, param0, param1); 00248 } 00249 } |
Here is the call graph for this function:
|
Definition at line 297 of file CoreEngine.cpp. References m_currentWorld.
00297 { 00298 return m_currentWorld; 00299 } |
|
Definition at line 277 of file CoreEngine.cpp. References m_fpsResult.
00277 { 00278 return m_fpsResult; 00279 } |
|
Definition at line 61 of file CoreEngine.cpp.
00061 { 00062 static CoreEngine instance; 00063 return &instance; 00064 } |
|
Definition at line 267 of file CoreEngine.cpp. References m_resY.
00267 { 00268 return this->m_resY; 00269 } |
|
Definition at line 257 of file CoreEngine.cpp. References m_resX.
00257 { 00258 return this->m_resX; 00259 } |
|
Definition at line 307 of file CoreEngine.cpp. References m_currentWorld.
00307 { 00308 return (m_currentWorld != NULL); 00309 } |
|
Definition at line 116 of file CoreEngine.cpp. References pge::World::init(), m_currentWorld, and m_initDone.
00116 { 00117 if(!m_initDone) { 00118 if(m_currentWorld != NULL) { 00119 m_currentWorld->init(); 00120 } 00121 m_initDone = true; 00122 return true; 00123 } else { 00124 return false; 00125 } 00126 } |
Here is the call graph for this function:
|
Definition at line 72 of file CoreEngine.cpp. References m_owner, m_resX, m_resY, and reshape().
00072 { 00073 // Set owner 00074 m_owner = owner; 00075 00076 // Apply resolution 00077 m_resX = resX; 00078 m_resY = resY; 00079 00080 00081 // TODO: reshape has to be called here at startup since it seems that SDL 00082 // does not do this 00083 // Call reshape to set video modes to OpenGL 00084 reshape(m_resX, m_resY); 00085 00086 // Set cull face. 00087 glDisable(GL_CULL_FACE); 00088 00089 // Set a smooth shading which looks much better than flat. 00090 glShadeModel(GL_SMOOTH); 00091 00092 glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 00093 00094 // Settings for the depth buffer 00095 glClearDepth(1.0f); 00096 glEnable(GL_DEPTH_TEST); 00097 glDepthFunc(GL_LEQUAL); 00098 00099 // Nice perspective. 00100 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); 00101 00102 glEnable(GL_POLYGON_SMOOTH); 00103 00104 // TODO: init? 00105 TextureDatabase::getInstance(); 00106 00107 FontRenderer::getInstance()->init(); 00108 } |
Here is the call graph for this function:
|
Definition at line 206 of file CoreEngine.cpp. References pge::SDLApplication::getMousePointer(), pge::SDLApplication::getTicks(), m_delay, m_lastTime, m_owner, m_resX, m_resY, render(), pge::SDLApplication::setMousePointer(), pge::SDLApplication::swapBuffer(), and timer().
00206 { 00207 static unsigned int temp = 0; 00208 static GLApplication::MouseCoordinate m; 00209 00210 00211 render(); 00212 00213 // Swap the OpenGL buffer. 00214 m_owner->swapBuffer(); 00215 00216 temp = m_owner->getTicks(); 00217 00218 // Timer. 00219 if(temp >= (m_lastTime + m_delay)) { 00220 timer(temp - m_lastTime); 00221 00222 // TODO: this works 00223 //POINT p; 00224 //GetCursorPos(&p); 00225 //SetCursorPos(m_owner->getResolutionWidth() / 2, m_owner->getResolutionHeight() / 2); 00226 //InputSystem::getInstance()->mouseMotion(temp - m_lastTime, p.x, p.y); 00227 00228 // Generate mousemotion events here. 00229 m = m_owner->getMousePointer(); 00230 InputSystem::getInstance()->mouseMotion(temp - m_lastTime, m.x, m.y); 00231 // TODO: only if in gamemode, not in menumode or similar 00232 // Set mouse pointer to the middle of the screen 00233 m_owner->setMousePointer(m_resX / 2, m_resY / 2); 00234 00235 m_lastTime = temp; 00236 } 00237 } |
Here is the call graph for this function:
|
Definition at line 134 of file CoreEngine.cpp. References m_currentWorld, m_fps, m_initDone, and pge::World::render(). Referenced by mainLoop().
00134 { 00135 if(m_initDone) { 00136 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 00137 glMatrixMode(GL_MODELVIEW); 00138 glLoadIdentity(); 00139 00140 if(m_currentWorld != NULL) { 00141 m_currentWorld->render(); 00142 } 00143 00144 m_fps++; 00145 } 00146 } |
Here is the call graph for this function:
|
Definition at line 154 of file CoreEngine.cpp. References m_resX, and m_resY. Referenced by init().
|
|
Definition at line 287 of file CoreEngine.cpp. References m_currentWorld.
00287 { 00288 m_currentWorld = world; 00289 } |
|
Definition at line 196 of file CoreEngine.cpp. References m_owner, and pge::SDLApplication::shutdown().
00196 { 00197 m_owner->shutdown(); 00198 } |
Here is the call graph for this function:
|
Definition at line 171 of file CoreEngine.cpp. References m_currentWorld, m_fps, m_fpsLoop, m_fpsResult, m_initDone, and pge::World::timer(). Referenced by mainLoop().
00171 { 00172 if(m_initDone) { 00173 InputSystem::getInstance()->timer(delay); 00174 00175 00176 if(m_currentWorld != NULL) { 00177 m_currentWorld->timer(delay); 00178 } 00179 00180 // Frames per second 00181 if(m_fpsLoop >= 1000) { 00182 m_fpsResult = m_fps; 00183 m_fps = 0; 00184 m_fpsLoop = 0; 00185 } 00186 m_fpsLoop += delay; 00187 } 00188 } |
Here is the call graph for this function:
|
Definition at line 101 of file CoreEngine.h. Referenced by action(), CoreEngine(), getCurrentWorld(), hasActiveWorld(), init(), render(), setCurrentWorld(), timer(), and ~CoreEngine(). |
|
Definition at line 86 of file CoreEngine.h. Referenced by CoreEngine(), and mainLoop(). |
|
Definition at line 90 of file CoreEngine.h. Referenced by CoreEngine(). |
|
Definition at line 96 of file CoreEngine.h. Referenced by CoreEngine(), render(), and timer(). |
|
Definition at line 97 of file CoreEngine.h. Referenced by CoreEngine(), and timer(). |
|
Definition at line 98 of file CoreEngine.h. Referenced by CoreEngine(), getFPS(), and timer(). |
|
Definition at line 93 of file CoreEngine.h. Referenced by CoreEngine(), init(), render(), and timer(). |
|
Definition at line 87 of file CoreEngine.h. Referenced by CoreEngine(), and mainLoop(). |
|
The owning GL Application.
Definition at line 79 of file CoreEngine.h. Referenced by CoreEngine(), init(), mainLoop(), and shutdown(). |
|
Definition at line 82 of file CoreEngine.h. Referenced by CoreEngine(), getResolutionWidth(), init(), mainLoop(), and reshape(). |
|
Definition at line 83 of file CoreEngine.h. Referenced by CoreEngine(), getResolutionHeight(), init(), mainLoop(), and reshape(). |