Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

pge::GLApplication Class Reference

#include <GLApplication.h>

Inheritance diagram for pge::GLApplication:

Inheritance graph
[legend]
Collaboration diagram for pge::GLApplication:

Collaboration graph
[legend]

Public Member Functions

 GLApplication (int resX, int resY, int bits, bool fullscreen, const std::string &title)
virtual ~GLApplication (void)
bool isWindowOpened (void)

Protected Member Functions

void initCall (void)
void reshapeCall (GLsizei width, GLsizei height)
void keyDownCall (int key)
void keyUpCall (int key)
void mousePressCall (int button, int x, int y)
void mouseReleaseCall (int button, int x, int y)
void mainLoopCall ()

Private Attributes

bool m_windowOK

Constructor & Destructor Documentation

pge::GLApplication::GLApplication int  resX,
int  resY,
int  bits,
bool  fullscreen,
const std::string &  title
 

Definition at line 17 of file GLApplication.cpp.

References pge::SDLApplication::getTicks(), isWindowOpened(), m_windowOK, and pge::SDLApplication::openWindow().

00017                                                                                                           {
00018 
00019                 // Open a window
00020                 m_windowOK = openWindow(resX, resY, bits, fullscreen, title);
00021 
00022                 if(isWindowOpened()) {
00023 
00024                         // Init OpenGL subsystem directly after opening the window.
00025                         renderer::glInit();
00026 
00027                         // Core Engine init
00028                         CoreEngine::getInstance()->init(this, resX, resY);
00029 
00030                 } else {
00031                         printf("Could not create the window.");
00032                 }
00033 
00034 #ifdef GLAPP_MAIN_LOOP
00035                 m_delay = 15;
00036                 m_lastTime = getTicks();
00037 #endif
00038         }

Here is the call graph for this function:

pge::GLApplication::~GLApplication void   )  [virtual]
 

Definition at line 46 of file GLApplication.cpp.

00046                                           {
00047         }


Member Function Documentation

void pge::GLApplication::initCall void   )  [protected, virtual]
 

Implements pge::SDLApplication.

Definition at line 87 of file GLApplication.cpp.

00087                                          {
00088                 CoreEngine::getInstance()->init();
00089         }

bool pge::GLApplication::isWindowOpened void   ) 
 

Definition at line 55 of file GLApplication.cpp.

References m_windowOK.

Referenced by GLApplication().

00055                                                {
00056                 return m_windowOK;
00057         }

void pge::GLApplication::keyDownCall int  key  )  [protected, virtual]
 

Implements pge::SDLApplication.

Definition at line 119 of file GLApplication.cpp.

00119                                                {
00120                 InputSystem::getInstance()->keyDown(key);
00121         }

void pge::GLApplication::keyUpCall int  key  )  [protected, virtual]
 

Implements pge::SDLApplication.

Definition at line 129 of file GLApplication.cpp.

00129                                              {
00130                 InputSystem::getInstance()->keyUp(key);
00131         }

void pge::GLApplication::mainLoopCall  )  [protected, virtual]
 

Implements pge::SDLApplication.

Definition at line 171 of file GLApplication.cpp.

References pge::SDLApplication::getMousePointer(), pge::SDLApplication::getResolutionHeight(), pge::SDLApplication::getResolutionWidth(), pge::SDLApplication::getTicks(), pge::SDLApplication::MouseCoordinate, pge::SDLApplication::setMousePointer(), pge::SDLApplication::sleep(), and pge::SDLApplication::swapBuffer().

00171                                          {
00172 
00173 #ifdef GLAPP_MAIN_LOOP
00174 
00175                 unsigned int temp = 0;
00176                 MouseCoordinate m;
00177 
00178 
00179                 renderCall();
00180                 // swap the buffer
00181                 swapBuffer();
00182 
00183                 temp = getTicks();
00184                 // timer
00185                 if(temp >= (m_lastTime + m_delay)) {
00186                         timerCall(temp - m_lastTime);
00187 
00188                         // mouse motion
00189                         m = getMousePointer();
00190                         mouseMotionCall(temp - m_lastTime, m.x, m.y);
00191                         // Set mouse pointer to the middle of the screen.
00192                         setMousePointer(getResolutionWidth() / 2, getResolutionHeight() / 2);
00193 
00194                         m_lastTime = temp;
00195                 }
00196 
00197                 // TODO
00198                 sleep(10);
00199 
00200 #else
00201                 CoreEngine::getInstance()->mainLoop();
00202 #endif
00203         }

Here is the call graph for this function:

void pge::GLApplication::mousePressCall int  button,
int  x,
int  y
[protected, virtual]
 

Implements pge::SDLApplication.

Definition at line 151 of file GLApplication.cpp.

00151                                                                    {
00152                 InputSystem::getInstance()->mousePress(button, x, y);
00153         }

void pge::GLApplication::mouseReleaseCall int  button,
int  x,
int  y
[protected, virtual]
 

Implements pge::SDLApplication.

Definition at line 161 of file GLApplication.cpp.

00161                                                                      {
00162                 InputSystem::getInstance()->mouseRelease(button, x, y);
00163         }

void pge::GLApplication::reshapeCall GLsizei  width,
GLsizei  height
[protected, virtual]
 

Implements pge::SDLApplication.

Definition at line 97 of file GLApplication.cpp.

00097                                                                      {
00098                 CoreEngine::getInstance()->reshape(width, height);
00099         }


Field Documentation

bool pge::GLApplication::m_windowOK [private]
 

Definition at line 71 of file GLApplication.h.

Referenced by GLApplication(), and isWindowOpened().


The documentation for this class was generated from the following files:
Generated on Mon Oct 16 12:09:08 2006 for Phobosengine by doxygen 1.3.4