RenderBuffer.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "Buffer.h"
  3. #include <gui/gui.h>
  4. struct Vector;
  5. class Sprite;
  6. /**
  7. * @class RenderBuffer
  8. * @brief A class that represents a render buffer for drawing graphics.
  9. *
  10. * This class inherits from the Buffer class and provides additional methods for drawing various shapes on the buffer.
  11. *
  12. * @see Buffer
  13. */
  14. class RenderBuffer : public Buffer {
  15. void draw_sprite(Sprite *const sprite, bool is_black,
  16. PixelColor draw_color, const Vector& position, uint8_t x_cap, uint8_t y_cap, float rotation);
  17. Buffer *frontBuffer;
  18. bool doubleBuffer;
  19. public:
  20. explicit RenderBuffer(uint8_t w, uint8_t h, bool doubleBuffered=false);
  21. virtual ~RenderBuffer();
  22. void render(Canvas *const canvas);
  23. void swap();
  24. void draw_line(int x0, int y0, int x1, int y1, PixelColor draw_mode);
  25. void draw_rbox(int16_t x0, int16_t y0, int16_t x1, int16_t y1, PixelColor draw_mode);
  26. void draw_box(int16_t x0, int16_t y0, int16_t x1, int16_t y1, PixelColor draw_mode);
  27. void draw_rbox_frame(int16_t x0, int16_t y0, int16_t x1, int16_t y1, PixelColor draw_mode);
  28. void draw_circle(int x, int y, int r, PixelColor draw_mode);
  29. void draw(Sprite *const sprite, Vector position, uint8_t x_cap, uint8_t y_cap, float rotation);
  30. void draw(Sprite *const sprite, Vector position, float rotation);
  31. };