diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-25 13:50:09 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-25 13:50:09 +0200 |
commit | ecb6ff15c24841dc08ab8f5c3b347c8080720ac4 (patch) | |
tree | d53db2a61a6151af970f9d27a617d12e0cac7588 /pixel-client/src/render/sprite.rs | |
parent | bc210b2632891ca163d31fb57bc0c41769249bf5 (diff) | |
download | hurrycurry-ecb6ff15c24841dc08ab8f5c3b347c8080720ac4.tar hurrycurry-ecb6ff15c24841dc08ab8f5c3b347c8080720ac4.tar.bz2 hurrycurry-ecb6ff15c24841dc08ab8f5c3b347c8080720ac4.tar.zst |
pc: main menu background
Diffstat (limited to 'pixel-client/src/render/sprite.rs')
-rw-r--r-- | pixel-client/src/render/sprite.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pixel-client/src/render/sprite.rs b/pixel-client/src/render/sprite.rs index 084e277e..292a99ab 100644 --- a/pixel-client/src/render/sprite.rs +++ b/pixel-client/src/render/sprite.rs @@ -65,14 +65,20 @@ pub struct SpriteDraw { } impl SpriteDraw { - pub fn overlay(src: Rect, pos: Vec2, size: Vec2, tint: Option<[u8; 4]>) -> Self { + pub fn screen(src: Rect, z_order: i32, pos: Vec2, size: Vec2, tint: Option<[u8; 4]>) -> Self { Self { dst: FRect::new(pos.x, pos.y, size.x, size.y), src, tint: tint.unwrap_or([0xff; 4]), - z_order: i32::MAX, + z_order, } } + pub fn overlay(src: Rect, pos: Vec2, size: Vec2, tint: Option<[u8; 4]>) -> Self { + SpriteDraw::screen(src, i32::MAX, pos, size, tint) + } + pub fn underlay(src: Rect, pos: Vec2, size: Vec2, tint: Option<[u8; 4]>) -> Self { + SpriteDraw::screen(src, i32::MIN, pos, size, tint) + } pub fn alpha(mut self, alpha: f32) -> Self { self.tint[3] = (alpha.clamp(0., 1.) * 255.) as u8; self |