diff options
author | metamuffin <metamuffin@disroot.org> | 2024-08-14 22:58:09 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-08-14 22:58:09 +0200 |
commit | 16bdd6964705a9995d1ccd9451264db59a4e8879 (patch) | |
tree | 2c4ccab3eed4f2d77bda70dbc26a80f879c9167e /pixel-client/src/render/sprite.rs | |
parent | 66cfc6f5a6352d65f1b198547baaebdd2366b8a4 (diff) | |
download | hurrycurry-16bdd6964705a9995d1ccd9451264db59a4e8879.tar hurrycurry-16bdd6964705a9995d1ccd9451264db59a4e8879.tar.bz2 hurrycurry-16bdd6964705a9995d1ccd9451264db59a4e8879.tar.zst |
pc: add item bubbles
Diffstat (limited to 'pixel-client/src/render/sprite.rs')
-rw-r--r-- | pixel-client/src/render/sprite.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pixel-client/src/render/sprite.rs b/pixel-client/src/render/sprite.rs index 292a99ab..7d0a195a 100644 --- a/pixel-client/src/render/sprite.rs +++ b/pixel-client/src/render/sprite.rs @@ -89,6 +89,20 @@ impl SpriteDraw { self.tint[2] = b; self } + pub fn elevate(mut self, offset: f32) -> SpriteDraw { + self.z_order += (offset * 24.) as i32; + self.dst.set_y(self.dst.y() - offset); + self + } + pub fn scale(mut self, factor: f32) -> SpriteDraw { + self.dst + .set_x(self.dst.x() + self.dst.width() * 0.5 * (1. - factor)); + self.dst + .set_y(self.dst.y() + self.dst.height() * 0.5 * (1. - factor)); + self.dst.set_width(self.dst.width() * factor); + self.dst.set_height(self.dst.height() * factor); + self + } } impl Ord for SpriteDraw { |