StateMap.cpp 918 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "StateMap.h"
  2. #include "utility/misc.h"
  3. #include "version.h"
  4. #include "drivers/Graphics.h"
  5. #include "render/Pixel.h"
  6. #include "render/Text.h"
  7. #define STATEMAP WalrusRPG::States::StateMap
  8. using namespace WalrusRPG;
  9. using namespace WalrusRPG::Graphics;
  10. namespace
  11. {
  12. void print_debug_camera_data(const Camera &camera)
  13. {
  14. Text::print_format(0, 8, "CAM : X : %d Y: %d", camera.get_x(), camera.get_y());
  15. }
  16. void print_debug_map_data(const Map &map)
  17. {
  18. Text::print_format(0, 16, "MAP : W: %d, H:%d", map.get_width(), map.get_height());
  19. }
  20. }
  21. STATEMAP::StateMap(int x, int y, Map &map) : camera(x, y), map(map)
  22. {
  23. }
  24. void STATEMAP::update(unsigned dt)
  25. {
  26. camera.update(dt);
  27. }
  28. void STATEMAP::render(unsigned dt)
  29. {
  30. Pixel pix(Graphics::Green);
  31. Graphics::buffer_fill(pix);
  32. map.render(camera, dt);
  33. print_debug_camera_data(camera);
  34. print_debug_map_data(map);
  35. }