Sprite.h 786 B

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include "RenderBuffer.h"
  3. #include "Vector.h"
  4. /**
  5. * @class Sprite
  6. * @brief The Sprite class represents a graphical sprite that can be drawn on a Buffer.
  7. *
  8. * The Sprite class inherits from the Buffer class and adds functionality specific to sprites.
  9. * It contains information about the sprite's icon, anchor point, and draw mode.
  10. */
  11. class Sprite : public Buffer {
  12. const SpriteData *_icon;
  13. Vector anchor = {0.5, 0.5};
  14. public:
  15. DrawMode draw_mode;
  16. Sprite(const SpriteData *icon, DrawMode draw_mode);
  17. Sprite(const SpriteData &icon, DrawMode draw_mode);
  18. virtual ~Sprite() {
  19. FURI_LOG_D("App", "Sprite cleared");
  20. }
  21. const SpriteData *get_data() { return _icon; }
  22. void set_anchor(float x, float y);
  23. Vector get_offset();
  24. };