コード例 #1
0
ファイル: Game.cpp プロジェクト: rdelpilar/Tower-Defense
void Game::run_mode_run(uint32 delta_time) {
	if (delta_time >= 1000) {
    // Advance wave by one tile.
    gs->creatureMgr()->advance();
	}

	draw_all_views();

  // Quit once the wave is complete.
  // TODO: Implement either gameover or next level.
	if (gs->creatureMgr()->is_wave_complete()) {
		
		// Don't add CGameOver instance to ViewManager vector or it will
		// overwrite portions of the map. - Ranel
		auto_ptr<CGameOverView> gameoverview ( new CGameOverView ( ) );
		gameoverview->draw ( );
		// No need to call delete on gameoverview object.

		exit_run_mode();
 }

}
コード例 #2
0
ファイル: blink.c プロジェクト: horsetailfiddlehead/ee478
//**********************************************************************************************
//**********************************************************************************************
//**********************************************************************************************
int main(void)
{
	volatile unsigned char data, pos;

	WDTCTL = WDTPW + WDTHOLD;             // Stop watchdog timer


	//if (CALBC1_12MHZ==0xFF || CALDCO_12MHZ == 0xFF)
	 //   while(1);                               // If calibration constants erased do not load - trap CPU
	BCSCTL1 = CALBC1_12MHZ;	// Set DCO
	DCOCTL = CALDCO_12MHZ;


	//**********************************************
	//DO NOT CHANGE THE ORDER OF THE FOLLOWING CODE!
	port_init();

	initLCD();
	P4OUT |= BIT1; //LCD backlight on
	writecom(0x01, 0);//mode=0 instruction/command,    mode=1 data  clear display
	writecom(0x02, 0);//mode=0 instruction/command,    mode=1 data  position cursor home home
	write_string_to_LCD("DLP Design      ", 16);
	writecom(0xC0, 0);//mode=0 instruction/command,    mode=1 data  position cursor to start of second row
	write_string_to_LCD("DLP-RFID2 Demo  ", 16);

	keep_local=0;//if high, keep data returned to demo board (from reader) local instead of forwarding to host PC via USB.  if low, send to host PC.
	rx_index=0;//init the receive buffer index
	run_mode=0;//disable inventories
	blkaddr=0;
	currentantswstate = ANTSWINT;//init to internal

	/*	Code showing how to use J2, "SEL"  User Defined Jumper
	//pullup resistor enabled for P6.7 in port_init();
	data = P6IN;	    //read port 6
	data = data & 0x80;	//mask off other port bits
	if(data>0)          //if P6.7 is high (default)
	*/

	uart_init();

	setup_interrupts();
	//ping reader twice to sync and stop transmitting 'D's
	short_dly(50000);//pause for remainder of packet
	ping_reader();//ping for presence of reader and update display
	short_dly(50000);//pause for remainder of packet
	ping_reader();//ping for presence of reader and update display
	short_dly(50000);//pause for remainder of packet
	//**********************************************

	set_output_mode();


	for (;;)
	{
		if(light_pressed())
			P4OUT ^= 0x02; //toggle P4.1
		if(ping_pressed())
			ping_reader();//ping for presence of reader and update display
		if(antsw_pressed())
			toggle_antenna_switch();//toggle between internal and external antenna
		if(run_pressed())
			enter_run_mode();//setup for reading UIDs and set run flag for continuous inventories
		if(stop_pressed())
			exit_run_mode();//setup for reading UIDs and set run flag for continuous inventories
		if(rfoff_pressed())
			turn_rf_off();
		if(rdblk_pressed())
			read_block();

		if(run_mode==1)
			single_slot_inventory();
	}
}