text shadow + battery display poc
This commit is contained in:
@@ -20,13 +20,16 @@
|
||||
|
||||
<template name="Device">
|
||||
<sprite color="~device_color" width="${size}" height="${size}" src="${src}" />
|
||||
<div position="absolute" margin_top="10" margin_left="9">
|
||||
<label _source="battery" _device="${device}" size="18" shadow="#000000" weight="bold" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template name="Set">
|
||||
<Button macro="button_style" _press="::OverlayToggle ${handle}">
|
||||
<sprite width="40" height="40" color="~set_color" src="watch/set2.svg" />
|
||||
<div position="absolute" margin_top="11">
|
||||
<label text="${display}" size="24" color="#000000" weight="bold" />
|
||||
<div position="absolute" margin_top="9">
|
||||
<label text="${display}" size="24" color="#00050F" weight="bold" />
|
||||
</div>
|
||||
</Button>
|
||||
</template>
|
||||
@@ -35,12 +38,12 @@
|
||||
<div width="400" height="200">
|
||||
<rectangle width="100%" height="100%" padding="4" box_sizing="content_box" flex_wrap="wrap" flex_direction="column" gap="4" color="~bg_color">
|
||||
<div width="100%" flex_direction="row">
|
||||
<Device src="watch/hmd.svg" size="40" />
|
||||
<Device src="watch/controller_l.svg" size="36" />
|
||||
<Device src="watch/controller_r.svg" size="36" />
|
||||
<Device src="watch/track3.svg" size="40" />
|
||||
<Device src="watch/track3.svg" size="40" />
|
||||
<Device src="watch/track3.svg" size="40" />
|
||||
<Device src="watch/hmd.svg" size="40" device="0" />
|
||||
<Device src="watch/controller_l.svg" size="36" device="1" />
|
||||
<Device src="watch/controller_r.svg" size="36" device="2" />
|
||||
<Device src="watch/track3.svg" size="40" device="3" />
|
||||
<Device src="watch/track3.svg" size="40" device="4" />
|
||||
<Device src="watch/track3.svg" size="40" device="5" />
|
||||
</div>
|
||||
<div flex_direction="row">
|
||||
<div flex_direction="column" padding="4">
|
||||
@@ -74,4 +77,4 @@
|
||||
</rectangle>
|
||||
</div>
|
||||
</elements>
|
||||
</layout>
|
||||
</layout>
|
||||
|
||||
@@ -376,16 +376,13 @@ fn battery_on_tick(
|
||||
app: &AppState,
|
||||
) {
|
||||
let device = app.input_state.devices.get(state.device);
|
||||
|
||||
let tags = ["", "H", "L", "R", "T"];
|
||||
|
||||
let label = data.obj.get_as_mut::<WidgetLabel>().unwrap();
|
||||
|
||||
if let Some(device) = device
|
||||
&& let Some(soc) = device.soc
|
||||
{
|
||||
let soc = (soc * 100.).min(99.) as u32;
|
||||
let text = format!("{}{}", tags[device.role as usize], soc);
|
||||
let text = soc.to_string();
|
||||
let color = if device.charging {
|
||||
state.charging_color
|
||||
} else if soc < state.low_threshold {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::{collections::HashMap, rc::Rc};
|
||||
|
||||
use glam::{Mat4, Vec2, Vec3, vec2, vec3a};
|
||||
use glam::{vec2, vec3a, Mat4, Vec2, Vec3};
|
||||
use wgui::{
|
||||
animation::{Animation, AnimationEasing},
|
||||
drawing::Color,
|
||||
@@ -20,13 +20,13 @@ use crate::{
|
||||
backend::overlay::{OverlayData, OverlayState, Positioning},
|
||||
gui::panel::GuiPanel,
|
||||
state::AppState,
|
||||
subsystem::hid::{ALT, CTRL, META, SHIFT, SUPER, XkbKeymap},
|
||||
subsystem::hid::{XkbKeymap, ALT, CTRL, META, SHIFT, SUPER},
|
||||
};
|
||||
|
||||
use super::{
|
||||
KEYBOARD_NAME, KeyButtonData, KeyState, KeyboardBackend, KeyboardState, handle_press,
|
||||
handle_release,
|
||||
handle_press, handle_release,
|
||||
layout::{self, AltModifier, KeyCapType},
|
||||
KeyButtonData, KeyState, KeyboardBackend, KeyboardState, KEYBOARD_NAME,
|
||||
};
|
||||
|
||||
const BACKGROUND_PADDING: f32 = 4.;
|
||||
|
||||
Reference in New Issue
Block a user