Add print at position shortcuts

This commit is contained in:
Scott Lahteine
2019-08-22 19:36:18 -05:00
parent 5c0e5c599f
commit 7924e0d819
10 changed files with 77 additions and 134 deletions

View File

@ -180,8 +180,7 @@ void BrickoutGame::game_screen() {
// Score Digits
//const uint8_t sx = (LCD_PIXEL_WIDTH - (score >= 10 ? score >= 100 ? score >= 1000 ? 4 : 3 : 2 : 1) * MENU_FONT_WIDTH) / 2;
constexpr uint8_t sx = 0;
lcd_moveto(sx, MENU_FONT_ASCENT - 1);
lcd_put_int(score);
lcd_put_int(sx, MENU_FONT_ASCENT - 1, score);
// Balls Left
lcd_moveto(LCD_PIXEL_WIDTH - MENU_FONT_WIDTH * 3, MENU_FONT_ASCENT - 1);

View File

@ -48,10 +48,7 @@ void MarlinGame::draw_game_over() {
u8g.setColorIndex(0);
u8g.drawBox(lx - 1, ly - gohigh - 1, gowide + 2, gohigh + 2);
u8g.setColorIndex(1);
if (ui.get_blink()) {
lcd_moveto(lx, ly);
lcd_put_u8str_P(PSTR("GAME OVER"));
}
if (ui.get_blink()) lcd_put_u8str_P(lx, ly, PSTR("GAME OVER"));
}
}

View File

@ -416,8 +416,7 @@ void InvadersGame::game_screen() {
// Draw Score
//const uint8_t sx = (LCD_PIXEL_WIDTH - (score >= 10 ? score >= 100 ? score >= 1000 ? 4 : 3 : 2 : 1) * MENU_FONT_WIDTH) / 2;
constexpr uint8_t sx = 0;
lcd_moveto(sx, MENU_FONT_ASCENT - 1);
lcd_put_int(score);
lcd_put_int(sx, MENU_FONT_ASCENT - 1, score);
// Draw lives
if (idat.cannons_left)

View File

@ -80,10 +80,7 @@ void MazeGame::game_screen() {
u8g.setColorIndex(1);
// Draw Score
if (PAGE_UNDER(HEADER_H)) {
lcd_moveto(0, HEADER_H - 1);
lcd_put_int(score);
}
if (PAGE_UNDER(HEADER_H)) lcd_put_int(0, HEADER_H - 1, score);
// Draw the maze
// for (uint8_t n = 0; n < head_ind; ++n) {

View File

@ -231,10 +231,7 @@ void SnakeGame::game_screen() {
u8g.setColorIndex(1);
// Draw Score
if (PAGE_UNDER(HEADER_H)) {
lcd_moveto(0, HEADER_H - 1);
lcd_put_int(score);
}
if (PAGE_UNDER(HEADER_H)) lcd_put_int(0, HEADER_H - 1, score);
// DRAW THE PLAYFIELD BORDER
u8g.drawFrame(BOARD_L - 2, BOARD_T - 2, BOARD_R - BOARD_L + 4, BOARD_B - BOARD_T + 4);

View File

@ -76,8 +76,7 @@ static void lcd_factory_settings() {
LIMIT(bar_percent, 0, 100);
ui.encoderPosition = 0;
draw_menu_item_static(0, PSTR(MSG_PROGRESS_BAR_TEST), true, true);
lcd_moveto((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2);
lcd_put_int(bar_percent); lcd_put_wchar('%');
lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_wchar('%');
lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent);
}