Rework menu a bit
This commit is contained in:
parent
1efeee9c36
commit
c017297e06
2 changed files with 71 additions and 27 deletions
12
renderer.h
12
renderer.h
|
@ -1705,8 +1705,8 @@ void LCR_rendererBlitImage(uint8_t index, unsigned int x, unsigned int y,
|
|||
}
|
||||
}
|
||||
|
||||
void LCR_rendererDrawMenu(const char **items, unsigned char itemCount,
|
||||
char selectedItem)
|
||||
void LCR_rendererDrawMenu(const char *tabName,const char **items,
|
||||
unsigned char itemCount,char selectedItem)
|
||||
{
|
||||
int stripHeight = LCR_EFFECTIVE_RESOLUTION_Y / 4;
|
||||
int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 10;
|
||||
|
@ -1750,16 +1750,18 @@ void LCR_rendererDrawMenu(const char **items, unsigned char itemCount,
|
|||
i = stripHeight +
|
||||
(stripHeight2 - LCR_rendererComputeTextHeight(3)) / 2;
|
||||
|
||||
for (int j = 0; j < itemCount; ++j)
|
||||
for (int j = 0; j < itemCount + 1; ++j)
|
||||
{
|
||||
const char *s = j ? items[j - 1] : tabName;
|
||||
|
||||
if (j == selectedItem + 1)
|
||||
for (int y = i - 10; y < i + LCR_rendererComputeTextHeight(3) + 10; ++y)
|
||||
for (int x = LCR_EFFECTIVE_RESOLUTION_X / 4;
|
||||
x < LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4; ++x)
|
||||
LCR_drawPixelXYSafe(x,y,0x5c1b + 4 * ((x & 0x10) == (y & 0x10)));
|
||||
|
||||
LCR_rendererDrawText(items[j],(LCR_EFFECTIVE_RESOLUTION_X -
|
||||
LCR_rendererComputeTextWidth(items[j],3)) / 2,i,0xffff,3);
|
||||
LCR_rendererDrawText(s,(LCR_EFFECTIVE_RESOLUTION_X -
|
||||
LCR_rendererComputeTextWidth(s,3)) / 2,i,0xffff,3);
|
||||
|
||||
if (j == 0)
|
||||
i = stripHeight + stripHeight2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue