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.

Tile.h 619B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include <stdint.h>
  3. #include <string>
  4. #include <optional>
  5. namespace Swan {
  6. struct Tile {
  7. public:
  8. using ID = uint16_t;
  9. struct Builder {
  10. std::string name;
  11. std::string image;
  12. bool isSolid = true;
  13. float lightLevel = 0;
  14. std::optional<std::string> droppedItem = std::nullopt;
  15. };
  16. const ID id;
  17. const std::string name;
  18. const bool isSolid;
  19. const float lightLevel;
  20. const std::optional<std::string> droppedItem;
  21. Tile(ID id, std::string name, const Builder &builder):
  22. id(id), name(name),
  23. isSolid(builder.isSolid), lightLevel(builder.lightLevel),
  24. droppedItem(builder.droppedItem) {}
  25. };
  26. }