summaryrefslogtreecommitdiff
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.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/pixel-client/src/render/sprite.rs b/pixel-client/src/render/sprite.rs
index 711f45bf..580146b1 100644
--- a/pixel-client/src/render/sprite.rs
+++ b/pixel-client/src/render/sprite.rs
@@ -1,3 +1,20 @@
+/*
+ Hurry Curry! - a game about cooking
+ Copyright 2024 metamuffin
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, version 3 of the License only.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+*/
use hurrycurry_protocol::glam::Vec2;
use sdl2::rect::{FRect, Rect};
@@ -56,6 +73,10 @@ impl SpriteDraw {
z_order: i32::MAX,
}
}
+ pub fn alpha(mut self, alpha: f32) -> Self {
+ self.tint[3] = (alpha.clamp(0., 1.) * 255.) as u8;
+ self
+ }
}
impl Ord for SpriteDraw {