From 56c290ed502db477474b7a6dbdb152377e535785 Mon Sep 17 00:00:00 2001 From: hkz Date: Sat, 26 Jul 2025 11:55:38 +0200 Subject: [PATCH] Add instruction text --- src/game_graphics.c | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/src/game_graphics.c b/src/game_graphics.c index df71127..b5092e0 100644 --- a/src/game_graphics.c +++ b/src/game_graphics.c @@ -93,20 +93,19 @@ static const uint8_t box_new_hi_score[BOX_WIDTH] = { 0, 0,102, 0, 23, 5, 0, 7, 15, 20, 0, 1, 0, 14, 5, 23, 0, 8, 9, 7, 8, 45, 19, 3, 15, 18, 5, 33, 0,102, 0, 0 }; -#define INSTR_BOX_WIDTH 14 -#define INSTR_BOX_HEIGHT 8 +#define INSTR_BOX_WIDTH 12 +#define INSTR_BOX_HEIGHT 6 #define INSTR_BOX_SIZE (INSTR_BOX_HEIGHT * INSTR_BOX_WIDTH) -#define INSTR_BOX_X 27 -#define INSTR_BOX_Y 114 +#define INSTR_BOX_X 28 +#define INSTR_BOX_Y 135 static const uint8_t instruction_box[INSTR_BOX_SIZE] = { - 103, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,104, - 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, - 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, - 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, - 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, - 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, - 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, - 105, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,106 + 3, 21, 18, 19, 15, 18, 0, 0, 11, 5, 25, 19, + 19, 12, 9, 4, 5, 0, 0, 20, 9, 12, 5, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 17, 21, 1, 12, 19, 0, 13, 5, 18, 7, 5, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 18, 5, 1, 3, 8, 0, 0, 50, 48, 52, 56, 33 + }; @@ -143,22 +142,10 @@ void draw_game_background(uint16_t hi_score) { // Draw the high-score. This won't change at every turn, so makes sense to just draw once direct_draw_number(hi_score, HIGH_TEXT_WIDTH, HIGH_TEXT_X, HIGH_TEXT_Y, front_buf); -/* + // Draw instruction box - for(uint16_t tile = 0; tile < INSTR_BOX_SIZE; tile++) { - if(!instruction_box[tile]) continue; - - uint8_t x = tile % INSTR_BOX_WIDTH; - uint8_t y = tile / INSTR_BOX_WIDTH; - uint8_t invert = instruction_box[tile] & 0x80; - uint8_t ch_num = instruction_box[tile] & 0x7F; - - for(uint8_t row = 0; row < CHAR_HEIGHT; row++) { - uint16_t offset = line_offset_map[INSTR_BOX_Y + (y * CHAR_HEIGHT) + row] + INSTR_BOX_X + x; - front_buf[offset] = invert ? ((~CHARSET[(ch_num * CHAR_HEIGHT) + row]) & 0x7F) : CHARSET[(ch_num * CHAR_HEIGHT) + row]; - } - } -*/ + draw_graph_char_box(INSTR_BOX_X, INSTR_BOX_Y, INSTR_BOX_WIDTH, INSTR_BOX_HEIGHT, instruction_box, front_buf); + // Copy the data from display page 1 to 2 memcpy((void*)DISPLAY_PAGE_2, (void*)DISPLAY_PAGE_1, DISPLAY_PAGE_SIZE);