mirror of
https://codeberg.org/hkzlab/TK2048.git
synced 2025-12-29 15:32:16 +11:00
Draw endgame box
This commit is contained in:
parent
f18b23b08a
commit
fb6463dd40
6 changed files with 69 additions and 5 deletions
16
src/main.c
16
src/main.c
|
|
@ -25,6 +25,7 @@
|
|||
#define WIN_SCORE_BONUS 10000
|
||||
|
||||
void init(void);
|
||||
void clear_display(void);
|
||||
|
||||
// Low level initialization
|
||||
void init(void) {
|
||||
|
|
@ -35,6 +36,10 @@ void init(void) {
|
|||
PEEK(IO_DISPLAY_PAGE1); // Select the first display page
|
||||
|
||||
// Clear display memory
|
||||
clear_display();
|
||||
}
|
||||
|
||||
void clear_display(void) {
|
||||
memset((void*)DISPLAY_PAGE_1, 0, DISPLAY_PAGE_SIZE);
|
||||
memset((void*)DISPLAY_PAGE_2, 0, DISPLAY_PAGE_SIZE);
|
||||
}
|
||||
|
|
@ -52,10 +57,19 @@ __task int main(void) {
|
|||
|
||||
// Check if we have a new high-score
|
||||
if (score > hi_score) hi_score = score;
|
||||
|
||||
// TODO: Draw a screen and wait for a key press here here
|
||||
BELL1();
|
||||
ddraw_endgame_box(done, score, hi_score);
|
||||
while(!read_any_key()) {
|
||||
lfsr_update();
|
||||
}
|
||||
BELL1();
|
||||
clear_display(); // Clear display again
|
||||
|
||||
// Reset the game, calculate the initial score depending on which tiles we randomly get
|
||||
score = reset_game();
|
||||
|
||||
|
||||
// Draw the initial state of the game
|
||||
draw_game_background();
|
||||
draw_number(moves_count, MOVES_TEXT_WIDTH, MOVES_TEXT_X, MOVES_TEXT_Y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue