#[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; pub use glam::Vec2; pub mod abi; pub mod anim; pub mod draw; pub mod panel; pub mod widgets; use abi::UiPanel; use widgets::Widget; pub struct DummyPanel { panel: UiPanel, menu: widgets::MainMenu, } impl DummyPanel { fn bind(panel: UiPanel) -> Self { Self { panel, menu: widgets::MainMenu::default(), } } } impl abi::PanelImpl for DummyPanel { fn update(&mut self, dt: f32) { self.menu.update(dt); let ctx = draw::DrawContext::new(self.panel); self.menu.draw(&ctx); } fn on_cursor_event(&mut self, kind: CursorEventKind, at: Vec2) { self.menu.on_cursor_event(kind, at); } } #[repr(C)] #[derive(Copy, Clone, Debug)] pub struct Color { pub r: f32, pub g: f32, pub b: f32, pub a: f32, } #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum CursorEventKind { Hover, Select, Drag, Deselect, }