//------------main---------------------------- int main(void){ PLL_Init(); SysTick_Init(); Switch_Init(); Output_Init(); // print intro screen to lab printf(" Fixed-point Lab\n"); printf("\n\n\n\n\n\n\n\n\n\n"); printf(" By:\n"); printf(" Brandon Boesch\n"); printf(" Curtis Martin\n"); printf(" Press SW2 to begin\n"); ST7735_DrawBitmap(30, 108, bmp_Logo, 70, 100); // begin tests while(PF0 == 0x01){}; Fixed_uDecOut2_test(); while(PF0 == 0x01){}; Fixed_sDecOut3_test(); while(PF0 == 0x01){}; Fixed_uBinOut8_test(); while(PF0 == 0x01){}; // outro screen Output_Clear(); ST7735_SetCursor(0,0); printf("Tests complete!"); ST7735_DrawBitmap(6, 159, bmp_thumbs, 114, 146); while(1){}; }
int main(void){ TExaS_Init(SSI0_Real_Nokia5110_Scope); // set system clock to 80 MHz Random_Init(1); Output_Init(); ST7735_FillScreen(0x0000); // set screen to black ST7735_DrawBitmap(52, 159, PlayerShip0, 18,8); // player ship middle bottom ST7735_DrawBitmap(53, 151, Bunker0, 18,5); ST7735_DrawBitmap(0, 9, SmallEnemy10pointA, 16,10); ST7735_DrawBitmap(20,9, SmallEnemy10pointB, 16,10); ST7735_DrawBitmap(40, 9, SmallEnemy20pointA, 16,10); ST7735_DrawBitmap(60, 9, SmallEnemy20pointB, 16,10); ST7735_DrawBitmap(80, 9, SmallEnemy30pointA, 16,10); ST7735_DrawBitmap(100, 9, SmallEnemy30pointB, 16,10); Delay100ms(50); // delay 5 sec at 80 MHz ST7735_FillScreen(0x0000); // set screen to black ST7735_SetCursor(1, 1); ST7735_OutString("GAME OVER"); ST7735_SetCursor(1, 2); ST7735_OutString("Nice try,"); ST7735_SetCursor(1, 3); ST7735_OutString("Earthling!"); ST7735_SetCursor(2, 4); LCD_OutDec(1234); while(1){ } }
//This displays new direction for our character 2 void DisplayDirection2(int direction, int x, int y){ if(direction ==1){ ST7735_DrawBitmap((x*16), (((y+1)*16) + 31), RSUp, 16, 16); } else if(direction ==2){ ST7735_DrawBitmap((x*16), (((y+1)*16) + 31), RSDown, 16, 16); } else if (direction ==3){ ST7735_DrawBitmap((x*16), (((y+1)*16) + 31), RSLeft, 16, 16); } else if (direction ==4){ ST7735_DrawBitmap((x*16), (((y+1)*16) + 31), RSRight, 16, 16); } }
// *************************** Capture image dimensions out of BMP********** int main(void){ TExaS_Init(SSI0_Real_Nokia5110_Scope); // set system clock to 80 MHz Random_Init(69); Output_Init(); ADC0_Init(); ST7735_InvertDisplay(0); ST7735_SetRotation(0); AI_Init(0x07); Player_Init(); player.potato=1; Timer0_Init(Master_Funk, 30); ST7735_DrawBitmap(53, 151, Bunker0, 18,5); // Delay100ms(1); // delay 5 sec at 80 MHz /* ST7735_FillScreen(0x0000); // set screen to black ST7735_SetCursor(1, 1); ST7735_OutString("GAME OVER"); ST7735_SetCursor(1, 2); ST7735_OutString("Nice try,"); ST7735_SetCursor(1, 3); ST7735_OutString("Earthling!"); ST7735_SetCursor(2, 4); LCD_OutDec(1234); */ while(1){ } }
//------------HotPotato_DrawStatus------------ // Draws p1 status elements on the top of the screen // Input: none // Output: none void HotPotato_DrawStatus(void){ ST7735_SetCursor(16, 1); LCD_OutDec(Characters[0].hp/hpDivisor); // Write hp status if(Characters[0].hp == 0){ // Write death status ST7735_SetCursor(6, 5); ST7735_OutString("You Dead."); Music_Stop(); } int temp=0; for(int i = 0; i<characterCount; i++) // get count on players alive @@@ TEMP ADD FOR CHECK OUT if(Characters[i].active){ temp++; } if(Characters[0].potato){ // Write "it" status ST7735_SetCursor(16, 2); ST7735_OutString("It!"); ST7735_DrawBitmap(110, 17, Sprite[smallPotato].array, 8,8); if(temp==1) { ST7735_SetCursor(6, 5); ST7735_OutString("You Win!"); // write win status Music_Stop(); Characters[0].hp++; } } else{ // Write "not-it" status ST7735_SetCursor(14, 2); ST7735_OutString("Not it"); } }
//------------Character_DrawCharacters------------ // Draw specified amount of Characters to the screen // Input: Amount of characters to be drawn // Output: none void Character_DrawCharacters(void){ short temp = HotPotato_WhosIt(); for(int i = 0; i<characterCount; i++) // Draw characters if(Characters[i].active){ if(i==temp) ST7735_DrawBitmap(Characters[i].x-frameXCord-1, (Characters[i].y-frameYCord)+1, Red ,Characters[i].width+2, Characters[i].height+2);// Draw a red outline around the "it" person Character_Draw(Characters[i]); } }
//------------HotPotato_DrawStatus------------ // Draws p1 status elements on the top of the screen // Input: none // Output: none void HotPotato_DrawStatus(void){ ST7735_SetCursor(16, 1); LCD_OutDec(Characters[0].hp/2); // Write hp status if(Characters[0].hp == 0){ // Write death status ST7735_SetCursor(6, 5); ST7735_OutString("You Dead."); } if(Characters[0].potato){ // Write "it" status ST7735_SetCursor(16, 2); ST7735_OutString("It!"); ST7735_DrawBitmap(110, 16, Sprite[smallPotato].array, 8,8); } else{ // Write "not-it" status ST7735_SetCursor(14, 2); ST7735_OutString("Not it"); } }
void PlaceBomb(int x, int y, int player){ ST7735_DrawBitmap((x*16), (((y+1)*16) + 31), BlueBombG, 16, 16); Play_Sound(1); }
// *********************** Functions ************************* //------------Character_Draw1------------ // Draw a character onto the screen // Input: Character struct to be drawn // Output: none void Character_Draw1(Character data){ ST7735_DrawBitmap(data.x-frameXCord, data.y-frameYCord, (*data.bmp).array, (*data.bmp).width, (*data.bmp).height); }