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.

36 lines
735 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef TILE_COLLECTION_H
  2. #define TILE_COLLECTION_H TILE_COLLECTION_H
  3. #include <stack>
  4. #include <list>
  5. #include <assert.h>
  6. #include "tile.h"
  7. #include "tile_downloader.h"
  8. struct Range{
  9. int minx, miny, maxx, maxy, depth;
  10. bool contains(int x, int y, int d) const;
  11. };
  12. class Quad{
  13. Tile *tile;
  14. Quad *children[4];
  15. int x, y, depth;
  16. public:
  17. Quad(int x, int y, int depth);
  18. void queryRange(std::list<Tile *> &l, const Range &r);
  19. void buildChildren();
  20. };
  21. class TileCollection{
  22. Quad quad;
  23. Range range;
  24. public:
  25. TileCollection(): quad(0,0,0){}
  26. TileDownloader transfers;
  27. void set_bounds(int _minx, int _miny, int _maxx, int _maxy, int _zoom);
  28. bool work();
  29. void render(SDL_Surface *screen, int offsetx, int offsety);
  30. };
  31. #endif