Improve menu

This commit is contained in:
Miloslav Číž 2020-09-24 15:57:09 +02:00
parent c762a09909
commit 5d3965772b
3 changed files with 19 additions and 1 deletions

11
game.h
View File

@ -4133,7 +4133,8 @@ void SFG_drawMenu()
#define SCROLL_PIXELS_PER_FRAME 1
#endif
#define SELECTION_START_X (SFG_GAME_RESOLUTION_X / 5)
#define SELECTION_START_X ((SFG_GAME_RESOLUTION_X - 12 * SFG_FONT_SIZE_MEDIUM\
* (SFG_FONT_CHARACTER_SIZE + 1)) / 2)
uint16_t scroll = (SFG_game.frame * SCROLL_PIXELS_PER_FRAME) / 64;
@ -4161,6 +4162,14 @@ void SFG_drawMenu()
if (item == SFG_MENU_ITEM_NONE)
break;
#if SFG_SIMPLE_MENU
if (i != SFG_game.selectedMenuItem)
{
i++;
continue;
}
#endif
const char *text = SFG_menuItemTexts[item];
uint8_t textLen = SFG_textLen(text);

View File

@ -26,6 +26,7 @@
#define SFG_RAYCASTING_MAX_STEPS 20
#define SFG_RAYCASTING_MAX_HITS 5
#define SFG_RAYCASTING_SUBSAMPLE 2
#define SFG_SIMPLE_MENU 1
#define SFG_DITHERED_SHADOW 0

View File

@ -340,6 +340,14 @@
#define SFG_ARDUINO 0
#endif
/**
If set, the menu will only display the selected item. This is good for very
small resolution screens that can't display all items at once.
*/
#ifndef SFG_SIMPLE_MENU
#define SFG_SIMPLE_MENU 0
#endif
//------ developer/debug settings ------
/**