From 3c5c57cf22476fbd644cb136041a1f4c49ae6fa1 Mon Sep 17 00:00:00 2001 From: TheOddGarlic Date: Sun, 1 May 2022 18:24:13 +0300 Subject: [PATCH] formatting changes --- abletk-common/src/lib.rs | 10 +++++----- abletk-direct2d/src/lib.rs | 4 ++-- src/main.rs | 7 ++++++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/abletk-common/src/lib.rs b/abletk-common/src/lib.rs index d2ee630..e7c7780 100755 --- a/abletk-common/src/lib.rs +++ b/abletk-common/src/lib.rs @@ -11,8 +11,8 @@ pub mod color; pub mod rect; use brush::Brush; -use raw_window_handle::RawWindowHandle; use color::Color; +use raw_window_handle::RawWindowHandle; use rect::Rect; #[cfg(windows)] @@ -28,7 +28,7 @@ impl Renderer { pub fn new(handle: RawWindowHandle) -> Self { let handle = match handle { RawWindowHandle::Win32(handle) => handle, - _ => todo!() + _ => todo!(), }; Self { @@ -45,7 +45,7 @@ impl Renderer { pub fn clear(&self, color: Color) { self.renderer.clear(color) } - + pub fn draw_rect(&self, width: u32, height: u32) { self.renderer.draw_rect(Rect::new( self.x as f32, @@ -66,7 +66,7 @@ impl Renderer { // text is not cut off or wrapped f32::INFINITY, f32::INFINITY, - ) + ), ) } @@ -99,7 +99,7 @@ impl Renderer { pub fn resized(&mut self, width: u32, height: u32) { self.renderer.resized(width, height) } - + pub fn set_brush(&mut self, brush: Brush) { self.renderer.set_brush(brush.into()) } diff --git a/abletk-direct2d/src/lib.rs b/abletk-direct2d/src/lib.rs index 6743621..138c059 100755 --- a/abletk-direct2d/src/lib.rs +++ b/abletk-direct2d/src/lib.rs @@ -25,7 +25,7 @@ pub struct Renderer { brush: Option, stroke_style: ID2D1StrokeStyle, system_fonts: IDWriteFontCollection, - text_format: IDWriteTextFormat + text_format: IDWriteTextFormat, } impl Renderer { @@ -50,7 +50,7 @@ impl Renderer { text_format, } } - + pub fn begin_draw(&mut self) { self.setup_target(); diff --git a/src/main.rs b/src/main.rs index bb2d106..14338c4 100755 --- a/src/main.rs +++ b/src/main.rs @@ -20,5 +20,10 @@ fn launch() -> _ { .color(rgb!(0xFF00FFFF))) .add(Column::new() .add(Label::new("World!")) - .add(Label::new("AbleTK!"))))) + .add(Label::new("AbleTK!"))) + .add(Label::new("this is a label!") + .bg_color(rgb!(0xFF0000FF)))) + .on_event(WindowEvent::Closed, |_, window| { + window.set_title("CLOSING!") + })) }