Exemplo n.º 1
0
static bool screen_intro() {
	uint32_t highscore;
	char highnick[20];
	char key=0;
	bool step = false;
	//getInputWaitRelease();
	while(key==0) {
		getInputWaitRelease();
		lcdFill(0x00);
		setIntFont(&Font_Invaders);
    setTextColor(0x00,0b11100000);
    lcdSetCrsr(28+18,25+15);lcdPrint(step?"ABC":"abc");
		setIntFont(&Font_7x8);
    setTextColor(0x00,0b00011000);
		lcdSetCrsr(28+18,40+15);lcdPrint("SPACE");
    setTextColor(0x00,0b11111000);
		lcdSetCrsr(18+18,50+15);lcdPrint("INVADERS");

		highscore = highscore_get(highnick);
    setTextColor(0x00,0xff);
		lcdSetCrsr(0,0);lcdPrint(IntToStr(highscore,6,F_LONG));
//		lcdSetCrsr(0,9);lcdPrint(highnick);
		lcdDisplay();
		step = !step;
		key=getInputWaitTimeout(1000);
	}
	//getInputWaitRelease();
	return !(key==BTN_LEFT);
}
Exemplo n.º 2
0
//# MENU nick changeFont
void doFont(void){
    getInputWaitRelease();
    if( selectFile(GLOBAL(nickfont),"F0N") != 0){
        lcdPrintln("No file selected.");
        return;
    };
	writeFile("font.cfg",GLOBAL(nickfont),strlen(GLOBAL(nickfont)));

    lcdClear();
    setIntFont(&Font_7x8);
    lcdPrintln("Test:");
    setExtFont(GLOBAL(nickfont));
    lcdPrintln(GLOBAL(nickname));
    lcdDisplay();
    setIntFont(&Font_7x8);
    while(!getInputRaw())delayms(10);
}
Exemplo n.º 3
0
void board_menu_draw(board_t* b)
{
  setTextColor(0, 0xff);
  setIntFont(&Font_7x8);

  const int lineh = getFontHeight();

  lcdSetCrsr(0, 0);
  lcdPrintln("0xb number game");
  lcdPrintln("Push < > ^ v");
  lcdPrintln("Add same blocks");
  lcdPrint("Try to reach '");
  setTextColor(colors[N_COLORS-1].bg, colors[N_COLORS-1].fg);
  lcdPrint("b");
  setTextColor(0, 0xff);
  lcdPrintln("'!");
  lcdNl();

  for (uint i = 0; i < menu_N; i ++) {
    if (i == b->menu_item)
      lcdPrint(">> ");
    else
      lcdPrint("   ");
    lcdPrint(menu_str[i]);

    switch (i) {
      case 3:
        // width
        lcdPrint(" = ");
        lcdPrint(IntToStr(b->w, 2, 0));
        break;
      case 4:
        // height
        lcdPrint(" = ");
        lcdPrint(IntToStr(b->h, 2, 0));
      default:
        break;
    }
    lcdNl();
  }

  if (b->menu_item == 2) {
    lcdPrintln(font_list[b->font]);
    if (b->font == FONT_NONE) {
      uint w = RESX / N_COLORS;
      for (uint8_t i = 0; i < N_COLORS; i++) {
        const color_t* col = colors + i;
        setTextColor(col->bg, col->fg);
        DoRect(i*w, 120, w, 10);
      }
    }
    else {
      setExtFont(font_list[b->font]);
      lcdPrint("789ab");
    }
  }
}
Exemplo n.º 4
0
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);
}
Exemplo n.º 5
0
static bool screen_gameover() {
	char key =0;
	while(key==0) {
		lcdFill(0x00);
		setIntFont(&Font_7x8);
    setTextColor(0x00,0b11100000);
		lcdSetCrsr(14+15,32+15);lcdPrint("GAME OVER");
    setTextColor(0x00,0xff);
		lcdSetCrsr(0,0);lcdPrint(IntToStr(game.score,6,F_LONG));
		if (highscore_set(game.score, GLOBAL(nickname))){
      setTextColor(0x00,0b00011000);
      lcdSetCrsr(0,9);lcdPrint("HIGHSCORE!");
		};
		lcdDisplay();
		key=getInputWaitTimeout(5000);
	}
	//getInputWaitRelease();
	return !(key==BTN_LEFT);
}
Exemplo n.º 6
0
void setSystemFont(void){
    setIntFont(&Font_7x8);
}
Exemplo n.º 7
0
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));
      }
    }
  }

}