style: Make start/end_window_draw safe and Size struct for define window
This commit is contained in:
@@ -3,34 +3,35 @@
|
||||
|
||||
use cstr_core::{cstr, CStr};
|
||||
|
||||
use kos::{Color, Dot, Event, WindowKind, WindowParams, WindowTextParams};
|
||||
use kos::{Color, Dot, Event, Size, WindowKind, WindowParams, WindowTextParams};
|
||||
|
||||
const HEADER: &CStr = cstr!("Hey Kolibri");
|
||||
const MSG: &str = "Hello from Rust!";
|
||||
|
||||
#[inline(always)] // for some reason function removed otherwise
|
||||
fn draw_window() {
|
||||
unsafe {
|
||||
kos::start_window_draw();
|
||||
kos::define_window(
|
||||
Dot { x: 50, y: 50 },
|
||||
300, 400,
|
||||
WindowParams {
|
||||
color: Color::rgb(0xff, 0xff, 0xff),
|
||||
kind: WindowKind::Themed,
|
||||
title: Some(HEADER),
|
||||
},
|
||||
);
|
||||
kos::display_message(
|
||||
Dot { x: 0, y: 10 },
|
||||
WindowTextParams {
|
||||
color: Color::rgb(0x66, 0x22, 0x22),
|
||||
text: MSG,
|
||||
bg_color: None,
|
||||
},
|
||||
);
|
||||
kos::end_window_draw();
|
||||
}
|
||||
kos::start_window_draw();
|
||||
kos::define_window(
|
||||
Dot { x: 50, y: 50 },
|
||||
Size {
|
||||
width: 300,
|
||||
height: 400,
|
||||
},
|
||||
WindowParams {
|
||||
color: Color::rgb(0xff, 0xff, 0xff),
|
||||
kind: WindowKind::Themed,
|
||||
title: Some(HEADER),
|
||||
},
|
||||
);
|
||||
kos::display_message(
|
||||
Dot { x: 0, y: 10 },
|
||||
WindowTextParams {
|
||||
color: Color::rgb(0x66, 0x22, 0x22),
|
||||
text: MSG,
|
||||
bg_color: None,
|
||||
},
|
||||
);
|
||||
kos::end_window_draw();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
Reference in New Issue
Block a user