lugre_game.cpp

Go to the documentation of this file.
00001 #include "lugre_prefix.h"
00002 #include "lugre_game.h"
00003 #include "lugre_shell.h"
00004 #include "lugre_ogrewrapper.h"
00005 #include <stdio.h>
00006 #include "lugre_scripting.h"
00007 #include "lugre_timer.h"
00008 #include "lugre_gfx2D.h"
00009 #include "lugre_gfx3D.h"
00010 #include "lugre_sound.h"
00011 
00012 namespace Lugre {
00013 
00014 void    DisplayErrorMessage     (const char* szMsg); 
00015 
00016 cGame::cGame() {}
00017 
00019 void    cGame::Run  (const int iArgC, char **pszArgV) { PROFILE
00020     // init timer
00021     cTimer::GetSingletonPtr(new cTimer(cShell::GetTicks()));
00022     cScripting::GetSingletonPtr(new cScripting());
00023     cScripting::GetSingletonPtr()->Init();
00024     
00025     // pass command line arguments to lua
00026     for (int i=0;i<iArgC;++i) cScripting::GetSingletonPtr()->LuaCall("CommandLineArgument","is",i,pszArgV[i]);
00027 
00028     // when the main function returns, the programm ends
00029     cScripting::GetSingletonPtr()->LuaCall("Main");
00030     
00031     cScripting::GetSingletonPtr()->LuaCall("LugreShutdown");
00032     
00033     // deinit
00034     cOgreWrapper::GetSingleton().DeInit(); // temporarily disabled, sometimes takes AGES for shutdown
00035 }
00036 
00037 void    cGame::RenderOneFrame   () { PROFILE
00038     cGfx3D::PrepareFrame();
00039     cGfx2D::PrepareFrame();
00040     cOgreWrapper::GetSingleton().RenderOneFrame();
00041     cTimer::GetSingletonPtr()->StartFrame(cShell::GetTicks());
00042 }
00043 
00045 void    cGame::NotifyMainWindowResized      (const int w,const int h) {
00046     cScripting::GetSingletonPtr()->LuaCall("NotifyMainWindowResized","ii",w,h);
00047 }
00048 
00049 };

Generated on Wed May 23 06:00:14 2012 for cpp by  doxygen 1.5.6