World.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include <Welt3D.h>
  3. #include <Bildschirm.h>
  4. #include <Kam3D.h>
  5. #include <Thread.h>
  6. #include "Dimension.h"
  7. #include "PlayerKam.h"
  8. class World : public Framework::Thread
  9. {
  10. private:
  11. Dimension* currentDimension;
  12. Framework::Welt3D* renderedWorld;
  13. Framework::Bildschirm3D* zScreenPtr;
  14. PlayerKam* kam;
  15. bool firstMessage;
  16. int ownEntityId;
  17. Framework::Model3D* currentTarget;
  18. Array<Punkt> subscriptions;
  19. Critical subLock;
  20. Critical targetLock;
  21. public:
  22. World(Framework::Bildschirm3D* zScreen);
  23. ~World();
  24. void update(bool background);
  25. void setChunk(Chunk* chunk);
  26. void thread() override;
  27. Block* zBlockAt(Framework::Vec3<int> location) const;
  28. Block* getBlockAt(Framework::Vec3<int> location) const;
  29. Dimension* zDimension() const;
  30. void setVisibility(Chunk* zChunk, bool visible);
  31. void setVisibility(Entity* zEntity, bool visible);
  32. Framework::Punkt getChunkCenter(int x, int y) const;
  33. Entity* zEntity(int id) const;
  34. Entity* getEntity(int id) const;
  35. void removeEntity(int id);
  36. PlayerKam* zKamera() const;
  37. int getCurrentPlayerId() const;
  38. Entity* getCurrentPlayerEntity() const;
  39. void setTarget(Framework::Model3D* zTarget);
  40. void lockWorld();
  41. void unlockWorld();
  42. void onChunkAdded(Punkt pos);
  43. Chunk* zChunk(Punkt center);
  44. Framework::Model3D* getCurrentTarget() const;
  45. };