diff --git a/assets.h b/assets.h index 2d6591e..33d52ed 100644 --- a/assets.h +++ b/assets.h @@ -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" diff --git a/game.h b/game.h index 52ee244..b00e9e1 100644 --- a/game.h +++ b/game.h @@ -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;