finished moving out render_state

This commit is contained in:
2026-01-19 18:00:24 -05:00
parent 79813db3ba
commit 06dd015092
26 changed files with 497 additions and 221 deletions

View File

@@ -16,7 +16,11 @@ pub struct Client {
}
impl DefaultAppState for Client {
fn new(ui_state: DefaultUiState, rsc: &mut DefaultRsc<Self>, _: Proxy<Self::Event>) -> Self {
fn new(
mut ui_state: DefaultUiState,
rsc: &mut DefaultRsc<Self>,
_: Proxy<Self::Event>,
) -> Self {
let rrect = rect(Color::WHITE).radius(20);
let pad_test = (
rrect.color(Color::BLUE),
@@ -197,20 +201,25 @@ impl DefaultAppState for Client {
((tabs.height(40), main.pad(10)).span(Dir::DOWN), info_sect)
.stack()
.set_root(rsc);
.set_root(rsc, &mut ui_state);
Self { ui_state, info }
}
fn window_event(&mut self, _: WindowEvent, rsc: &mut DefaultRsc<Self>) {
fn window_event(
&mut self,
_: WindowEvent,
rsc: &mut DefaultRsc<Self>,
render: &mut UiRenderState,
) {
let new = format!(
"widgets: {}\nactive: {}\nviews: {}",
rsc.ui.num_widgets(),
rsc.ui.active_widgets(),
self.ui_state.renderer.ui.view_count()
rsc.widgets().len(),
render.active_widgets(),
self.ui_state.renderer.ui.view_count(),
);
if new != *rsc.ui[self.info].content {
*rsc.ui[self.info].content = new;
if new != *rsc.widgets()[self.info].content {
*rsc.widgets_mut()[self.info].content = new;
}
}
}