summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-12 19:07:24 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-12 19:07:24 -0500
commit560ac0c3f5fc561a3db490d8f4a33c3e19296083 (patch)
tree9d86782c6d205a9c9e181cee6d2c104c69438092 /src
parent303b3fae53227446f683909bbf13edc6b2f1450b (diff)
downloadtanetane-560ac0c3f5fc561a3db490d8f4a33c3e19296083.tar.gz
tanetane-560ac0c3f5fc561a3db490d8f4a33c3e19296083.tar.bz2
tanetane-560ac0c3f5fc561a3db490d8f4a33c3e19296083.zip
Got correct sprites for message arrows
Diffstat (limited to 'src')
-rw-r--r--src/renderer.cpp30
-rw-r--r--src/renderer.h1
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 */