diff --git a/src/input.rs b/src/input.rs index fe8d16b..7052300 100644 --- a/src/input.rs +++ b/src/input.rs @@ -48,7 +48,7 @@ fn get_mouse_input( events: &mut Vec, pixels_per_point: f32, modifiers: Modifiers, - ctx: &egui::Context + ctx: &egui::Context, ) { let mouse_delta = rl.get_mouse_delta().scale_by(1.0 / pixels_per_point); let mouse_position = rl.get_mouse_position().scale_by(1.0 / pixels_per_point); @@ -234,10 +234,6 @@ pub fn gather_input(opt: &InputOptions, ctx: &egui::Context, rl: &mut RaylibHand Vec::new() }; - if !events.is_empty() { - println!("Events: {events:?}"); - } - RawInput { viewport_id: ViewportId::ROOT, viewports: iter::once((ViewportId::ROOT, viewport)).collect(), diff --git a/src/lib.rs b/src/lib.rs index 66584a2..ad05109 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,6 +43,9 @@ use raylib::{ RaylibHandle, RaylibThread, }; +/// Re-export egui crate for convenience. +pub use egui; + pub mod input; pub mod paint; pub mod util; diff --git a/src/paint.rs b/src/paint.rs index 871fa64..ca609c0 100644 --- a/src/paint.rs +++ b/src/paint.rs @@ -258,10 +258,7 @@ impl Painter { } else { let lines = ps.points.iter() .zip(ps.points.iter().skip(1)) - .map(|(a,b)| - (a.convert().scale_by(pxpp), - b.convert().scale_by(pxpp)) - ); + .map(|(a,b)| (a.convert().scale_by(pxpp), b.convert().scale_by(pxpp))); let thick = ps.stroke.width * pxpp; let color = color_mode_to_color(&ps.stroke.color); diff --git a/src/tests.rs b/src/tests.rs index 2c04a90..25adfdf 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -206,10 +206,32 @@ fn it_works() { let (mut rl, thread) = raylib::init().size(768, 1024).title("Hello, World").build(); let ctx = Context::default(); + let mut fonts = egui::FontDefinitions::default(); + + fonts.font_data.insert("retro".to_owned(), egui::FontData::from_static(include_bytes!("../../alagard.ttf"))); + + // Put my font first (highest priority) for proportional text: + fonts + .families + .entry(egui::FontFamily::Proportional) + .or_default() + .insert(0, "retro".to_owned()); + + // Put my font as last fallback for monospace: + fonts + .families + .entry(egui::FontFamily::Monospace) + .or_default() + .push("retro".to_owned()); + + // Tell egui to use these fonts: + ctx.set_fonts(fonts); + ctx.set_visuals(Visuals { override_text_color: Some(Color32::WHITE), hyperlink_color: Color32::BLUE, window_rounding: Rounding::ZERO, + faint_bg_color: Color32::LIGHT_YELLOW.gamma_multiply(0.4), ..Visuals::dark() });