2022-07-07 18:39:21 +00:00
|
|
|
#[global_allocator]
|
|
|
|
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
|
|
|
|
|
2022-07-08 18:48:31 +00:00
|
|
|
pub use glam::Vec2;
|
2022-07-07 18:39:21 +00:00
|
|
|
|
2022-07-08 18:48:31 +00:00
|
|
|
pub mod abi;
|
|
|
|
pub mod draw;
|
|
|
|
pub mod panel;
|
|
|
|
pub mod widgets;
|
2022-07-07 18:39:21 +00:00
|
|
|
|
2022-07-08 18:48:31 +00:00
|
|
|
use abi::UiPanel;
|
|
|
|
use widgets::Widget;
|
2022-07-07 18:39:21 +00:00
|
|
|
|
|
|
|
pub struct DummyPanel {
|
|
|
|
panel: UiPanel,
|
2022-07-08 18:48:31 +00:00
|
|
|
button: widgets::RoundButton,
|
2022-07-07 18:39:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl DummyPanel {
|
|
|
|
fn bind(panel: UiPanel) -> Self {
|
2022-07-08 18:48:31 +00:00
|
|
|
Self {
|
|
|
|
panel,
|
|
|
|
button: widgets::RoundButton {
|
|
|
|
pos: Vec2::new(0., 0.),
|
2022-07-07 18:39:21 +00:00
|
|
|
},
|
2022-07-08 18:48:31 +00:00
|
|
|
}
|
2022-07-07 18:39:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-08 18:48:31 +00:00
|
|
|
impl abi::PanelImpl for DummyPanel {
|
|
|
|
fn update(&mut self, dt: f32) {
|
|
|
|
self.button.update(dt);
|
2022-07-07 18:39:21 +00:00
|
|
|
|
2022-07-08 18:48:31 +00:00
|
|
|
let ctx = draw::DrawContext::new(self.panel);
|
|
|
|
self.button.draw(&ctx);
|
|
|
|
}
|
2022-07-07 18:39:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
#[derive(Copy, Clone, Debug)]
|
|
|
|
pub struct Color {
|
|
|
|
pub r: f32,
|
|
|
|
pub g: f32,
|
|
|
|
pub b: f32,
|
|
|
|
pub a: f32,
|
|
|
|
}
|