//-----------------------------------------------------------------------------
// Name: initialize_glut( )
// Desc: Initializes Glut with the global vars
//-----------------------------------------------------------------------------
void initialize_glut(int argc, char *argv[]) {
    // initialize GLUT
    glutInit( &argc, argv );
    // double buffer, use rgb color, enable depth buffer
    glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
    // initialize the window size
    glutInitWindowSize( g_width, g_height );
    // set the window postion
    glutInitWindowPosition( 400, 100 );
    // create the window
    glutCreateWindow( "Vinyl Visualizer");
    // full screen
    if( g_fullscreen )
        glutFullScreen();

    // set the idle function - called when idle
    glutIdleFunc( idleFunc );
    // set the display function - called when redrawing
    glutDisplayFunc( displayFunc );
    // set the reshape function - called when client area changes
    glutReshapeFunc( reshapeFunc );
    // set the keyboard function - called on keyboard events
    glutKeyboardFunc( keyboardFunc );
    // set window's to specialKey callback
    glutSpecialFunc( specialKey );
    // set window's to specialUpKey callback (when the key is up is called)
    glutSpecialUpFunc( specialUpKey );
    // do our own initialization
    initialize_graphics( );  
}
Ejemplo n.º 2
0
Archivo: game.c Proyecto: rlt3/fast
int
initialize_game(struct Game *game)
{
  if (initialize_graphics(&game->graphics) != 0) {
    /* no graphics! */
    return 1;
  }

  srand(time(NULL));
  srand48(time(NULL));

  /* make all the stars now so they show up immediately */
  construct_all_stars(game->stars);

  set_game(game);

  return 0;
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
// Name: main( )
// Desc: entry point
//-----------------------------------------------------------------------------
int main( int argc, char ** argv )
{
    // initialize GLUT
    glutInit( &argc, argv );
    // double buffer, use rgb color, enable depth buffer
    glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
    // initialize the window size
    glutInitWindowSize( g_width, g_height );
    // set the window postion
    glutInitWindowPosition( 100, 100 );
    // create the window
    glutCreateWindow( "rt_lpc" );

    // set the idle function - called when idle
    glutIdleFunc( idleFunc );
    // set the display function - called when redrawing
    glutDisplayFunc( displayFunc );
    // set the reshape function - called when client area changes
    glutReshapeFunc( reshapeFunc );
    // set the keyboard function - called on keyboard events
    glutKeyboardFunc( keyboardFunc );
    // set the mouse function - called on mouse stuff
    glutMouseFunc( mouseFunc );

    // do our own initialization
    initialize_graphics( );
    if( !initialize_audio( ) )
    {
        fprintf( stderr, "rt_lpc: error initializing audio, exiting...\n" );
        return -3;
    }
    initialize_analysis( );
    
    // let GLUT handle the current thread from here
    glutMainLoop();


    return 0;
}
Ejemplo n.º 4
0
int main( int argc, char **argv )
{
    if ( argc < 2 )
    {
        print_usage( argv[0] );
        return EXIT_FAILURE;
    }

    if ( load_scenario( argv[1] ) != 0 ) { return EXIT_FAILURE; }

    initialize_threading();
    create_update_threads( false );

    printf( "Thread creation complete.\n" );

    glutInit( &argc, argv );
    glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB );
    glutInitWindowSize( params.world_width + stats_area_width, params.world_height + help_area_height );
    glutInitWindowPosition( 100, 100 );
    glutCreateWindow( "Robotic Swarm Simulation" );

    initialize_graphics();

    glutDisplayFunc( draw_all );

    glutKeyboardFunc( process_normal_keys );
    glutSpecialFunc( process_special_keys );

    glutMouseFunc( process_mouse_buttons );
    glutEntryFunc( process_mouse_entry );
    glutMotionFunc( process_mouse_active_motion );

    glutTimerFunc( 1, run_gui, stats.time_step );

    glutMainLoop();

    return EXIT_SUCCESS;
}
Ejemplo n.º 5
0
void main()
{
	int** chessboard;
	int i, j, size;
	printf("N-Queen Problem\nPress any Key to continue...");
	getch();
	do
	{
		clrscr();
		printf("Enter Size of chessBoard[Number of rows or columns ie. N]:");
		scanf("%d", &size);
		if (size < 4)
		{
			printf("\nThere is NO solution for N<4");
			getch();
		}
	}while (size < 4);
	chessboard = MakeChessBoard(size);
	initialize_graphics(max_x, max_y);
	CreateChessBoard(chessboard, size);
	PlaceQueens(chessboard, size, 0);
	getch();
	DeleteChessBoard(chessboard, size);
}