Exemplo n.º 1
0
/************************************************************************************
 *                                MAIN FUNCTION
 ************************************************************************************/
int main(int argc, char *argv[]) {

	// Initialisation ...
	int out = initialiseScreen();
	if (out)
		return out;
	initialiseCPU();

	// Load ROM file ...
	loadROM("roms/Tetris (W) (V1.0) [!].gb");

	// Print game info ...
	printGameInfo();

	// program main loop
	int done = 0;
	while (!done) {

		updateCPU();
//		drawScreen();
		done = listen();
		manageKeys();
	}

	printf("Exited cleanly\n");
	exitProgram();
	return 0;
}
Exemplo n.º 2
0
int main( int argc, char **argv )
{
	ALLEGRO_DISPLAY *display = NULL;
	ALLEGRO_EVENT_QUEUE *event_queue = NULL;
	

	//VARIABLES
	const int FPS =200;
	bool redraw = true;
	bool jump = false;
	SCR_CREATE_DISPLAY
	INIT_ALLEGRO_ADDONS
	
	initGameCore();

	event_queue = al_create_event_queue();
	timer = al_create_timer(1.0 / FPS);

	REGISTER_QUEUE

	al_clear_to_color(al_map_rgb(0,0,0));

	srand(time(NULL));
	al_start_timer(timer);
	
	while(!done)
	{
		ALLEGRO_EVENT ev;
		al_wait_for_event(event_queue, &ev);
		
		if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { done = true; } 
		else if( (ev.type == ALLEGRO_EVENT_KEY_DOWN)||(ev.type == ALLEGRO_EVENT_KEY_UP) )
		{ manageKeys(ev); }
		if(ev.type == ALLEGRO_EVENT_TIMER)
		{
			//cout << "loop\n";
			managePlayer();
			//cout << "going for progress\n";
			AnimatorHolder::Progress( GET_TIMER(timer) );
			terrain->drawTerrain();
			AnimatorHolder::Draw();
			//cout << "leaving for progress\n";
			DestructionManager::Commit();

			al_flip_display();
			al_clear_to_color(al_map_rgb(0,0,0));
		}
	}


	DESTROY_SEQ	

	return 1;
}