Exemplo n.º 1
0
Arquivo: main.cpp Projeto: ICRAR/void
int main(int argc, void ** argv)
{
    Demo app;
    app.Initialize(&argc, argv);
    app.Execute();
    return 0;
}
Exemplo n.º 2
0
int main() {

    Demo* currentDemo = 0;
    bool isRunning = true;
    char choice;
    
    do {
        cout << "** Procedural Content Generation using Generative Grammars **\n\n";
        cout << "Select demo:\n";
        cout << "   Demo 1: Quest Generation (Description)\n";
        cout << "   Demo 2: Weapon Generation\n";
        cout << "   'q' to quit\n\n";
        cout << "(Number)> ";
        choice = cin.get();
        
        if( currentDemo != 0 ) {
            delete currentDemo;
            currentDemo = 0;
        }
        
        switch (choice) {
            case '1':
                currentDemo = new DemoQuests();
                break;
            case '2':
                currentDemo = new DemoWeapons();
                break;
            case 'q':
                isRunning = false;
                break;
        }
        
        if( currentDemo!= 0 ) {
            
            currentDemo->Initialize();
            currentDemo->Run();
            
            cin.get(); // registers 2 enters for some reason :/
            
            #ifdef WINDOWS_PLATFORM
                system("cls");
            #else
                system("clear");
            #endif
        }
        
        
    } while ( isRunning );

    delete currentDemo;

    return 0;
}
Exemplo n.º 3
0
int TLOC_MAIN(int , char *[])
{
  Demo demo;
  demo.Initialize(core_ds::MakeTuple(800, 600));
  demo.Run();

  //------------------------------------------------------------------------
  // Exiting
  TLOC_LOG_CORE_INFO() << "Exiting normally";

  return 0;

}
Exemplo n.º 4
0
int main( int argc, char * argv[] )
{	
	int displayWidth = DisplayWidth;
	int displayHeight = DisplayHeight;
	
	if ( !OpenDisplay( "Fiedler's Cubes", displayWidth, displayHeight ) )
	{
		printf( "failed to open display!\n" );
		return 1;
	}
	
	HideMouseCursor();
	
	int currentDemo = 0;
	Demo * demo = CreateDemo( 0, displayWidth, displayHeight );
	assert( demo );
	demo->Initialize();
	
	bool shadows = true;
	
	while ( true )
	{
		platform::Input input = platform::Input::Sample();
		
		if ( input.alt )
		{
			int demoIndex = -1;
			
			if ( input.one )
				demoIndex = 0;
				
			if ( input.two )
				demoIndex = 1;
				
			if ( input.three )
				demoIndex = 2;
				
			if ( input.four )
				demoIndex = 3;
				
			if ( input.five )
				demoIndex = 4;
				
			if ( input.six )
				demoIndex = 5;
				
			if ( input.seven )
				demoIndex = 6;
				
			if ( input.eight )
				demoIndex = 7;
				
			if ( input.nine )
				demoIndex = 8;
				
			if ( input.zero )
				demoIndex = 9;

			if ( input.f4 )
				break;

			static bool enterDownLastFrame = false;
			if ( input.enter && !enterDownLastFrame )
				shadows = !shadows;
			enterDownLastFrame = input.enter;
				
			if ( demoIndex != -1 )
			{
				Demo * newDemo = CreateDemo( demoIndex, displayWidth, displayHeight );
				if ( newDemo )
				{
					ClearDisplay( displayWidth, displayHeight );
					delete demo;
					demo = newDemo;
					assert( demo );
					demo->Initialize();
					currentDemo = demoIndex;
				}
			}
		}
		
		static bool escapeDownLastFrame = false;		
		if ( input.escape && !escapeDownLastFrame )
		{
			ClearDisplay( displayWidth, displayHeight );
			delete demo;
			demo = CreateDemo( currentDemo, displayWidth, displayHeight );
			assert( demo );
			demo->Initialize();
		}
		escapeDownLastFrame = input.escape;
		
		demo->ProcessInput( !input.alt ? input : platform::Input() );
		
		demo->Update( DeltaTime );
		
		demo->Render( DeltaTime, shadows );
		
		UpdateDisplay( 1 );
		
		demo->PostRender();
	}

	CloseDisplay();

	delete demo;
	
	return 0;
}