DimensionMap.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include <Trie.h>
  3. #include <Zeichnung.h>
  4. #include "ChunkMap.h"
  5. #include "MapOptions.h"
  6. struct MapPlayer
  7. {
  8. Framework::Vec3<float> position;
  9. Framework::Text name;
  10. };
  11. class DimensionMap : public Framework::ZeichnungHintergrund
  12. {
  13. private:
  14. MapOptions* zOptions;
  15. Framework::RCTrie<ChunkMap>* chunks;
  16. Framework::Array<ChunkMap*> chunkList;
  17. Framework::Punkt originChunkCenter;
  18. Framework::Punkt scrollOffset;
  19. int chunkCount;
  20. int pixelsPerBlock;
  21. int requestCount;
  22. bool drag;
  23. Framework::Punkt lastMouse;
  24. Framework::Punkt lastSize;
  25. Framework::Array<MapPlayer> players;
  26. double nextPlayersRequest;
  27. Framework::Bild* playerIcon;
  28. void getAddrOf(Framework::Punkt cPos, char* addr) const;
  29. void getAddrOfWorld(Framework::Punkt wPos, char* addr) const;
  30. Framework::Punkt getMinVisibleChunkCenter(
  31. Framework::Punkt& screenPos) const;
  32. Framework::Punkt getMaxVisibleChunkCenter(
  33. Framework::Punkt& screenPos) const;
  34. void removeUnused() const;
  35. public:
  36. DimensionMap(MapOptions* zOptions);
  37. ~DimensionMap();
  38. void updatePlayers(char* data);
  39. void requestNextChunk();
  40. void addChunk(ChunkMap* chunk);
  41. bool tick(double time) override;
  42. void render(Framework::Bild& rObj) override;
  43. void doMausEreignis(Framework::MausEreignis& me, bool userRet) override;
  44. };