void gameMenu() { while(true) { if (!AB.nextFrame()) continue; buttons.poll(); AB.clearDisplay(); AB.paintScreen(intro_screen); // AB.setCursor(0,0); // AB.println("menu"); if (buttons.up()) { menu_selection-=1; } else if (buttons.down()) { menu_selection+=1; } // limit us to options 0 - 3 menu_selection = menu_selection % 4; // render menu // choosing a selection if (buttons.a()) { // AB.println("A button"); // AB.println(buttons.currentButtonState); // AB.println(buttons.previousButtonState); // AB.display(); app_state = NEW_GAME; return; } // AB.display(); // case to choose item // case CREDITS: // credits(); // break; // AB.display(); } }
void loop() { if (!(arduboy.nextFrame())) return; static uint16_t i = 0; // ANNOYING RAINBOW. As soon as I got the led rainbow to work // I disabled it until I recorded the video because it is grating. #if GRAYSCALE_AND_RAINBOW_ENABLED arduboy.setRGBled(rainbowcolor(frame(i)/2,4),rainbowcolor(frame(i)/2,2),rainbowcolor(frame(i)/2,0));//2 0 0 #endif // clear the screen arduboy.clear(); // move cat if (arduboy.pressed(LEFT_BUTTON)) if (catX > 1) catX -= 1; if (arduboy.pressed(RIGHT_BUTTON)) if (catX < 128-34) catX += 1; if (arduboy.pressed(UP_BUTTON)) if (catY > 1) catY -= 1; if (arduboy.pressed(DOWN_BUTTON)) if (catY < 64-24) catY += 1; #if GRAYSCALE_AND_RAINBOW_ENABLED // draw "rainbow" for(char k=catX-6;k+16 > -16; k -= 16) arduboy.drawBitmap(k,catY + 1,rainbow_png_data + (16*3)*((frame(i)/5)%2) + (16*3*2*(i%2)),16,24,WHITE); #endif // draw sparkles for(char j=0;j<12;j++) { sparklesX[j] -= 1;/*-8*frame(i)));*/ if (sparklesX[j] < -8) sparklesX[j] += 128; arduboy.drawBitmap(sparklesX[j],sparklesY[j]-3,sparkle + 8*(( (frame(i)/2) + sparklesF[j] )%6),8,8,WHITE); } arduboy.drawBitmap(catX,catY,nyan_png_data + (34*3)*(frame(i)/2),34,24,WHITE); // draw cat arduboy.drawBitmap(catX,catY,nyan2_png_data + (34*3)*(frame(i)/2) #if GRAYSCALE_AND_RAINBOW_ENABLED + (34*3*6*(i%2)) #endif ,34,24,BLACK); // push to screen arduboy.display(); // increase ticker i++; if (i == 192*10) i = 0; }
void setup() { arduboy.begin(); arduboy.setFrameRate(90); }