A 2D tile-based sandbox game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WorldPlane.h 633B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include <vector>
  3. #include <utility>
  4. #include <memory>
  5. #include "common.h"
  6. #include "Chunk.h"
  7. #include "Tile.h"
  8. #include "TileMap.h"
  9. #include "WorldGen.h"
  10. namespace Swan {
  11. class World;
  12. class WorldPlane {
  13. public:
  14. using ID = uint16_t;
  15. std::map<Chunk::ChunkPos, Chunk> chunks_;
  16. ID id_;
  17. World *world_;
  18. std::shared_ptr<WorldGen> gen_;
  19. WorldPlane(ID id, World *world, std::shared_ptr<WorldGen> gen):
  20. id_(id), world_(world), gen_(gen) {}
  21. Chunk &getChunk(int x, int y);
  22. void setTileID(int x, int y, Tile::ID id);
  23. Tile &getTile(int x, int y);
  24. void draw(Win &win);
  25. void update(float dt);
  26. void tick();
  27. };
  28. }