Open Source Tomb Raider Engine
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

World.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*!
  2. * \file include/World.h
  3. * \brief The game world (model)
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _WORLD_H_
  9. #define _WORLD_H_
  10. #include <memory>
  11. #include <vector>
  12. #include "Entity.h"
  13. #include "Mesh.h"
  14. #include "Room.h"
  15. #include "SkeletalModel.h"
  16. #include "Sprite.h"
  17. #include "StaticMesh.h"
  18. /*!
  19. * \brief The game world (model)
  20. */
  21. class World {
  22. public:
  23. /*!
  24. * \brief Deconstructs an object of World
  25. */
  26. ~World();
  27. /*!
  28. * \brief Clears all data in world
  29. */
  30. void destroy();
  31. void addRoom(Room* room);
  32. unsigned long sizeRoom();
  33. Room& getRoom(unsigned long index);
  34. void addSprite(Sprite* sprite);
  35. unsigned long sizeSprite();
  36. Sprite& getSprite(unsigned long index);
  37. void addSpriteSequence(SpriteSequence* sprite);
  38. unsigned long sizeSpriteSequence();
  39. SpriteSequence& getSpriteSequence(unsigned long index);
  40. void addEntity(Entity* entity);
  41. unsigned long sizeEntity();
  42. Entity& getEntity(unsigned long index);
  43. void addSkeletalModel(SkeletalModel* model);
  44. unsigned long sizeSkeletalModel();
  45. SkeletalModel& getSkeletalModel(unsigned long index);
  46. void addStaticMesh(StaticMesh* model);
  47. unsigned long sizeStaticMesh();
  48. StaticMesh& getStaticMesh(unsigned long index);
  49. void addMesh(Mesh* mesh);
  50. unsigned long sizeMesh();
  51. Mesh& getMesh(unsigned long index);
  52. private:
  53. std::vector<std::unique_ptr<Room>> mRooms;
  54. std::vector<std::unique_ptr<Sprite>> mSprites;
  55. std::vector<std::unique_ptr<SpriteSequence>> mSpriteSequences;
  56. std::vector<std::unique_ptr<Entity>> mEntities;
  57. std::vector<std::unique_ptr<SkeletalModel>> mModels;
  58. std::vector<std::unique_ptr<StaticMesh>> mStaticMeshes;
  59. std::vector<std::unique_ptr<Mesh>> mMeshes;
  60. };
  61. World& getWorld();
  62. #endif