Esempio n. 1
0
int main(int argc, char *argv[])
{
	printf("Initializing game\n");
	clock_t start, end;
	int remaining_time;
	
	display_init();
    gamepad_init();
    grid_init(grid);
    players_init(grid, players);
    
    display_fill_screen(0);
    g_running = 1;
    
    while(g_running) {
        start = clock();
        
        update_pos(grid, players);
        
        end = clock();
        
        remaining_time = TIME_PER_LOOP - (((end - start)/CLOCKS_PER_SEC)*1000);
        
        if(remaining_time > 0) {
            usleep(remaining_time*1000);
        }
        
        continue;
    }
	exit(EXIT_SUCCESS);
}
Esempio n. 2
0
int main(void)
{
	physics_init(LCD_WIDTH, LCD_HEIGHT);
	input_init();
	display_init();
	segment_init();
	players_init();
	
	playerA = players_get(0);
	playerB = players_get(1);
	
	ball = physics_create(LCD_WIDTH / 2, LCD_HEIGHT / 2, BALL_RADIUS, BALL_MASS);
	
	for (;;)
	{
		input_update();
		players_update(0.01f);
		physics_update(0.01f);
		game_update();
		game_draw();
	}
	
	return 0;
}