Modify popup message

This commit is contained in:
Miloslav Ciz 2025-03-06 20:47:15 +01:00
parent 398b9f4b99
commit 9b2fc5f14c
2 changed files with 18 additions and 8 deletions

View file

@ -40,12 +40,12 @@ static const char *LCR_texts[] =
"sound",
"save repl",
"exit",
#define LCR_TEXTS_LOADING 10
"loading",
#define LCR_TEXTS_SAVED 11
"saved"
"saved",
#define LCR_TEXTS_FAIL 12
"failed"
};
#define LCR_VERSION "0.1d"

20
game.h
View file

@ -1056,14 +1056,22 @@ void LCR_gameTimeToStr(uint32_t timeMS, char *str)
void LCR_gameDrawPopupMessage(void)
{
int textH = LCR_rendererComputeTextHeight(5);
int textW = LCR_rendererComputeTextWidth(LCR_game.popupStr,5);
#define TEXT_SIZE 5
#define OFFSET_V (LCR_EFFECTIVE_RESOLUTION_Y / 6)
#define TEXT_PAD (LCR_EFFECTIVE_RESOLUTION_Y / 64)
LCR_rendererDrawRect((LCR_EFFECTIVE_RESOLUTION_X - textW) / 2 - 6,4,
textW + 12,textH + 8,0xffff,1);
int textH = LCR_rendererComputeTextHeight(TEXT_SIZE);
int textW = LCR_rendererComputeTextWidth(LCR_game.popupStr,TEXT_SIZE);
LCR_rendererDrawRect((LCR_EFFECTIVE_RESOLUTION_X - textW - 2 * TEXT_PAD) / 2,
OFFSET_V,textW + 2 * TEXT_PAD,textH + 2 * TEXT_PAD,0xffff,1);
LCR_rendererDrawText(LCR_game.popupStr,(LCR_EFFECTIVE_RESOLUTION_X - textW)
/ 2,8,0x0300,5);
/ 2,OFFSET_V + TEXT_PAD,0x0300,TEXT_SIZE);
#undef TEXT_PAD
#undef OFFSET_V
#undef TEXT_SIZE
}
void LCR_gameDraw3DView(void)
@ -1343,6 +1351,8 @@ void LCR_gameHandleInput(void)
case 3:
if (LCR_game.statePrev == LCR_GAME_STATE_RUN_FINISHED)
LCR_gameSaveReplay();
else
LCR_gamePopupMessage(LCR_texts[LCR_TEXTS_FAIL]);
break;