#include #include "basic/basic.h" #include "lcd/render.h" #include "lcd/display.h" #include "lcd/allfonts.h" void ReinvokeISP(void); void EnableWatchdog(uint32_t ms); void delayms(uint32_t ms); /**************************************************************************/ #define POS_PLAYER_Y 60 #define ENEMY_ROWS 3 #define ENEMY_COLUMNS 6 #define DISABLED 255 unsigned char rnd1(); struct gamestate { char player; char shot_x, shot_y; char alive; char move, direction, lastcol; bool killed; char enemy_x[ENEMY_ROWS][ENEMY_COLUMNS]; char enemy_row_y[ENEMY_ROWS]; } game = {RESX/2-4, DISABLED, 0,ENEMY_ROWS*ENEMY_COLUMNS, 0, -1, ENEMY_COLUMNS-1, false}; char key; void checkISP(void) { if(gpioGetValue(RB_BTN2)==0){ gpioSetValue (RB_LED1, CFG_LED_ON); delayms(200); gpioSetValue (RB_LED1, CFG_LED_OFF); while(gpioGetValue(RB_BTN0)==0); EnableWatchdog(1000*5); ReinvokeISP(); } } void draw_rect(char x0, char y0, char x1, char y1) { for(char x=x0; x<=x1; ++x) { lcdSetPixel(x,y0,true); lcdSetPixel(x,y1,true); } for(char y=y0+1; y0; --x) { for(uchar y=1; y