diff options
author | cflip <cflip@cflip.net> | 2022-03-03 20:30:10 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2022-03-03 20:30:10 -0700 |
commit | d198dd25af201aaacc7782f4bd36d2cfa5f0c05b (patch) | |
tree | 541fec3336c5090d8be8390ddae8fb47002df3b1 /src/level.h | |
parent | 4ccfcb2c394b1e2b9e0e521c713444c952b91edf (diff) |
Keep list of all vehicles in Level class
Newly created vehicles are now to be added to the Level, which
automatically updates and renders them. This infrastructure will
be needed for depth sorting and eventually level saving.
Diffstat (limited to 'src/level.h')
-rw-r--r-- | src/level.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/level.h b/src/level.h index 897daa5..e915da3 100644 --- a/src/level.h +++ b/src/level.h @@ -3,6 +3,9 @@ #include "bitmap.h" #include <cstdint> #include <cstring> +#include <vector> + +class Train; class Level { public: @@ -13,13 +16,18 @@ public: void set(int x, int y, uint8_t tile); bool inBounds(int x, int y) const { return x >= 0 && x < m_width && y >= 0 && y < m_height; } + void update(); void draw(Bitmap& bitmap, int xo, int yo); + + void addVehicle(Train&); void toggleTile(int x, int y); private: Bitmap& m_tileSprites; int m_width, m_height; uint8_t* m_tiles; + + std::vector<Train*> m_vehicles; }; enum RailDirection { |