diff options
Diffstat (limited to 'light-client/src/render/sprite.rs')
-rw-r--r-- | light-client/src/render/sprite.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/light-client/src/render/sprite.rs b/light-client/src/render/sprite.rs index 942db611..13ede525 100644 --- a/light-client/src/render/sprite.rs +++ b/light-client/src/render/sprite.rs @@ -10,10 +10,10 @@ pub struct Sprite { impl Sprite { pub fn new(src: Rect, anchor: Vec2, elevation: f32) -> Self { let relative_dst = FRect::new( - anchor.x - (src.w as f32) / 32. / 2., - anchor.y - (src.h as f32) / 24., + -anchor.x - (src.w as f32) / 32. / 2., + -anchor.y - (src.h as f32) / 24., (src.w as f32) / 32., - (src.h as f32) / 32., + (src.h as f32) / 24., ); Self { z_offset: -relative_dst.h + anchor.y - elevation, @@ -21,8 +21,8 @@ impl Sprite { relative_dst, } } - pub fn new_tile(src: Rect) { - Self::new(src, Vec2::new(0.5, 1.0), 0.); + pub fn new_tile(src: Rect) -> Self { + Self::new(src, Vec2::new(0.5, 1.0), 0.) } pub fn at(&self, pos: Vec2) -> SpriteDraw { SpriteDraw { @@ -38,6 +38,7 @@ impl Sprite { } } +#[derive(Debug, Clone, Copy)] pub struct SpriteDraw { pub z_order: i32, pub src: Rect, |