From ecb6ff15c24841dc08ab8f5c3b347c8080720ac4 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Thu, 25 Jul 2024 13:50:09 +0200 Subject: pc: main menu background --- pixel-client/src/render/sprite.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pixel-client/src/render/sprite.rs') 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 -- cgit v1.2.3-70-g09d2