diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/renderer.cpp | 30 | ||||
| -rw-r--r-- | src/renderer.h | 1 |
2 files changed, 18 insertions, 13 deletions
| diff --git a/src/renderer.cpp b/src/renderer.cpp index 0e77bb9..246b7fb 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp | |||
| @@ -230,28 +230,32 @@ void Renderer::render(Game& game) { | |||
| 230 | 230 | ||
| 231 | // 216, 138, 142 | 231 | // 216, 138, 142 |
| 232 | if (game.getSystem<MessageSystem>().isNextArrowShowing()) { | 232 | if (game.getSystem<MessageSystem>().isNextArrowShowing()) { |
| 233 | if (advMsgArrowTex_ == -1) { | ||
| 234 | advMsgArrowTex_ = loadImageFromFile("../res/advance_text_arrow.png"); | ||
| 235 | } | ||
| 236 | |||
| 237 | if (game.getSystem<MessageSystem>().isChoiceActive()) { | 233 | if (game.getSystem<MessageSystem>().isChoiceActive()) { |
| 234 | if (choiceArrowTex_ == -1) { | ||
| 235 | choiceArrowTex_ = loadImageFromFile("../res/select_choice_arrow.png"); | ||
| 236 | } | ||
| 237 | |||
| 238 | int selection = game.getSystem<MessageSystem>().getChoiceSelection(); | 238 | int selection = game.getSystem<MessageSystem>().getChoiceSelection(); |
| 239 | int charIndex = game.getSystem<MessageSystem>().getLines().back().choicePos[selection]; | 239 | int charIndex = game.getSystem<MessageSystem>().getLines().back().choicePos[selection]; |
| 240 | int baseX = messageLines_[1].charIndexToWidth[charIndex]; | 240 | int baseX = messageLines_[1].charIndexToWidth[charIndex]; |
| 241 | 241 | ||
| 242 | SDL_Rect destRect { | 242 | SDL_Rect destRect { |
| 243 | 18 + baseX - game.getSystem<MessageSystem>().getNextArrowBob()-16+3, | 243 | 18 + baseX - game.getSystem<MessageSystem>().getNextArrowBob()-8, |
| 244 | 141, | 244 | 144, |
| 245 | 16, | 245 | 8, |
| 246 | 16}; | 246 | 8 }; |
| 247 | 247 | ||
| 248 | SDL_RenderCopyEx(ren_.get(), textures_.at(advMsgArrowTex_).get(), nullptr, &destRect, -90, nullptr, SDL_FLIP_NONE); | 248 | SDL_RenderCopy(ren_.get(), textures_.at(choiceArrowTex_).get(), nullptr, &destRect); |
| 249 | } else { | 249 | } else { |
| 250 | if (advMsgArrowTex_ == -1) { | ||
| 251 | advMsgArrowTex_ = loadImageFromFile("../res/advance_text_arrow.png"); | ||
| 252 | } | ||
| 253 | |||
| 250 | SDL_Rect destRect { | 254 | SDL_Rect destRect { |
| 251 | 216, | 255 | 220, |
| 252 | 138 + game.getSystem<MessageSystem>().getNextArrowBob(), | 256 | 142 + game.getSystem<MessageSystem>().getNextArrowBob(), |
| 253 | 16, | 257 | 8, |
| 254 | 16 }; | 258 | 8 }; |
| 255 | 259 | ||
| 256 | SDL_RenderCopy(ren_.get(), textures_.at(advMsgArrowTex_).get(), nullptr, &destRect); | 260 | SDL_RenderCopy(ren_.get(), textures_.at(advMsgArrowTex_).get(), nullptr, &destRect); |
| 257 | } | 261 | } |
| diff --git a/src/renderer.h b/src/renderer.h index 6d512c2..1684a0c 100644 --- a/src/renderer.h +++ b/src/renderer.h | |||
| @@ -155,6 +155,7 @@ private: | |||
| 155 | int speakerHeaderTex_ = -1; | 155 | int speakerHeaderTex_ = -1; |
| 156 | MessageCache speakerHeaderLine_; | 156 | MessageCache speakerHeaderLine_; |
| 157 | int advMsgArrowTex_ = -1; | 157 | int advMsgArrowTex_ = -1; |
| 158 | int choiceArrowTex_ = -1; | ||
| 158 | }; | 159 | }; |
| 159 | 160 | ||
| 160 | #endif /* end of include guard: RENDERER_H_6A58EC30 */ | 161 | #endif /* end of include guard: RENDERER_H_6A58EC30 */ |
