mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-25 08:18:43 -06:00
commit
This commit is contained in:
parent
ac497b0651
commit
d848f60301
|
@ -37,6 +37,16 @@ impl KubiUi {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn add<T: UiElement>(&mut self, element: T, max_size: Vec2) {
|
||||
let layout = LayoutInfo {
|
||||
position: Vec2::ZERO,
|
||||
max_size,
|
||||
direction: UiDirection::Vertical,
|
||||
};
|
||||
let measure = element.measure(&self.stateful_state, &layout);
|
||||
element.process(&measure, &mut self.stateful_state, &layout, &mut self.draw_commands.commands);
|
||||
}
|
||||
|
||||
pub fn begin(&mut self) {
|
||||
std::mem::swap(&mut self.prev_draw_commands, &mut self.draw_commands);
|
||||
self.draw_plan_modified = false;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use kubi_ui::{KubiUi, backend::glium::GliumUiRenderer};
|
||||
use glam::vec2;
|
||||
use kubi_ui::{KubiUi, backend::glium::GliumUiRenderer, element::{progress_bar::ProgressBar, UiElement}, UiSize};
|
||||
use shipyard::{AllStoragesView, Unique, UniqueView, NonSendSync, UniqueViewMut};
|
||||
use crate::rendering::{Renderer, RenderTarget, WindowSize};
|
||||
|
||||
|
@ -22,6 +23,10 @@ pub fn kubi_ui_begin(
|
|||
mut ui: NonSendSync<UniqueViewMut<UiState>>
|
||||
) {
|
||||
ui.ui.begin();
|
||||
ui.ui.add(ProgressBar {
|
||||
size: (UiSize::Pixels(300.), UiSize::Auto),
|
||||
..Default::default()
|
||||
}, vec2(999., 999.));
|
||||
}
|
||||
|
||||
pub fn kubi_ui_end(
|
||||
|
|
|
@ -159,6 +159,7 @@ fn render() -> Workload {
|
|||
render_entities,
|
||||
).into_sequential_workload().run_if(is_ingame),
|
||||
legacy_ui_render,
|
||||
kubi_ui_draw,
|
||||
).into_sequential_workload()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue