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.

Mod.h 808B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <stdint.h>
  3. #include <string>
  4. #include <vector>
  5. #include <memory>
  6. #include "Tile.h"
  7. #include "WorldGen.h"
  8. #include "Entity.h"
  9. #include "Asset.h"
  10. namespace Swan {
  11. class Mod {
  12. public:
  13. using ModID = uint32_t;
  14. void init(const std::string &name);
  15. void registerTile(const std::string &name, Tile *tile);
  16. void registerWorldGen(const std::string &name, WorldGen::Factory *gen);
  17. void registerEntity(const std::string &name, Entity::Factory *ent);
  18. void registerAsset(const std::string &name, Asset *asset);
  19. std::string name_;
  20. std::string path_;
  21. std::vector<std::shared_ptr<Tile>> tiles_;
  22. std::vector<std::shared_ptr<WorldGen::Factory>> worldgens_;
  23. std::vector<std::shared_ptr<Entity::Factory>> entities_;
  24. std::vector<std::shared_ptr<Asset>> assets_;
  25. bool inited_ = false;
  26. };
  27. }