diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-11 20:47:46 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-11 20:47:46 -0500 |
commit | ec511705ce96d80d4e2a36054769c211448e8ec8 (patch) | |
tree | e0a70671430a84472024d54b934df3248924ec4d /src/renderer.cpp | |
parent | d9be54853910c2086013846661e0dc4a8603c20e (diff) | |
download | tanetane-ec511705ce96d80d4e2a36054769c211448e8ec8.tar.gz tanetane-ec511705ce96d80d4e2a36054769c211448e8ec8.tar.bz2 tanetane-ec511705ce96d80d4e2a36054769c211448e8ec8.zip |
Added choice prompts
"A presses" are also no longer special values in the lines list, but are rather a field on the MessageLine object.
Diffstat (limited to 'src/renderer.cpp')
-rw-r--r-- | src/renderer.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/renderer.cpp b/src/renderer.cpp index db5daed..0c70ef5 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp | |||
@@ -194,7 +194,7 @@ void Renderer::render(Game& game) { | |||
194 | } | 194 | } |
195 | 195 | ||
196 | int lineIndex = 0; | 196 | int lineIndex = 0; |
197 | for (const MessageSystem::MessageLine& line : game.getSystem<MessageSystem>().getLines()) { | 197 | for (const MessageLine& line : game.getSystem<MessageSystem>().getLines()) { |
198 | if (messageLines_[lineIndex].line != line.text) { | 198 | if (messageLines_[lineIndex].line != line.text) { |
199 | renderMessageLine(messageLines_[lineIndex], line.text, game); | 199 | renderMessageLine(messageLines_[lineIndex], line.text, game); |
200 | } | 200 | } |
@@ -223,13 +223,27 @@ void Renderer::render(Game& game) { | |||
223 | advMsgArrowTex_ = loadImageFromFile("../res/advance_text_arrow.png"); | 223 | advMsgArrowTex_ = loadImageFromFile("../res/advance_text_arrow.png"); |
224 | } | 224 | } |
225 | 225 | ||
226 | SDL_Rect destRect { | 226 | if (game.getSystem<MessageSystem>().isChoiceActive()) { |
227 | 216, | 227 | int selection = game.getSystem<MessageSystem>().getChoiceSelection(); |
228 | 138 + game.getSystem<MessageSystem>().getNextArrowBob(), | 228 | int charIndex = game.getSystem<MessageSystem>().getLines().back().choicePos[selection]; |
229 | 16, | 229 | int baseX = messageLines_[1].charIndexToWidth[charIndex]; |
230 | 16 }; | ||
231 | 230 | ||
232 | SDL_RenderCopy(ren_.get(), textures_.at(advMsgArrowTex_).get(), nullptr, &destRect); | 231 | SDL_Rect destRect { |
232 | 18 + baseX - game.getSystem<MessageSystem>().getNextArrowBob()-16+3, | ||
233 | 141, | ||
234 | 16, | ||
235 | 16}; | ||
236 | |||
237 | SDL_RenderCopyEx(ren_.get(), textures_.at(advMsgArrowTex_).get(), nullptr, &destRect, -90, nullptr, SDL_FLIP_NONE); | ||
238 | } else { | ||
239 | SDL_Rect destRect { | ||
240 | 216, | ||
241 | 138 + game.getSystem<MessageSystem>().getNextArrowBob(), | ||
242 | 16, | ||
243 | 16 }; | ||
244 | |||
245 | SDL_RenderCopy(ren_.get(), textures_.at(advMsgArrowTex_).get(), nullptr, &destRect); | ||
246 | } | ||
233 | } | 247 | } |
234 | } | 248 | } |
235 | } | 249 | } |