2
0

Sprite.pkg 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. $#include "Sprite.h"
  2. enum BlendMode{};
  3. /// %UI element which allows sub-pixel positioning and size, as well as rotation. Only other Sprites should be added as child elements.
  4. class Sprite : public UIElement
  5. {
  6. public:
  7. /// Set floating point position.
  8. void SetPosition(const Vector2& position);
  9. /// Set floating point position.
  10. void SetPosition(float x, float y);
  11. /// Set hotspot for positioning and rotation.
  12. void SetHotSpot(const IntVector2& hotSpot);
  13. /// Set hotspot for positioning and rotation.
  14. void SetHotSpot(int x, int y);
  15. /// Set scale. Scale also affects child sprites.
  16. void SetScale(const Vector2& scale);
  17. /// Set scale. Scale also affects child sprites.
  18. void SetScale(float x, float y);
  19. /// Set uniform scale. Scale also affects child sprites.
  20. void SetScale(float scale);
  21. /// Set rotation angle.
  22. void SetRotation(float angle);
  23. /// Set texture.
  24. void SetTexture(Texture* texture);
  25. /// Set part of texture to use as the image.
  26. void SetImageRect(const IntRect& rect);
  27. /// Use whole texture as the image.
  28. void SetFullImageRect();
  29. /// Set blend mode.
  30. void SetBlendMode(BlendMode mode);
  31. /// Return floating point position.
  32. const Vector2& GetPosition() const;
  33. /// Return hotspot.
  34. const IntVector2& GetHotSpot() const;
  35. /// Return scale.
  36. const Vector2& GetScale() const;
  37. /// Return rotation angle.
  38. float GetRotation() const;
  39. /// Return texture.
  40. Texture* GetTexture() const;
  41. /// Return image rectangle.
  42. const IntRect& GetImageRect() const;
  43. /// Return blend mode.
  44. BlendMode GetBlendMode() const;
  45. /// Set texture attribute.
  46. void SetTextureAttr(ResourceRef value);
  47. /// Return texture attribute.
  48. ResourceRef GetTextureAttr() const;
  49. /// Update and return rendering transform, also used to transform child sprites.
  50. const Matrix3x4& GetTransform() const;
  51. };
  52. Sprite* NewSprite @ Sprite();