formatting changes

master
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;
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())
}

View File

@ -25,7 +25,7 @@ pub struct Renderer {
brush: Option<ID2D1Brush>,
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();

View File

@ -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!")
}))
}