Implement texture atlas building

This commit is contained in:
crumblingstatue 2023-04-15 19:26:36 +02:00
parent 5ec0ad0da4
commit 45801205dc
17 changed files with 558 additions and 60 deletions

View file

@ -1,5 +1,8 @@
use std::fmt::Debug;
use egui_inspect::derive::Inspect;
use num_traits::{Num, Signed};
use serde::{Deserialize, Serialize};
use crate::world::{TPosSc, TilePos};
@ -81,6 +84,24 @@ pub fn smoothwave<T: Num + From<u8> + PartialOrd + Copy>(input: T, max: T) -> T
}
}
#[derive(Serialize, Deserialize, Debug, Inspect, Default, Clone, Copy)]
pub struct IntRect {
pub x: i32,
pub y: i32,
pub w: i32,
pub h: i32,
}
impl IntRect {
pub(crate) fn to_sf(&self) -> sfml::graphics::Rect<i32> {
sfml::graphics::Rect::<i32> {
left: self.x,
top: self.y,
width: self.w,
height: self.h,
}
}
}
#[test]
fn test_smooth_wave() {
assert_eq!(smoothwave(0, 100), 0);