Initializing the worldnew

First, since this is a REDsdk application, don't forget to setup your REDsdk + ART license key. See here for details: Setting up a REDsdk software vendor license or Setting up a REDsdk per-seat license.

REDsdk advanced real-time API is packaged into the RPL namespace. This namespace co-exists with the RED namespace but also delivers its own application logic which operates at a higher level than REDsdk. We use a world (RPL::IWorld) that runs a simulation (RPL::IWorld::Start). Then, the world is synchronized (RPL::IWorld::Update) and finally shutdown (RPL::IWorld::Shutdown).

This is illustrated below:

RED::Object* world = RPL::Factory::CreateInstance( CID_RPLWorld );
if( !world )
  RC_TEST( RED_ALLOC_FAILURE );

RPL::IWorld* iworld = world->As< RPL::IWorld >();

// Setup a simple planetary system:
RC_TEST( iworld->SetupEarthSystem() );

// Start the world:
RC_TEST( iworld->Start( window, NULL, NULL ) );

// Update the world, refresh the app every frame:
while( app_is_running )
{
  RC_TEST( iworld->Update() );
}

// Terminate:
RC_TEST( iworld->Shutdown() );