2022-07-15 21:11:35 +00:00
|
|
|
#[global_allocator]
|
|
|
|
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
|
|
|
|
|
|
|
|
pub mod anim;
|
|
|
|
pub mod draw;
|
2022-07-31 05:33:55 +00:00
|
|
|
pub mod main_menu;
|
2022-07-15 21:11:35 +00:00
|
|
|
pub mod panel;
|
|
|
|
pub mod widgets;
|
|
|
|
|
|
|
|
use canary_script::*;
|
|
|
|
use glam::Vec2;
|
|
|
|
use widgets::Widget;
|
2022-07-31 05:33:55 +00:00
|
|
|
use main_menu::MainMenuPanel;
|
2022-07-15 21:11:35 +00:00
|
|
|
|
2022-07-27 08:01:59 +00:00
|
|
|
export_abi!(MainMenuPanel);
|
2022-07-15 21:11:35 +00:00
|
|
|
|
2022-07-28 04:24:55 +00:00
|
|
|
pub const ICON_FONT: &str = "Iosevka Nerd Font";
|
|
|
|
pub const DISPLAY_FONT: &str = "Homenaje";
|
2022-07-31 06:29:36 +00:00
|
|
|
pub const CONTENT_FONT: &str = "Ubuntu";
|
2022-07-28 04:24:55 +00:00
|
|
|
|
2022-07-27 07:43:54 +00:00
|
|
|
pub struct ConfirmationDialogPanel {
|
|
|
|
panel: Panel,
|
|
|
|
dialog: widgets::dialog::Dialog,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl BindPanel for ConfirmationDialogPanel {
|
|
|
|
fn bind(panel: Panel) -> Box<dyn PanelImpl> {
|
|
|
|
use widgets::dialog::*;
|
|
|
|
let style = DialogStyle::default();
|
2022-07-28 04:24:55 +00:00
|
|
|
let info = DialogInfo {
|
|
|
|
title: "ha jk",
|
|
|
|
content: "lmao u wish",
|
|
|
|
responses: &[DialogResponse::Yes, DialogResponse::No],
|
|
|
|
};
|
|
|
|
|
|
|
|
let dialog = Dialog::new(style, &info);
|
2022-07-27 07:43:54 +00:00
|
|
|
Box::new(Self { panel, dialog })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PanelImpl for ConfirmationDialogPanel {
|
|
|
|
fn update(&mut self, dt: f32) {
|
|
|
|
self.dialog.update(dt);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn draw(&mut self) {
|
|
|
|
let ctx = canary_script::draw::DrawContext::new(self.panel);
|
|
|
|
self.dialog.draw(&ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn on_cursor_event(&mut self, kind: CursorEventKind, at: canary_script::Vec2) {
|
|
|
|
self.dialog.on_cursor_event(kind, at.into());
|
|
|
|
}
|
|
|
|
}
|