From e5fc5bccff29bce3de09209707cf8dbe14a80b35 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 20 Mar 2022 20:14:46 -0400 Subject: control instructions --- src/renderer.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/renderer.cpp') diff --git a/src/renderer.cpp b/src/renderer.cpp index 5d6ac08..2fc6023 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -120,6 +120,7 @@ void Renderer::loadAllTextures() { loadTextureFromFile("lamp.png", lamp_); loadTextureFromFile("read_instruction.png", readInstruction_); loadTextureFromFile("menu.png", menuBg_); + loadTextureFromFile("help.png", help_); loadTextureFromFile("title0.png", titles_[0]); SDL_QueryTexture(titles_[0].get(), nullptr, nullptr, &titleWidths_[0], &titleHeights_[0]); @@ -424,7 +425,17 @@ void Renderer::renderGame( SDL_SetRenderDrawColor(ren_.get(), 0, 0, 0, 0); SDL_RenderClear(ren_.get()); - if (game.signInstructionState != SignInstructionState::Hidden) { + if (game.helpState == HelpState::FadeIn || game.helpState == HelpState::Hold || game.helpState == HelpState::FadeOut) { + int instOpacity = 255; + if (game.helpState == HelpState::FadeIn) { + instOpacity = game.helpProgress.getProgress(0, 255); + } else if (game.helpState == HelpState::FadeOut) { + instOpacity = game.helpProgress.getProgress(255, 0); + } + + SDL_SetTextureAlphaMod(help_.get(), instOpacity); + SDL_RenderCopy(ren_.get(), help_.get(), nullptr, nullptr); + } else if (game.signInstructionState != SignInstructionState::Hidden) { int instOpacity = 255; if (game.signInstructionState == SignInstructionState::FadingIn) { instOpacity = game.signFade.getProgress(0, 255); -- cgit 1.4.1