Start menu
This commit is contained in:
parent
d27bc59742
commit
a5325cece6
2 changed files with 69 additions and 2 deletions
15
game.h
15
game.h
|
@ -641,8 +641,19 @@ uint8_t LCR_gameStep(uint32_t time)
|
|||
|
||||
while (time >= LCR_game.nextRenderFrameTime)
|
||||
LCR_game.nextRenderFrameTime += 1000 / LCR_SETTING_FPS;
|
||||
|
||||
LCR_gameDraw3DView();
|
||||
|
||||
if (LCR_game.state == LCR_GAME_STATE_MENU)
|
||||
{
|
||||
|
||||
const char *aaa[] =
|
||||
{
|
||||
"menu","absa","sasas","sasqw"
|
||||
};
|
||||
|
||||
LCR_rendererDrawMenu(aaa,4,2);
|
||||
}
|
||||
else
|
||||
LCR_gameDraw3DView();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
56
renderer.h
56
renderer.h
|
@ -1676,6 +1676,62 @@ void LCR_rendererCameraFollow(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void LCR_rendererDrawMenu(const char **items, unsigned char itemCount,
|
||||
char selectedItem)
|
||||
{
|
||||
int stripHeight = LCR_EFFECTIVE_RESOLUTION_Y / 5;
|
||||
int stripHeight2 = LCR_EFFECTIVE_RESOLUTION_Y / 8;
|
||||
|
||||
int i = 0;
|
||||
|
||||
while (i < stripHeight * LCR_EFFECTIVE_RESOLUTION_X)
|
||||
{
|
||||
LCR_drawPixel(i,0x8ddc);
|
||||
++i;
|
||||
}
|
||||
|
||||
for (int y = 0; y < stripHeight2; ++y) // strip with arrows
|
||||
{
|
||||
int limit = y > stripHeight2 / 2 ?
|
||||
(stripHeight2 / 2 - y) : (y - stripHeight2 / 2);
|
||||
|
||||
|
||||
for (int x = 0; x < LCR_EFFECTIVE_RESOLUTION_X; ++x)
|
||||
{
|
||||
LCR_drawPixel(i,(x > LCR_EFFECTIVE_RESOLUTION_X / 4 - limit &&
|
||||
x < LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4 + limit)
|
||||
? 0x73ae : 0x31a6);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
while (i < LCR_EFFECTIVE_RESOLUTION_Y * LCR_EFFECTIVE_RESOLUTION_X)
|
||||
{
|
||||
LCR_drawPixel(i,0xbdf7);
|
||||
++i;
|
||||
}
|
||||
|
||||
i = stripHeight +
|
||||
(stripHeight2 - LCR_rendererComputeTextHeight(4)) / 2;
|
||||
|
||||
for (int j = 0; j < itemCount; ++j)
|
||||
{
|
||||
if (j == selectedItem)
|
||||
for (int y = i - 10; y < i + LCR_rendererComputeTextHeight(4) + 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);
|
||||
|
||||
LCR_rendererDrawText(items[j],(LCR_EFFECTIVE_RESOLUTION_X -
|
||||
LCR_rendererComputeTextWidth(items[j],4)) / 2,i,0xffff,4);
|
||||
|
||||
if (j == 0)
|
||||
i = stripHeight + stripHeight2;
|
||||
|
||||
i += LCR_rendererComputeTextHeight(7);
|
||||
}
|
||||
}
|
||||
|
||||
void LCR_rendererCameraReset(void)
|
||||
{
|
||||
LCR_renderer.scene.camera.transform.translation =
|
||||
|
|
Loading…
Reference in a new issue