Skip to content

Commit 566d88f

Browse files
committed
Tue May 19 16:49:28 EDT 2020 - added new icons for hud
1 parent ca6c77e commit 566d88f

File tree

1 file changed

+34
-17
lines changed

1 file changed

+34
-17
lines changed

Components/retro-go/components/odroid/odroid_hud.c

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,23 @@
7979
int action;
8080
int offset;
8181
} STATES;
82-
STATES WITHSAVE[6] = {
82+
STATES WITHSAVE[5] = {
8383
{"Resume Game",0, 0},
8484
{"Restart Game",1, 10},
8585
{"Reload Game",2, 5},
8686
{"Overwrite Game",4, 25},
87-
{"Delete Save",5, 15},
88-
{"Exit Game",6, 20}
87+
{"Delete Save",5, 15}
8988
};
90-
STATES WITHOUTSAVE[4] = {
89+
STATES WITHOUTSAVE[3] = {
9190
{"Resume Game",0, 0},
9291
{"Restart Game",1, 10},
93-
{"Save Game",3, 25},
94-
{"Exit Game",6, 20}
92+
{"Save Game",3, 25}
9593
};
94+
STATES EXTRAS[3] = {
95+
{"Volume",6, 0},
96+
{"Brightness",6, 10},
97+
{"Quit Game",6, 25}
98+
};
9699
STATES STATE;
97100

98101
// THEME
@@ -176,7 +179,6 @@ const uint16_t FONT_5x7[7][250] = {
176179
{65535,0,65535,65535,65535},
177180
{65535,0,0,0,65535},
178181
{0,65535,65535,65535,0},
179-
180182
};
181183

182184
const uint16_t logo[12][64] = {
@@ -280,7 +282,7 @@ const uint16_t FONT_5x7[7][250] = {
280282
gets(tmp);
281283
if(strcmp(save_name, tmp) == 0) {
282284
SAVED = true;
283-
printf("\n******\nfile_to_delete:%s\nsave_name:%s\ntmp%s\n******\n", file_to_delete, save_name, tmp);
285+
//printf("\n******\nfile_to_delete:%s\nsave_name:%s\ntmp%s\n******\n", file_to_delete, save_name, tmp);
284286
hud_delete_save(file_to_delete);
285287
}
286288
}
@@ -410,32 +412,47 @@ const uint16_t FONT_5x7[7][250] = {
410412
h = 5;
411413
i = 0;
412414
int n;
413-
if(OPTIONS == 6) {
414-
for(n = 0; n < OPTIONS; n++) {
415+
if(OPTIONS == 8) {
416+
for(n = 0; n < 5; n++) {
415417
STATE = WITHSAVE[n];
416418
y+=20;
417419
for(int r = 0; r < 5; r++){for(int c = 0; c < 5; c++) {
418420
buffer[i] = icons[r+STATE.offset][c] == WHITE ? OPTION == n ? GUI.hl : GUI.fg : GUI.bg;i++;
419421
}}
420-
if(n == OPTIONS-1) {y = 216;}
421422
ili9341_write_frame_rectangleLE(x, y, w, h, buffer);
422423
hud_text(x+10,y,STATE.label,false,OPTION == n?true:false);
423424
i = 0;
424425
}
425-
STATE = WITHSAVE[OPTION];
426426
} else {
427-
for(n = 0; n < OPTIONS; n++) {
427+
for(n = 0; n < 3; n++) {
428428
STATE = WITHOUTSAVE[n];
429429
y+=20;
430430
for(int r = 0; r < 5; r++){for(int c = 0; c < 5; c++) {
431431
buffer[i] = icons[r+STATE.offset][c] == WHITE ? OPTION == n ? GUI.hl : GUI.fg : GUI.bg;i++;
432432
}}
433-
if(n == OPTIONS-1) {y = 216;}
434433
ili9341_write_frame_rectangleLE(x, y, w, h, buffer);
435434
hud_text(x+10,y,STATE.label,false,OPTION == n?true:false);
436435
i = 0;
437436
}
438-
STATE = WITHOUTSAVE[OPTION];
437+
}
438+
439+
y=156;
440+
for(n = 0; n < 3; n++) {
441+
STATE = EXTRAS[n];
442+
y+=20;
443+
for(int r = 0; r < 5; r++){for(int c = 0; c < 5; c++) {
444+
buffer[i] = icons[r+STATE.offset][c] == WHITE ? OPTION == (n+OPTIONS-2) ? GUI.hl : GUI.fg : GUI.bg;i++;
445+
}}
446+
ili9341_write_frame_rectangleLE(x, y, w, h, buffer);
447+
hud_text(x+10,y,STATE.label,false,OPTION == (n+OPTIONS-2)?true:false);
448+
i = 0;
449+
}
450+
451+
int LIMIT = OPTIONS - 3;
452+
if(OPTION < LIMIT) {
453+
STATE = OPTIONS == 8 ? WITHSAVE[OPTION] : WITHOUTSAVE[OPTION];
454+
} else {
455+
STATE = EXTRAS[OPTION-LIMIT];
439456
}
440457
}
441458
//}#pragma endregion Display
@@ -447,10 +464,10 @@ const uint16_t FONT_5x7[7][250] = {
447464
buffer = (uint16_t *)malloc(size);
448465
if (!buffer) abort();
449466
OPTION = 0;
450-
OPTIONS = SAVED ? 6 : 4;
467+
OPTIONS = SAVED ? 8 : 6;
451468
hud_theme();
452469
GUI = THEMES[USER];
453-
STATE = OPTIONS == 6 ? WITHSAVE[OPTION] : WITHOUTSAVE[OPTION];
470+
STATE = OPTIONS == 8 ? WITHSAVE[OPTION] : WITHOUTSAVE[OPTION];
454471
INIT = true;
455472
}
456473
}

0 commit comments

Comments
 (0)