aboutsummaryrefslogtreecommitdiff
path: root/light-client/src/render/sprite.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-16 19:59:50 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-16 19:59:50 +0200
commit0ce6279d355d3d0311b7a3f5fbcb22a305bb0278 (patch)
tree416dddd143eefb3cfad131cfef2a3ddd4b2537d0 /light-client/src/render/sprite.rs
parent078355b834c5ff6786d5d6d05c7c626f3527cec6 (diff)
downloadhurrycurry-0ce6279d355d3d0311b7a3f5fbcb22a305bb0278.tar
hurrycurry-0ce6279d355d3d0311b7a3f5fbcb22a305bb0278.tar.bz2
hurrycurry-0ce6279d355d3d0311b7a3f5fbcb22a305bb0278.tar.zst
tinted sprites
Diffstat (limited to 'light-client/src/render/sprite.rs')
-rw-r--r--light-client/src/render/sprite.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/light-client/src/render/sprite.rs b/light-client/src/render/sprite.rs
index b45e85b3..711f45bf 100644
--- a/light-client/src/render/sprite.rs
+++ b/light-client/src/render/sprite.rs
@@ -34,17 +34,30 @@ impl Sprite {
self.relative_dst.w,
self.relative_dst.h,
),
+ tint: [0xff; 4],
}
}
}
#[derive(Debug, Clone, Copy)]
pub struct SpriteDraw {
+ pub tint: [u8; 4],
pub z_order: i32,
pub src: Rect,
pub dst: FRect,
}
+impl SpriteDraw {
+ pub fn overlay(src: Rect, 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,
+ }
+ }
+}
+
impl Ord for SpriteDraw {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.z_order.cmp(&other.z_order)