aboutsummaryrefslogtreecommitdiff
path: root/pixel-client/src/render/sprite.rs
diff options
context:
space:
mode:
Diffstat (limited to 'pixel-client/src/render/sprite.rs')
-rw-r--r--pixel-client/src/render/sprite.rs10
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