Sprite.cpp 490 B

1234567891011121314151617181920
  1. #include "Sprite.h"
  2. #include "Buffer.h"
  3. Sprite::Sprite(const SpriteData *spriteData, DrawMode d) : Buffer(spriteData), _icon(spriteData), draw_mode(d) {
  4. }
  5. void Sprite::set_anchor(float x, float y) {
  6. anchor.x = x;
  7. anchor.y = y;
  8. }
  9. Vector Sprite::get_offset() {
  10. return {
  11. anchor.x * (float) width(),
  12. anchor.y * (float) height()
  13. };
  14. }
  15. Sprite::Sprite(const SpriteData &spriteData, DrawMode d) : Buffer(&spriteData), _icon(&spriteData), draw_mode(d) {
  16. }