1
0
forked from Rust/Core
files
Core/src/modules/threads.rs
sweetbread 59d825577a feat: Buttons + events
wip: malloc

feat: Buttons
2024-01-31 16:31:47 +03:00

32 lines
586 B
Rust

use crate::sys;
pub fn exit() -> ! {
unsafe { sys::exit() }
}
#[non_exhaustive]
pub enum Event {
Redraw,
KeyPress,
BtnPress,
BgRedraw,
Mouse,
IPC,
Network,
Debug,
}
pub fn fetch_event() -> Option<Event> {
match unsafe { sys::wait_event() } {
1 => Some(Event::Redraw),
2 => Some(Event::KeyPress),
3 => Some(Event::BtnPress),
5 => Some(Event::BgRedraw),
6 => Some(Event::Mouse),
7 => Some(Event::IPC),
8 => Some(Event::Network),
9 => Some(Event::Debug),
_ => None,
}
}