diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-03 01:35:58 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-03 01:35:58 -0500 |
| commit | be09120d1d044b476ef8b516efbdb526f20d9e2d (patch) | |
| tree | f935389835d5f94a9cd3bb2059cf55174c9aad69 /src/game.h | |
| parent | 24918837c3ff9026d228657d14852c9cf39a5644 (diff) | |
| download | tanetane-be09120d1d044b476ef8b516efbdb526f20d9e2d.tar.gz tanetane-be09120d1d044b476ef8b516efbdb526f20d9e2d.tar.bz2 tanetane-be09120d1d044b476ef8b516efbdb526f20d9e2d.zip | |
Added animation system
Diffstat (limited to 'src/game.h')
| -rw-r--r-- | src/game.h | 18 |
1 files changed, 5 insertions, 13 deletions
| diff --git a/src/game.h b/src/game.h index f89c707..f8e4b0d 100644 --- a/src/game.h +++ b/src/game.h | |||
| @@ -38,7 +38,7 @@ public: | |||
| 38 | }); | 38 | }); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | int addSprite(Sprite sprite); | 41 | int emplaceSprite(); |
| 42 | 42 | ||
| 43 | const Sprite& getSprite(int id) const { | 43 | const Sprite& getSprite(int id) const { |
| 44 | return sprites_.at(id); | 44 | return sprites_.at(id); |
| @@ -58,18 +58,10 @@ public: | |||
| 58 | }); | 58 | }); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | void setSpriteState(int id, std::string state) { | 61 | auto spriteView() { |
| 62 | sprites_[id].setState(std::move(state)); | 62 | return ranges::views::transform([&] (int id) -> Sprite& { |
| 63 | } | 63 | return sprites_.at(id); |
| 64 | 64 | }); | |
| 65 | void setSpriteDirection(int id, Direction dir) { | ||
| 66 | sprites_[id].setDirection(dir); | ||
| 67 | } | ||
| 68 | |||
| 69 | void tickSpriteAnim() { | ||
| 70 | for (Sprite& sprite : sprites_) { | ||
| 71 | sprite.tickAnim(); | ||
| 72 | } | ||
| 73 | } | 65 | } |
| 74 | 66 | ||
| 75 | void setMap(std::unique_ptr<Map> map) { map_ = std::move(map); } | 67 | void setMap(std::unique_ptr<Map> map) { map_ = std::move(map); } |
