mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-25 05:08:21 -06:00
kubiui integration update
This commit is contained in:
parent
ba406d812e
commit
d21104decc
19
Cargo.lock
generated
19
Cargo.lock
generated
|
@ -988,7 +988,7 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hui"
|
name = "hui"
|
||||||
version = "0.1.0-alpha.5"
|
version = "0.1.0-alpha.5"
|
||||||
source = "git+https://github.com/griffi-gh/hui?rev=3a50d2d0dde#3a50d2d0dde7044d02860dac9ab059bd353657a2"
|
source = "git+https://github.com/griffi-gh/hui?rev=b6dc8f370b6#b6dc8f370b6dac971394e8cb82fdb505b529e964"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"derive_setters",
|
"derive_setters",
|
||||||
|
@ -1008,16 +1008,28 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hui-derive"
|
name = "hui-derive"
|
||||||
version = "0.1.0-alpha.5"
|
version = "0.1.0-alpha.5"
|
||||||
source = "git+https://github.com/griffi-gh/hui?rev=3a50d2d0dde#3a50d2d0dde7044d02860dac9ab059bd353657a2"
|
source = "git+https://github.com/griffi-gh/hui?rev=b6dc8f370b6#b6dc8f370b6dac971394e8cb82fdb505b529e964"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.60",
|
"syn 2.0.60",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hui-wgpu"
|
||||||
|
version = "0.1.0-alpha.5"
|
||||||
|
source = "git+https://github.com/griffi-gh/hui?rev=b6dc8f370b6#b6dc8f370b6dac971394e8cb82fdb505b529e964"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck",
|
||||||
|
"glam",
|
||||||
|
"hui",
|
||||||
|
"log",
|
||||||
|
"wgpu",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hui-winit"
|
name = "hui-winit"
|
||||||
version = "0.1.0-alpha.5"
|
version = "0.1.0-alpha.5"
|
||||||
source = "git+https://github.com/griffi-gh/hui?rev=3a50d2d0dde#3a50d2d0dde7044d02860dac9ab059bd353657a2"
|
source = "git+https://github.com/griffi-gh/hui?rev=b6dc8f370b6#b6dc8f370b6dac971394e8cb82fdb505b529e964"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glam",
|
"glam",
|
||||||
"hui",
|
"hui",
|
||||||
|
@ -1211,6 +1223,7 @@ dependencies = [
|
||||||
"glam",
|
"glam",
|
||||||
"hashbrown 0.14.5",
|
"hashbrown 0.14.5",
|
||||||
"hui",
|
"hui",
|
||||||
|
"hui-wgpu",
|
||||||
"hui-winit",
|
"hui-winit",
|
||||||
"image",
|
"image",
|
||||||
"kubi-logging",
|
"kubi-logging",
|
||||||
|
|
|
@ -11,8 +11,9 @@ crate-type = ["lib", "cdylib"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
kubi-shared = { path = "../kubi-shared" }
|
kubi-shared = { path = "../kubi-shared" }
|
||||||
kubi-logging = { path = "../kubi-logging" }
|
kubi-logging = { path = "../kubi-logging" }
|
||||||
hui = { git = "https://github.com/griffi-gh/hui", rev = "3a50d2d0dde" }
|
hui = { git = "https://github.com/griffi-gh/hui", rev = "b6dc8f370b6" }
|
||||||
hui-winit = { git = "https://github.com/griffi-gh/hui", rev = "3a50d2d0dde", features = ["winit_30"] }
|
hui-wgpu = { git = "https://github.com/griffi-gh/hui", rev = "b6dc8f370b6" }
|
||||||
|
hui-winit = { git = "https://github.com/griffi-gh/hui", rev = "b6dc8f370b6", features = ["winit_30"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
wgpu = { version = "0.20", features = ["webgl"] }
|
wgpu = { version = "0.20", features = ["webgl"] }
|
||||||
pollster = "0.3"
|
pollster = "0.3"
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
use hui::UiInstance;
|
use hui::UiInstance;
|
||||||
|
use hui_wgpu::WgpuUiRenderer;
|
||||||
//use hui_glium::GliumUiRenderer;
|
//use hui_glium::GliumUiRenderer;
|
||||||
use shipyard::{AllStoragesView, Unique, UniqueView, NonSendSync, UniqueViewMut};
|
use shipyard::{AllStoragesView, Unique, UniqueView, NonSendSync, UniqueViewMut};
|
||||||
use crate::rendering::Renderer;
|
use crate::rendering::{RenderCtx, Renderer};
|
||||||
|
|
||||||
#[derive(Unique)]
|
#[derive(Unique)]
|
||||||
pub struct UiState {
|
pub struct UiState {
|
||||||
pub hui: UiInstance,
|
pub hui: UiInstance,
|
||||||
//pub renderer: GliumUiRenderer
|
pub renderer: WgpuUiRenderer,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn kubi_ui_init(
|
pub fn kubi_ui_init(
|
||||||
|
@ -15,7 +16,7 @@ pub fn kubi_ui_init(
|
||||||
let renderer = storages.borrow::<NonSendSync<UniqueView<Renderer>>>().unwrap();
|
let renderer = storages.borrow::<NonSendSync<UniqueView<Renderer>>>().unwrap();
|
||||||
storages.add_unique_non_send_sync(UiState {
|
storages.add_unique_non_send_sync(UiState {
|
||||||
hui: UiInstance::new(),
|
hui: UiInstance::new(),
|
||||||
//renderer: GliumUiRenderer::new(&renderer.display),
|
renderer: WgpuUiRenderer::new(renderer.device(), renderer.surface_config().format),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,21 +27,21 @@ pub fn kubi_ui_begin(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn kubi_ui_end(
|
pub fn kubi_ui_end(
|
||||||
mut ui: NonSendSync<UniqueViewMut<UiState>>
|
mut ui: NonSendSync<UniqueViewMut<UiState>>,
|
||||||
|
renderer: UniqueView<Renderer>,
|
||||||
) {
|
) {
|
||||||
let ui: &mut UiState = &mut ui;
|
let ui: &mut UiState = &mut ui;
|
||||||
let UiState { hui, /*renderer,*/ .. } = ui;
|
let UiState { hui, renderer: ui_renderer } = ui;
|
||||||
hui.end();
|
hui.end();
|
||||||
//renderer.update(hui);
|
ui_renderer.update(hui, renderer.queue(), renderer.device(), renderer.size_vec2());
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn kubi_ui_draw(
|
pub fn kubi_ui_draw(
|
||||||
// ui: NonSendSync<UniqueView<UiState>>,
|
ctx: &mut RenderCtx,
|
||||||
// mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
ui: NonSendSync<UniqueView<UiState>>,
|
||||||
// size: UniqueView<WindowSize>
|
) {
|
||||||
// ) {
|
ui.renderer.draw(ctx.encoder, ctx.surface_view);
|
||||||
// ui.renderer.draw(&mut target.0, size.0.as_vec2());
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
pub fn hui_process_winit_events(
|
pub fn hui_process_winit_events(
|
||||||
event: &winit::event::Event<()>,
|
event: &winit::event::Event<()>,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use shipyard::{AllStoragesViewMut, IntoIter, IntoWorkload, SystemModificator, Unique, UniqueView, UniqueViewMut, View, Workload, WorkloadModificator};
|
use shipyard::{AllStoragesViewMut, IntoIter, IntoWorkload, SystemModificator, Unique, UniqueView, UniqueViewMut, View, Workload};
|
||||||
use winit::dpi::PhysicalSize;
|
use winit::dpi::PhysicalSize;
|
||||||
use glam::Vec3;
|
use glam::Vec3;
|
||||||
use crate::{events::WindowResizedEvent, state::is_ingame};
|
use crate::{events::WindowResizedEvent, hui_integration::kubi_ui_draw, state::is_ingame};
|
||||||
|
|
||||||
mod renderer;
|
mod renderer;
|
||||||
mod primitives;
|
mod primitives;
|
||||||
|
@ -24,7 +24,7 @@ pub struct BufferPair {
|
||||||
pub struct BackgroundColor(pub Vec3);
|
pub struct BackgroundColor(pub Vec3);
|
||||||
|
|
||||||
pub struct RenderCtx<'a> {
|
pub struct RenderCtx<'a> {
|
||||||
pub renderer: &'a Renderer,
|
//pub renderer: &'a Renderer,
|
||||||
pub encoder: &'a mut wgpu::CommandEncoder,
|
pub encoder: &'a mut wgpu::CommandEncoder,
|
||||||
pub surface_view: &'a wgpu::TextureView,
|
pub surface_view: &'a wgpu::TextureView,
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ pub fn render_master(storages: AllStoragesViewMut) {
|
||||||
let surface_view = surface_texture.texture.create_view(&wgpu::TextureViewDescriptor::default());
|
let surface_view = surface_texture.texture.create_view(&wgpu::TextureViewDescriptor::default());
|
||||||
|
|
||||||
let mut data = RenderCtx {
|
let mut data = RenderCtx {
|
||||||
renderer: &renderer,
|
//renderer: &renderer,
|
||||||
encoder: &mut encoder,
|
encoder: &mut encoder,
|
||||||
surface_view: &surface_view,
|
surface_view: &surface_view,
|
||||||
};
|
};
|
||||||
|
@ -76,6 +76,8 @@ pub fn render_master(storages: AllStoragesViewMut) {
|
||||||
storages.run_with_data(selection_box::draw_selection_box, &mut data);
|
storages.run_with_data(selection_box::draw_selection_box, &mut data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storages.run_with_data(kubi_ui_draw, &mut data);
|
||||||
|
|
||||||
renderer.queue().submit([encoder.finish()]);
|
renderer.queue().submit([encoder.finish()]);
|
||||||
surface_texture.present();
|
surface_texture.present();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue