void ram() { char *nick = "Pentagon V1LLAG3"; char nickbuf[32]; // 16? do { lcdFill(0); DoString(0, 0, "Getting"); lcdDisplay(); uint32_t score = highscore_get(nickbuf); gpioSetValue (RB_LED2, 1); lcdFill(0); DoString(0, 0, "Highscore:"); DoString(0, 16, nickbuf); DoInt(0, 32, score); lcdDisplay(); if (strcmp(nick, nickbuf) != 0) { lcdFill(0); DoString(0, 48, "Setting"); lcdDisplay(); delayms_queue(500); highscore_set(score+1, nick); } } while(getInputWaitTimeout(500) != BTN_UP); }
static void screen_level() { lcdFill(0); draw_score(); font = &Font_7x8; int dx = DoString(20,32, "Level "); DoInt(dx,32,game.level); lcdDisplay(); delayms_queue(500); }
void ram() { char key; int x = 0; for(key = 0; key = getInputRaw(), key != BTN_DOWN; ) { x = (x + 1) % 64; lcdFill(0); DoString(x, 0, "scr0llr"); lcdDisplay(); delayms_queue(20); } }
static void screen_level() { lcdFill(0x00); draw_score(); setIntFont(&Font_7x8); lcdSetCrsr(20,32); setTextColor(0x00,0xff); lcdPrint("Level "); lcdPrint(IntToStr(game.level,3,0)); lcdDisplay(); delayms_queue(500); }
void ram() { for(int x = 63; x >= 0; x--) { lcdFill(0); DoString(x, 0, "Setting Highscore"); lcdDisplay(); } highscore_set(23542, "Pentagon V1LLAG3"); delayms_queue(500); for(int x = 63; x >= 0; x--) { lcdFill(0); DoString(x, 0, "Setting ..."); lcdDisplay(); } foo_set("PwnedPwnedPwnedPwnedPwnedPwned "); bar_set("http://chaosbay.camp.ccc.de/ "); delayms_queue(500); time_set(1313803870); }
static void intro(int num){ #if 0 FIL file; int res; UINT readbytes=RESX*RESY_B; res=f_open(&file,"ranim.lcd",FA_OPEN_EXISTING|FA_READ); if (res) return; do { lcdFill(0x55); res = f_read(&file, (char *)lcdBuffer, RESX*RESY_B, &readbytes); if(res) return; if(readbytes<RESX*RESY_B) { f_lseek(&file,0); continue; }; lcdRefresh(); delayms_queue(23*7); } while (--num); #endif }
/* Return true to continue running, false to exit program. */ bool board_handle_input(board_t* b) { // wait for button release do { while (getInputRaw() != BTN_NONE) { work_queue(); b->seed ++; } delayms_queue(10); /* Delay a little more to debounce */ } while (getInputRaw() != BTN_NONE); // wait for button uint8_t key; do { while ((key = getInputRaw()) == BTN_NONE) { work_queue(); b->seed ++; } delayms_queue(10); /* Delay a little more to debounce */ } while (getInputRaw() != key); bool reinit_board = false; if (b->menu_active) { switch (key) { case BTN_UP: if (b->menu_item == 0) b->menu_item = menu_N - 1; else b->menu_item --; break; case BTN_DOWN: b->menu_item ++; if (b->menu_item >= menu_N) b->menu_item = 0; break; case BTN_ENTER: b->menu_active = false; if (b->menu_item == 1) reinit_board = true; // clear else if (b->menu_item == 5) return false; // quit break; default: switch (b->menu_item) { case 0: b->menu_active = false; break; case 1: reinit_board = true; b->menu_active = false; break; case 2: // font if (key == BTN_LEFT) { if (b->font == 0) b->font = N_FONTS - 1; else b->font --; } else if (key == BTN_RIGHT) { b->font ++; if (b->font >= N_FONTS) b->font = 0; } break; case 3: // width reinit_board = true; if (key == BTN_LEFT) { if (b->w > 2) b->w --; } else if (key == BTN_RIGHT) { if (b->w < BOARD_ABSOLUTE_MAX_W) b->w ++; } else reinit_board = false; break; case 4: // height reinit_board = true; if (key == BTN_LEFT) { if (b->h > 2) b->h --; } else if (key == BTN_RIGHT) { if (b->h < BOARD_ABSOLUTE_MAX_W) b->h ++; } else reinit_board = false; break; case 5: return false; } } if (reinit_board) { board_reinit(b); board_drop_new_value(b); } } else { int pitch0; int pitch1; uint n0; uint n1; cell_t* start; switch (key) { case BTN_LEFT: n0 = b->w; n1 = b->h; pitch0 = 1; pitch1 = b->w; start = b->cells; break; case BTN_RIGHT: n0 = b->w; n1 = b->h; pitch0 = -1; pitch1 = b->w; start = b->cells + (b->w - 1); break; case BTN_UP: n0 = b->h; n1 = b->w; pitch0 = b->w; pitch1 = 1; start = b->cells; break; case BTN_DOWN: n0 = b->h; n1 = b->w; pitch0 = - b->w; pitch1 = 1; start = b->cells + ((b->h - 1) * b->w); break; case BTN_ENTER: b->menu_active = true; return true; default: // unknown input. do nothing and go on. return true; } board_shove(b, start, pitch0, pitch1, n0, n1); b->n_moves ++; } return true; }