From 19be2ac58b09c5240a32e6a4f41cd9f6cda03d07 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 12 Feb 2021 00:14:38 -0500 Subject: Added message bullets --- src/renderer.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'src/renderer.cpp') diff --git a/src/renderer.cpp b/src/renderer.cpp index 0c70ef5..0e77bb9 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -201,17 +201,28 @@ void Renderer::render(Game& game) { // 18x, 127y1, 143y2 if (line.charsRevealed > 0) { - SDL_Rect srcRect { - 0, 0, messageLines_[lineIndex].charIndexToWidth[line.charsRevealed], - game.getFont().getCharacterHeight() - }; - SDL_Rect destRect { - 18, - 127 + 16 * lineIndex, - srcRect.w, - srcRect.h }; - - SDL_RenderCopy(ren_.get(), messageLines_[lineIndex].renderedTex.get(), &srcRect, &destRect); + { + SDL_Rect srcRect { + 0, 0, messageLines_[lineIndex].charIndexToWidth[line.charsRevealed], + game.getFont().getCharacterHeight() + }; + SDL_Rect destRect { + 18, + 127 + 16 * lineIndex, + srcRect.w, + srcRect.h }; + + SDL_RenderCopy(ren_.get(), messageLines_[lineIndex].renderedTex.get(), &srcRect, &destRect); + } + + if (line.bulleted) { + vec2i charLoc = game.getFont().getCharacterLocation('^'); + vec2i charSize = game.getFont().getCharacterSize('^'); + SDL_Rect srcRect { charLoc.x(), charLoc.y(), charSize.w(), charSize.h() }; + SDL_Rect destRect { 13, 127 + 16 * lineIndex, charSize.w(), charSize.h() }; + + SDL_RenderCopy(ren_.get(), textures_.at(game.getFont().getTextureId()).get(), &srcRect, &destRect); + } } lineIndex++; -- cgit 1.4.1