From 5e37c9a7034edfc4eec4d4ed15224b0f63c736af Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 21 Mar 2022 10:40:31 -0400 Subject: fancier textboxes --- src/renderer.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/renderer.cpp') diff --git a/src/renderer.cpp b/src/renderer.cpp index 2fc6023..afc022e 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -121,6 +121,8 @@ void Renderer::loadAllTextures() { loadTextureFromFile("read_instruction.png", readInstruction_); loadTextureFromFile("menu.png", menuBg_); loadTextureFromFile("help.png", help_); + loadTextureFromFile("message.png", messageBg_); + loadTextureFromFile("feather.png", feather_); loadTextureFromFile("title0.png", titles_[0]); SDL_QueryTexture(titles_[0].get(), nullptr, nullptr, &titleWidths_[0], &titleHeights_[0]); @@ -455,16 +457,8 @@ void Renderer::renderGame( opacity = game.sign.signDisplayFade.getProgress(255, 0); } - SDL_Rect signRect { - 0, - GAME_HEIGHT / 2 - (45 * 2 + 1 + MESSAGE_MARGIN * 2) / 2, - GAME_WIDTH, - 45 * 2 + 1 + MESSAGE_MARGIN * 2 - }; - - SDL_SetRenderDrawBlendMode(ren_.get(), SDL_BLENDMODE_BLEND); - SDL_SetRenderDrawColor(ren_.get(), 0, 0, 0, opacity); - SDL_RenderFillRect(ren_.get(), &signRect); + SDL_SetTextureAlphaMod(messageBg_.get(), opacity); + SDL_RenderCopy(ren_.get(), messageBg_.get(), nullptr, nullptr); if (game.sign.signDisplayState == SignInstructionState::Visible) { int lineIndex = 0; @@ -493,6 +487,17 @@ void Renderer::renderGame( lineIndex++; } + + if (game.sign.showNextArrow) { + SDL_Rect destRect { + GAME_WIDTH - MESSAGE_MARGIN - 32, + GAME_HEIGHT / 2 + (45 + 1 + MESSAGE_MARGIN) / 2 + game.sign.nextArrowBobPos - 32, + 64, + 64 }; + + SDL_SetRenderTarget(ren_.get(), overlays.get()); + SDL_RenderCopy(ren_.get(), feather_.get(), nullptr, &destRect); + } } } -- cgit 1.4.1