mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 04:25:00 +01:00
Implement texture atlas building
This commit is contained in:
parent
5ec0ad0da4
commit
45801205dc
17 changed files with 558 additions and 60 deletions
21
src/math.rs
21
src/math.rs
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue