Friday, March 1, 2013

Basic use of library



//#pragma comment( linker, "/subsystem:windows /ENTRY:mainCRTStartup" )// Make console window stay closed.

#include <RealLibrary.h>

#pragma comment( lib, "Real Library.lib" )

using namespace real;
using namespace real::core;
using namespace real::input;
using namespace real::graphics;
using namespace real::physics;
using namespace real::audio;
using namespace real::script;
using namespace real::bind;
using namespace real::base;

//int HK_CALL main( int argc, const char** argv )
int main( int argc, const char** argv )
{
       // Bind scripts.
       bindReal( SCRIPTDEVICE.getState() );
      
       // Initialize scene
       SCRIPTDEVICE.runScript( "myScriptPath.lua" );// SOS here put your own Lua script!!!!!!!!
      
       // Simulation loop.
       while( GRAPHICSDEVICE.isRunning() )// Exit loop if graphicsdevice is not running.
       {
              if ( GRAPHICSDEVICE.isWindowActive() )// Check if window is active in order to pause devices.
              {
                     // Update devices.
                     ACTOR.update();// it holds the camera so camera is also updated.
                     APPLICATION.update();// Update application logic.
                     INPUTDEVICE.update();// Check for user input.
                     PHYSICSDEVICE.update();// Do a simulation step.
                     GRAPHICSDEVICE.render();// Render scene.              
              }
              else
                     GRAPHICSDEVICE.yield();
       }
}