Map.h 912 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef INCLUDE_MAP_H
  2. #define INCLUDE_MAP_H
  3. #include <stdint.h>
  4. #include "Camera.h"
  5. #include "Entity.h"
  6. #include "TileRenderer.h"
  7. #include "Animator.h"
  8. namespace WalrusRPG
  9. {
  10. class Map
  11. {
  12. public:
  13. Animator anim;
  14. protected:
  15. // <Tiles> data;
  16. // <Tileset> tileset;
  17. unsigned int width;
  18. unsigned int height;
  19. uint16_t *layer0;
  20. uint16_t *layer1;
  21. TileRenderer *renderer;
  22. // TODO?: add a boolean/getter to know if a second layer exist?
  23. public:
  24. Map(int width, int height, uint16_t *layer0, uint16_t *layer1);
  25. ~Map();
  26. void render(Camera &camera, unsigned dt);
  27. void update(unsigned dt);
  28. bool is_tile_solid(unsigned x, unsigned y) const;
  29. bool is_pixel_solid(unsigned x, unsigned y) const;
  30. unsigned get_width() const;
  31. unsigned get_height() const;
  32. };
  33. }
  34. #endif