formatting changes

This commit is contained in:
TheOddGarlic 2022-05-01 18:24:13 +03:00
parent 365fb6741c
commit 3c5c57cf22
3 changed files with 13 additions and 8 deletions

View file

@ -11,8 +11,8 @@ pub mod color;
pub mod rect; pub mod rect;
use brush::Brush; use brush::Brush;
use raw_window_handle::RawWindowHandle;
use color::Color; use color::Color;
use raw_window_handle::RawWindowHandle;
use rect::Rect; use rect::Rect;
#[cfg(windows)] #[cfg(windows)]
@ -28,7 +28,7 @@ impl Renderer {
pub fn new(handle: RawWindowHandle) -> Self { pub fn new(handle: RawWindowHandle) -> Self {
let handle = match handle { let handle = match handle {
RawWindowHandle::Win32(handle) => handle, RawWindowHandle::Win32(handle) => handle,
_ => todo!() _ => todo!(),
}; };
Self { Self {
@ -45,7 +45,7 @@ impl Renderer {
pub fn clear(&self, color: Color) { pub fn clear(&self, color: Color) {
self.renderer.clear(color) self.renderer.clear(color)
} }
pub fn draw_rect(&self, width: u32, height: u32) { pub fn draw_rect(&self, width: u32, height: u32) {
self.renderer.draw_rect(Rect::new( self.renderer.draw_rect(Rect::new(
self.x as f32, self.x as f32,
@ -66,7 +66,7 @@ impl Renderer {
// text is not cut off or wrapped // text is not cut off or wrapped
f32::INFINITY, f32::INFINITY,
f32::INFINITY, f32::INFINITY,
) ),
) )
} }
@ -99,7 +99,7 @@ impl Renderer {
pub fn resized(&mut self, width: u32, height: u32) { pub fn resized(&mut self, width: u32, height: u32) {
self.renderer.resized(width, height) self.renderer.resized(width, height)
} }
pub fn set_brush(&mut self, brush: Brush) { pub fn set_brush(&mut self, brush: Brush) {
self.renderer.set_brush(brush.into()) self.renderer.set_brush(brush.into())
} }

View file

@ -25,7 +25,7 @@ pub struct Renderer {
brush: Option<ID2D1Brush>, brush: Option<ID2D1Brush>,
stroke_style: ID2D1StrokeStyle, stroke_style: ID2D1StrokeStyle,
system_fonts: IDWriteFontCollection, system_fonts: IDWriteFontCollection,
text_format: IDWriteTextFormat text_format: IDWriteTextFormat,
} }
impl Renderer { impl Renderer {
@ -50,7 +50,7 @@ impl Renderer {
text_format, text_format,
} }
} }
pub fn begin_draw(&mut self) { pub fn begin_draw(&mut self) {
self.setup_target(); self.setup_target();

View file

@ -20,5 +20,10 @@ fn launch() -> _ {
.color(rgb!(0xFF00FFFF))) .color(rgb!(0xFF00FFFF)))
.add(Column::new() .add(Column::new()
.add(Label::new("World!")) .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!")
}))
} }