Use one standard Iris resource bundle

This commit is contained in:
iris committed 2026-09-11 02:09:17 -04:00
1 parent 6dbc800739
commit 7e5a4c0071
16 files changed
+129 -100

No files matched your search

+4 -8
View File
@@ -13,15 +13,11 @@ struct State {
}
impl DesktopAppState for State {
fn new(
mut ui_state: DesktopUiState,
rsc: &mut DesktopRsc<Self>,
_: Proxy<Self::Event>,
) -> Self {
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
let mut span = Span::empty(Dir::DOWN);
for _ in 0..ROWS {
let img = image::DynamicImage::new_rgba8(32, 32);
let widget = image::<DesktopRsc<Self>>(img)(rsc);
let widget = image::<StdRsc<Self>>(img)(rsc);
let widget = rsc.ui.widgets.add_strong(widget);
span.push(widget.any());
}
@@ -40,7 +36,7 @@ impl DesktopAppState for State {
}
}
fn window_event(&mut self, event: winit::event::WindowEvent, rsc: &mut DesktopRsc<Self>) {
fn window_event(&mut self, event: winit::event::WindowEvent, rsc: &mut StdRsc<Self>) {
if !matches!(event, winit::event::WindowEvent::RedrawRequested) {
return;
}
@@ -53,7 +49,7 @@ impl DesktopAppState for State {
if self.frame == SETTLE_FRAMES && !self.appended {
self.appended = true;
let img = image::DynamicImage::new_rgba8(32, 32);
let widget = image::<DesktopRsc<Self>>(img)(rsc);
let widget = image::<StdRsc<Self>>(img)(rsc);
let widget = rsc.ui.widgets.add_strong(widget);
rsc.ui
.widgets
+1 -5
View File
@@ -63,11 +63,7 @@ impl DesktopAppState for State {
WindowAttributes::default().with_inner_size(LogicalSize::new(420.0, 900.0))
}
fn new(
mut ui_state: DesktopUiState,
rsc: &mut DesktopRsc<Self>,
_: Proxy<Self::Event>,
) -> Self {
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
let mut list = LazySpan::new(Dir::DOWN, Pin::End);
for i in 0..ROWS {
let row = build_row(rsc, i);
+1 -5
View File
@@ -10,11 +10,7 @@ struct State {
}
impl DesktopAppState for State {
fn new(
mut ui_state: DesktopUiState,
rsc: &mut DesktopRsc<Self>,
_: Proxy<Self::Event>,
) -> Self {
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
rect(PaintId::RED).set_root(rsc, &mut ui_state);
Self { ui_state }
}
+2 -6
View File
@@ -12,11 +12,7 @@ pub struct Client {
}
impl DesktopAppState for Client {
fn new(
mut ui_state: DesktopUiState,
rsc: &mut DesktopRsc<Self>,
_: Proxy<Self::Event>,
) -> Self {
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
let widgets = tabs_ui::build(rsc, &mut ui_state);
Self {
ui_state,
@@ -24,7 +20,7 @@ impl DesktopAppState for Client {
}
}
fn window_event(&mut self, _: WindowEvent, rsc: &mut DesktopRsc<Self>) {
fn window_event(&mut self, _: WindowEvent, rsc: &mut StdRsc<Self>) {
let render_state = rsc.ui.render_state();
let new = format!(
"widgets: {}\nactive: {}\nviews: {}",
+1 -5
View File
@@ -11,11 +11,7 @@ struct State {
}
impl DesktopAppState for State {
fn new(
mut ui_state: DesktopUiState,
rsc: &mut DesktopRsc<Self>,
_: Proxy<Self::Event>,
) -> Self {
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
let rect = rect(PaintId::RED).add(rsc);
rect.task_on(CursorSense::click(), async move |mut ctx| {
tokio::time::sleep(Duration::from_secs(1)).await;
+2 -6
View File
@@ -9,7 +9,7 @@ struct State {
ui_state: DesktopUiState,
}
type Rsc = DesktopRsc<State>;
type Rsc = StdRsc<State>;
#[derive(Clone, Copy, WidgetView)]
struct Test {
@@ -36,11 +36,7 @@ impl Test {
}
impl DesktopAppState for State {
fn new(
mut ui_state: DesktopUiState,
rsc: &mut DesktopRsc<Self>,
_: Proxy<Self::Event>,
) -> Self {
fn new(mut ui_state: DesktopUiState, rsc: &mut StdRsc<Self>, _: Proxy<Self::Event>) -> Self {
let test = Test::new(rsc);
test.on(CursorSense::click(), move |_, rsc| {