From 470b1d43fb6f8e17624ee90f87270de5bd6ff77e Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 13 Feb 2021 20:50:21 -0500 Subject: Added lightning sprite to mailbox event Sprites can be destroyed now, which really just means that their index is removed from the list of active sprites. The actual memory is not freed until all sprites are deleted on map change. Sprite layers are introduced. All sprites by default are on layer 0 (Normal) which renders them in between the lower and upper map layers. There is also a layer 1 (Above) that renders above the upper map layer, and the sprite for the lightning strike uses this layer in order to not be hidden by the trees. Fixed a bug where waiting for the end of a non-looping animation would trip the flag immediately upon the final frame activating, instead of waiting the length of the last frame. --- src/renderer.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/renderer.h') diff --git a/src/renderer.h b/src/renderer.h index 1684a0c..54dae1c 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -11,6 +11,7 @@ class Game; class Map; +class Sprite; class sdl_error : public std::logic_error { public: @@ -133,6 +134,9 @@ private: std::vector textures_; std::map filenameToTexId_; + // Sprite rendering + void renderSprite(const Sprite& sprite); + // Map rendering texture_ptr renderMapLayer(const Map& map, int layer); -- cgit 1.4.1