wgui: Separate user and wgui assets, topmost widgets (poc)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
use std::{collections::HashMap, rc::Rc};
|
||||
|
||||
use glam::{vec2, vec3, Affine3A, Mat4, Quat, Vec2, Vec3};
|
||||
use glam::{Affine3A, Mat4, Quat, Vec2, Vec3, vec2, vec3};
|
||||
use wgui::{
|
||||
animation::{Animation, AnimationEasing},
|
||||
assets::AssetPath,
|
||||
drawing::Color,
|
||||
event::{self, CallbackMetadata, EventListenerKind},
|
||||
layout::LayoutParams,
|
||||
@@ -19,14 +20,14 @@ use wgui::{
|
||||
use crate::{
|
||||
gui::panel::GuiPanel,
|
||||
state::AppState,
|
||||
subsystem::hid::{XkbKeymap, ALT, CTRL, META, SHIFT, SUPER},
|
||||
subsystem::hid::{ALT, CTRL, META, SHIFT, SUPER, XkbKeymap},
|
||||
windowing::window::{OverlayWindowConfig, OverlayWindowState, Positioning},
|
||||
};
|
||||
|
||||
use super::{
|
||||
handle_press, handle_release,
|
||||
KEYBOARD_NAME, KeyButtonData, KeyState, KeyboardBackend, KeyboardState, handle_press,
|
||||
handle_release,
|
||||
layout::{self, AltModifier, KeyCapType},
|
||||
KeyButtonData, KeyState, KeyboardBackend, KeyboardState, KEYBOARD_NAME,
|
||||
};
|
||||
|
||||
const BACKGROUND_PADDING: f32 = 4.;
|
||||
@@ -54,7 +55,7 @@ pub fn create_keyboard(
|
||||
let mut panel = GuiPanel::new_blank(app, state)?;
|
||||
|
||||
let (background, _) = panel.layout.add_child(
|
||||
panel.layout.root_widget,
|
||||
panel.layout.content_root_widget,
|
||||
WidgetRectangle::create(WidgetRectangleParams {
|
||||
color: wgui::drawing::Color::new(0., 0., 0., 0.6),
|
||||
round: WLength::Units(4.0),
|
||||
@@ -75,7 +76,7 @@ pub fn create_keyboard(
|
||||
|
||||
let parse_doc_params = wgui::parser::ParseDocumentParams {
|
||||
globals: app.wgui_globals.clone(),
|
||||
path: "gui/keyboard.xml",
|
||||
path: AssetPath::BuiltIn("gui/keyboard.xml"),
|
||||
extra: Default::default(),
|
||||
};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::{
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
use glam::{vec3, Affine3A, Quat, Vec3};
|
||||
use glam::{Affine3A, Quat, Vec3, vec3};
|
||||
use idmap_derive::IntegerId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use wgui::{
|
||||
@@ -28,8 +28,8 @@ use crate::{
|
||||
gui::panel::GuiPanel,
|
||||
state::{AppState, LeftRight},
|
||||
windowing::{
|
||||
window::{OverlayWindowConfig, OverlayWindowState, Positioning},
|
||||
OverlaySelector, Z_ORDER_TOAST,
|
||||
window::{OverlayWindowConfig, OverlayWindowState, Positioning},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -144,8 +144,7 @@ fn new_toast(toast: Toast, app: &mut AppState) -> Option<OverlayWindowConfig> {
|
||||
Positioning::FollowHead { lerp: 0.1 },
|
||||
),
|
||||
DisplayMethod::Watch => {
|
||||
let mut watch_pos =
|
||||
Vec3::from(app.session.config.watch_pos) + vec3(-0.005, -0.05, 0.02);
|
||||
let mut watch_pos = app.session.config.watch_pos + vec3(-0.005, -0.05, 0.02);
|
||||
let mut watch_rot = app.session.config.watch_rot;
|
||||
let relative_to = match app.session.config.watch_hand {
|
||||
LeftRight::Left => Positioning::FollowHand { hand: 0, lerp: 1.0 },
|
||||
@@ -172,7 +171,7 @@ fn new_toast(toast: Toast, app: &mut AppState) -> Option<OverlayWindowConfig> {
|
||||
let (rect, _) = panel
|
||||
.layout
|
||||
.add_child(
|
||||
panel.layout.root_widget,
|
||||
panel.layout.content_root_widget,
|
||||
WidgetRectangle::create(WidgetRectangleParams {
|
||||
color: parse_color_hex("#1e2030").unwrap(),
|
||||
border_color: parse_color_hex("#5e7090").unwrap(),
|
||||
|
||||
Reference in New Issue
Block a user