use UVec2 in Layer info

This commit is contained in:
Michael Sippel 2021-09-12 22:57:58 +02:00
parent 029d2c4e02
commit b081c4311f
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -24,7 +24,7 @@ use{
}, },
nako::{ nako::{
stream::{SecondaryStream2d, PrimaryStream2d}, stream::{SecondaryStream2d, PrimaryStream2d},
glam::{Vec2, Vec3}, glam::{Vec2, Vec3, UVec2},
operations::{ operations::{
planar::primitives2d::Box2d, planar::primitives2d::Box2d,
volumetric::{Color, Union, Round}, volumetric::{Color, Union, Round},
@ -76,7 +76,7 @@ struct SdfTerm {
bg_layers: HashMap<Point2<i16>, (bool, LayerId2d)>, bg_layers: HashMap<Point2<i16>, (bool, LayerId2d)>,
fg_layers: HashMap<Point2<i16>, (bool, LayerId2d)>, fg_layers: HashMap<Point2<i16>, (bool, LayerId2d)>,
font_height: usize, font_height: u32,
//font: Mutex<Font>, //font: Mutex<Font>,
renderer: Arc<Mutex<MarpBackend>> renderer: Arc<Mutex<MarpBackend>>
@ -125,8 +125,8 @@ impl SdfTerm {
self.renderer.lock().unwrap().set_layer_info( self.renderer.lock().unwrap().set_layer_info(
id.into(), id.into(),
LayerInfo { LayerInfo {
extent: (1 + self.font_height / 2, self.font_height), extent: UVec2::new(1 + self.font_height / 2, self.font_height),
location: (pt.x as usize * self.font_height / 2, pt.y as usize * self.font_height) location: UVec2::new(pt.x as u32 * self.font_height / 2, pt.y as u32 * self.font_height)
}); });
self.bg_layers.insert(*pt, (false, id)); self.bg_layers.insert(*pt, (false, id));
@ -144,8 +144,8 @@ impl SdfTerm {
self.renderer.lock().unwrap().set_layer_info( self.renderer.lock().unwrap().set_layer_info(
id.into(), id.into(),
LayerInfo { LayerInfo {
extent: (1 + self.font_height / 2, self.font_height), extent: UVec2::new(1 + self.font_height / 2, self.font_height),
location: (pt.x as usize * self.font_height / 2, pt.y as usize * self.font_height) location: UVec2::new(pt.x as u32 * self.font_height / 2, pt.y as u32 * self.font_height)
}); });
self.fg_layers.insert(*pt, (false, id)); self.fg_layers.insert(*pt, (false, id));
@ -272,8 +272,8 @@ async fn main() {
rotation: 0.0 rotation: 0.0
}); });
renderer.lock().unwrap().set_layer_info(color_layer_id.into(), LayerInfo{ renderer.lock().unwrap().set_layer_info(color_layer_id.into(), LayerInfo{
extent: (600, 600), extent: UVec2::new(600, 600),
location: (200,100) location: UVec2::new(200,100)
}); });
event_loop.run(move |event, _target, control_flow|{ event_loop.run(move |event, _target, control_flow|{