From ec511705ce96d80d4e2a36054769c211448e8ec8 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 11 Feb 2021 20:47:46 -0500 Subject: Added choice prompts "A presses" are also no longer special values in the lines list, but are rather a field on the MessageLine object. --- src/renderer.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src/renderer.cpp') 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) { } int lineIndex = 0; - for (const MessageSystem::MessageLine& line : game.getSystem().getLines()) { + for (const MessageLine& line : game.getSystem().getLines()) { if (messageLines_[lineIndex].line != line.text) { renderMessageLine(messageLines_[lineIndex], line.text, game); } @@ -223,13 +223,27 @@ void Renderer::render(Game& game) { advMsgArrowTex_ = loadImageFromFile("../res/advance_text_arrow.png"); } - SDL_Rect destRect { - 216, - 138 + game.getSystem().getNextArrowBob(), - 16, - 16 }; + if (game.getSystem().isChoiceActive()) { + int selection = game.getSystem().getChoiceSelection(); + int charIndex = game.getSystem().getLines().back().choicePos[selection]; + int baseX = messageLines_[1].charIndexToWidth[charIndex]; - SDL_RenderCopy(ren_.get(), textures_.at(advMsgArrowTex_).get(), nullptr, &destRect); + SDL_Rect destRect { + 18 + baseX - game.getSystem().getNextArrowBob()-16+3, + 141, + 16, + 16}; + + SDL_RenderCopyEx(ren_.get(), textures_.at(advMsgArrowTex_).get(), nullptr, &destRect, -90, nullptr, SDL_FLIP_NONE); + } else { + SDL_Rect destRect { + 216, + 138 + game.getSystem().getNextArrowBob(), + 16, + 16 }; + + SDL_RenderCopy(ren_.get(), textures_.at(advMsgArrowTex_).get(), nullptr, &destRect); + } } } } -- cgit 1.4.1