33 raylib::Texture2D t = _texture.handle();
34 _crop = {0, 0, float(t.width), float(t.height)};
41 return _texture.isReady();
45 return {_position.x, _position.y, _crop.width, _crop.height};
49 _crop = {float(rect.
x), float(rect.
y), float(rect.
w), float(rect.
h)};
53 return {_position.x, _position.y};
56 _position = {float(position.
x), float(position.
y)};
64 _rotation = isRad ? angle * RAD2DEG : angle;
68 raylib::Texture2D t = _texture.handle();
70 static_cast<float>(t.width) * _scale.x,
71 static_cast<float>(t.height) * _scale.y
76 raylib::Texture2D t = _texture.handle();
77 if (t.width == 0 || t.height == 0)
return;
79 _scale.x = size.
x /
static_cast<float>(t.width);
80 _scale.y = size.
y /
static_cast<float>(t.height);
87 raylib::Vector2 _position;
88 raylib::Vector2 _scale;
89 raylib::Rectangle _crop;
void setRotation(float angle, bool isRad=false) override
Set the Rotation object.
Definition RaySprite.hpp:63
RaySprite(RayTexture &texture)
Definition RaySprite.hpp:30
float getRotation() const override
Get the Rotation object.
Definition RaySprite.hpp:59
friend class RayWindow
Definition RaySprite.hpp:83
void setPosition(Vector2f position) override
Set the Position object.
Definition RaySprite.hpp:55
Vector2f getSize() const override
Get the Sprite size.
Definition RaySprite.hpp:67
void setCrop(Rect< float > rect) override
Crop the sprite with a rectangle.
Definition RaySprite.hpp:48
void setSize(Vector2f size) override
Set the Sprite size.
Definition RaySprite.hpp:75
Vector2f getPosition() const override
Get the Position object.
Definition RaySprite.hpp:52
Rect< float > getBounds() const override
give the bounds of the sprite
Definition RaySprite.hpp:44
bool isReady() const override
notice if the sprite is ready
Definition RaySprite.hpp:40
Raylib Texture class - owns the GPU texture. RaySprite/RayModel only reference it,...
Definition RayTexture.hpp:26
Sprite interface.
Definition ISprite.hpp:22
Vector2< double > Vector2f
Definition Vector2.hpp:112
T w
Definition Shape.hpp:33
T h
Definition Shape.hpp:33
T y
Definition Shape.hpp:33
T x
Definition Shape.hpp:33
T y
Definition Vector2.hpp:21
T x
Definition Vector2.hpp:21