diff options
Diffstat (limited to 'src/renderer.cpp')
-rw-r--r-- | src/renderer.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/renderer.cpp b/src/renderer.cpp index 246b7fb..f07931b 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp | |||
@@ -122,8 +122,14 @@ void Renderer::render(Game& game) { | |||
122 | 122 | ||
123 | SDL_RenderCopy(ren_.get(), renLay1_.get(), nullptr, nullptr); | 123 | SDL_RenderCopy(ren_.get(), renLay1_.get(), nullptr, nullptr); |
124 | 124 | ||
125 | int shadowTexId = loadImageFromFile("../res/shadow.png"); | ||
125 | for (const Sprite& sprite : game.getSystem<TransformSystem>().getSpritesByY() | game.spriteView()) { | 126 | for (const Sprite& sprite : game.getSystem<TransformSystem>().getSpritesByY() | game.spriteView()) { |
126 | if (sprite.isAnimated) { | 127 | if (sprite.isAnimated) { |
128 | if (sprite.hasShadow) { | ||
129 | const SDL_Rect shadowDest { sprite.loc.x() - 8, sprite.loc.y() - 8, 16, 8 }; | ||
130 | SDL_RenderCopy(ren_.get(), textures_.at(shadowTexId).get(), nullptr, &shadowDest); | ||
131 | } | ||
132 | |||
127 | const SpriteFrame& frame = sprite.frames.at(sprite.animations.at(sprite.animationId).at(sprite.animationFrame)); | 133 | const SpriteFrame& frame = sprite.frames.at(sprite.animations.at(sprite.animationId).at(sprite.animationFrame)); |
128 | const SDL_Rect& src = frame.srcRect; | 134 | const SDL_Rect& src = frame.srcRect; |
129 | SDL_Rect dest { sprite.loc.x() - frame.center.x(), sprite.loc.y() - frame.center.y(), frame.size.w(), frame.size.h() }; | 135 | SDL_Rect dest { sprite.loc.x() - frame.center.x(), sprite.loc.y() - frame.center.y(), frame.size.w(), frame.size.h() }; |