Initializing the world

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 ART 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 (ART::IWorld) that runs a simulation (ART::IWorld::Start). Then, the world is synchronized (ART::IWorld::Update) and finally shutdown (ART::IWorld::Shutdown).

This is illustrated below:

RED::Object* world = ART::Factory::CreateInstance( CID_ARTWorld );
if( !world )
  RC_TEST( RED_ALLOC_FAILURE );

ART::IWorld* iworld = world->As< ART::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() );