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.

WorldGen.h 670B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <memory>
  3. #include <SDL.h>
  4. #include <cygnet/util.h>
  5. #include "common.h"
  6. #include "Chunk.h"
  7. #include "Entity.h"
  8. #include "Collection.h"
  9. #include "traits/BodyTrait.h"
  10. namespace Swan {
  11. class World;
  12. class WorldPlane;
  13. class WorldGen {
  14. public:
  15. struct Factory {
  16. const std::string name;
  17. std::unique_ptr<WorldGen> (*const create)(World &world);
  18. };
  19. virtual ~WorldGen() = default;
  20. virtual void drawBackground(const Context &ctx, Cygnet::Renderer &rnd, Vec2 pos) = 0;
  21. virtual Cygnet::Color backgroundColor(Vec2 pos) = 0;
  22. virtual void genChunk(WorldPlane &plane, Chunk &chunk) = 0;
  23. virtual EntityRef spawnPlayer(const Context &ctx) = 0;
  24. };
  25. }