diff options
Diffstat (limited to 'src/renderer.cpp')
-rw-r--r-- | src/renderer.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/renderer.cpp b/src/renderer.cpp index befad8a..2be36ae 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp | |||
@@ -109,6 +109,7 @@ Renderer::Renderer() | |||
109 | loadTextureFromFile("../res/player.png", playerSheet_); | 109 | loadTextureFromFile("../res/player.png", playerSheet_); |
110 | loadTextureFromFile("../res/runninbloods.png", tileset_); | 110 | loadTextureFromFile("../res/runninbloods.png", tileset_); |
111 | loadTextureFromFile("../res/lamp.png", lamp_); | 111 | loadTextureFromFile("../res/lamp.png", lamp_); |
112 | loadTextureFromFile("../res/read_instruction.png", readInstruction_); | ||
112 | 113 | ||
113 | loadTextureFromFile("../res/title0.png", titles_[0]); | 114 | loadTextureFromFile("../res/title0.png", titles_[0]); |
114 | SDL_QueryTexture(titles_[0].get(), nullptr, nullptr, &titleWidths_[0], &titleHeights_[0]); | 115 | SDL_QueryTexture(titles_[0].get(), nullptr, nullptr, &titleWidths_[0], &titleHeights_[0]); |
@@ -171,14 +172,14 @@ void Renderer::renderGame( | |||
171 | SDL_RenderCopy(ren_.get(), tileset_.get(), &tileRect, &rect); | 172 | SDL_RenderCopy(ren_.get(), tileset_.get(), &tileRect, &rect); |
172 | 173 | ||
173 | if (game.map.at(x,y).renderId != -1) { | 174 | if (game.map.at(x,y).renderId != -1) { |
174 | tileRect.x = game.map.at(x,y).renderId % 24 * 16; | 175 | tileRect.x = game.map.at(x,y).renderId % 25 * 16; |
175 | tileRect.y = game.map.at(x,y).renderId / 24 * 16; | 176 | tileRect.y = game.map.at(x,y).renderId / 25 * 16; |
176 | SDL_RenderCopy(ren_.get(), tileset_.get(), &tileRect, &rect); | 177 | SDL_RenderCopy(ren_.get(), tileset_.get(), &tileRect, &rect); |
177 | } | 178 | } |
178 | } else { | 179 | } else { |
179 | SDL_Rect tileRect { | 180 | SDL_Rect tileRect { |
180 | game.map.at(x,y).renderId % 24 * 16, | 181 | game.map.at(x,y).renderId % 25 * 16, |
181 | game.map.at(x,y).renderId / 24 * 16, | 182 | game.map.at(x,y).renderId / 25 * 16, |
182 | 16, | 183 | 16, |
183 | 16}; | 184 | 16}; |
184 | 185 | ||
@@ -375,6 +376,19 @@ void Renderer::renderGame( | |||
375 | } | 376 | } |
376 | 377 | ||
377 | SDL_RenderCopy(ren_.get(), canvas.get(), &zoomRect, nullptr); | 378 | SDL_RenderCopy(ren_.get(), canvas.get(), &zoomRect, nullptr); |
379 | |||
380 | if (game.signInstructionState != SignInstructionState::Hidden) { | ||
381 | int instOpacity = 255; | ||
382 | if (game.signInstructionState == SignInstructionState::FadingIn) { | ||
383 | instOpacity = game.signFade.getProgress(0, 255); | ||
384 | } else if (game.signInstructionState == SignInstructionState::FadingOut) { | ||
385 | instOpacity = game.signFade.getProgress(255, 0); | ||
386 | } | ||
387 | |||
388 | SDL_SetTextureAlphaMod(readInstruction_.get(), instOpacity); | ||
389 | SDL_RenderCopy(ren_.get(), readInstruction_.get(), nullptr, nullptr); | ||
390 | } | ||
391 | |||
378 | SDL_RenderPresent(ren_.get()); | 392 | SDL_RenderPresent(ren_.get()); |
379 | } | 393 | } |
380 | 394 | ||