static void intinDraw() { lcdClear(); lcdPrint(s_int.prompt); for (int dx = 0; dx< s_int.digits; dx++){ DoChar(dx*CHARWIDTH,20,IntToStr(s_int.the_number,s_int.digits,F_LONG|F_ZEROS)[dx]); } DoChar(s_int.pos * CHARWIDTH, 30, '^'); }
void FVDoit(CreateWidthData *wd) { FontViewBase *fv = (FontViewBase *) (wd->_fv); int i; BDFChar *bc; if ( fv->sf->onlybitmaps && fv->active_bitmap!=NULL && fv->sf->bitmaps!=NULL ) { double scale = (fv->sf->ascent+fv->sf->descent)/(double) fv->active_bitmap->pixelsize; wd->setto *= scale; wd->increment *= scale; } bc = NULL; for ( i=0; i<fv->map->enc_limit; ++i ) if ( fv->selected[i] ) { SplineChar *sc; sc = SFMakeChar(fv->sf,fv->map,i); if ( fv->sf->onlybitmaps && fv->sf->bitmaps!=NULL ) { if ( fv->active_bitmap!=NULL ) bc = BDFMakeChar(fv->active_bitmap,fv->map,i); #if 0 else { BDFFont *bdf; for ( bdf=fv->sf->bitmaps; bdf!=NULL; bdf=bdf->next ) bc = BDFMakeChar(bdf,fv->map,i); } #endif } DoChar(sc,wd,fv,bc); } wd->done = true; }
static bool gameover_scene() { int dy = getFontHeight(); int s1x = DoString(0, 0, "GAME OVER!"); s1x = (RESX-s1x)/2; int s2x = DoString(0, 0, "HIGHTSCORE!"); s2x = (RESX-s2x)/2; char key = 0; while(key != BTN_UP && key != BTN_DOWN) { lcdClear(); if(highscore_set(game.scroll_pos / 15, GLOBAL(nickname))) DoString (s2x, dy, "HIGHSCORE!"); else DoString(s1x, dy, "GAME OVER!"); int x = DoInt(0, 3*dy, game.scroll_pos / 15); DoChar(x, 3*dy, 'm'); DoString(0, 5*dy, "UP to play"); DoString(0, 6*dy, "DOWN to quit"); lcdDisplay(); key = getInputWaitTimeout(5000); } return !(key==BTN_DOWN); }
static void splash_scene() { uint32_t highscore; char highnick[20]; char key = 0; while(key == 0) { getInputWaitRelease(); int dy = getFontHeight(); int s1x = DoString(0, 0, "r0ket"); s1x = (RESX-s1x)/2; int s2x = DoString(0, 0, "JUMP!"); s2x = (RESX-s2x)/2; lcdFill(0); DoString(s1x, 3*dy, "r0ket"); DoString(s2x, 4*dy, "JUMP!"); DoString(0, 7*dy, "by webholics"); highscore = highscore_get(highnick); int s3x = DoInt(0, 0, highscore); DoChar(s3x, 0, 'm'); DoString (0, dy, highnick); lcdDisplay(); key = getInputWaitTimeout(1000); } }
void CVDoit(CreateWidthData *wd) { CharView *cv = (CharView *) (wd->_fv); DoChar(cv->b.sc,wd,(FontViewBase *) (cv->b.fv),NULL); wd->done = true; }
static void draw_hud() { int x = DoInt(0, 0, game.scroll_pos / 15); DoChar(x, 0, 'm'); }
void board_draw(board_t* b, int anim_i, int anim_N) { setTextColor(0, 0xff); setIntFont(&Font_7x8); if (b->n_moves < 3) DoString(0, 0, "try to get to 'b'!"); else DoString(0, 0, IntToStr(b->n_moves, 6, 0)); bool blocks = (b->font == FONT_NONE); if (blocks) { b->cell_w = RESX / b->w; b->cell_h = (RESY - 8) / b->h; } else { setExtFont(font_list[b->font]); b->cell_w = b->cell_h = getFontHeight(); } uint centeringx = (RESX - (b->cell_w * b->w)) / 2; if (centeringx >= RESX) centeringx = 0; uint centeringy = (RESY - (b->cell_h * b->h)) / 2; if (centeringy >= RESY) centeringy = 0; if (centeringy < 8) centeringy = 8; int x, y; int xx, yy; for (x = 0; x < b->w; x ++) { for (y = 0; y < b->h; y ++) { cell_t* c = board_cell(b, x, y); xx = x * b->cell_w; yy = y * b->cell_h; if (anim_i >= anim_N) { // animation ended. c->val = c->anim_newval; c->anim_to = -1; } else if (c->anim_to >= 0) { int from_x = xx; int from_y = yy; int to_x = (c->anim_to % b->w) * b->cell_w; int to_y = (c->anim_to / b->w) * b->cell_h; xx = from_x + anim_i * (to_x - from_x) / anim_N; yy = from_y + anim_i * (to_y - from_y) / anim_N; } { const color_t* col = cell_col(c); setTextColor(col->bg, col->fg); } xx += centeringx; yy += centeringy; if ((xx >= 0) && (xx < RESX) && (yy >= 0) && (yy < RESY)) { if (blocks) { if (c->val) // don't draw empty blocks DoRect(xx, yy, b->cell_w, b->cell_h); } else DoChar(xx, yy, cell_chr(c)); } } } }