wgui: interactable components, rename TextLabel -> WidgetLabel

This commit is contained in:
Aleksander
2025-08-10 11:46:01 +02:00
parent 91e584383f
commit 93a3fee349
26 changed files with 294 additions and 174 deletions

View File

@@ -12,24 +12,24 @@ use crate::{
use super::{WidgetObj, WidgetState};
#[derive(Default)]
pub struct SpriteBoxParams {
#[derive(Debug, Default)]
pub struct WidgetSpriteParams {
pub glyph_data: Option<CustomGlyphData>,
pub color: Option<drawing::Color>,
}
#[derive(Default)]
pub struct SpriteBox {
params: SpriteBoxParams,
#[derive(Debug, Default)]
pub struct WidgetSprite {
params: WidgetSpriteParams,
}
impl SpriteBox {
pub fn create(params: SpriteBoxParams) -> anyhow::Result<WidgetState> {
impl WidgetSprite {
pub fn create(params: WidgetSpriteParams) -> anyhow::Result<WidgetState> {
WidgetState::new(Box::new(Self { params }))
}
}
impl WidgetObj for SpriteBox {
impl WidgetObj for WidgetSprite {
fn draw(&mut self, state: &mut super::DrawState, _params: &super::DrawParams) {
let boundary = drawing::Boundary::construct(state.transform_stack);