Compare commits

..

No commits in common. "3f0697d57302eef6e632a98f872059c8a92f97d0" and "ec23cedb7a9341616e0207b4f9e9f6e8f383f8d0" have entirely different histories.

5 changed files with 22 additions and 44 deletions

19
Cargo.lock generated
View file

@ -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=6eb3d98ad4#6eb3d98ad4747b34a366d6d92ba6f1df3bec4ba4" source = "git+https://github.com/griffi-gh/hui?rev=3a50d2d0dde#3a50d2d0dde7044d02860dac9ab059bd353657a2"
dependencies = [ dependencies = [
"derive_more", "derive_more",
"derive_setters", "derive_setters",
@ -1008,28 +1008,16 @@ 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=6eb3d98ad4#6eb3d98ad4747b34a366d6d92ba6f1df3bec4ba4" source = "git+https://github.com/griffi-gh/hui?rev=3a50d2d0dde#3a50d2d0dde7044d02860dac9ab059bd353657a2"
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=6eb3d98ad4#6eb3d98ad4747b34a366d6d92ba6f1df3bec4ba4"
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=6eb3d98ad4#6eb3d98ad4747b34a366d6d92ba6f1df3bec4ba4" source = "git+https://github.com/griffi-gh/hui?rev=3a50d2d0dde#3a50d2d0dde7044d02860dac9ab059bd353657a2"
dependencies = [ dependencies = [
"glam", "glam",
"hui", "hui",
@ -1223,7 +1211,6 @@ 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",

View file

@ -40,8 +40,3 @@ opt-level = 3
#enabling debug assertions here causes the game to abort #enabling debug assertions here causes the game to abort
[profile.dev.package.android-activity] [profile.dev.package.android-activity]
debug-assertions = false debug-assertions = false
# [patch.'https://github.com/griffi-gh/hui']
# hui = { path = "X:/Projects/hui/hui" }
# hui-winit = { path = "X:/Projects/hui/hui-winit" }
# hui-wgpu = { path = "X:/Projects/hui/hui-wgpu" }

View file

@ -11,9 +11,8 @@ 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 = "6eb3d98ad4" } hui = { git = "https://github.com/griffi-gh/hui", rev = "3a50d2d0dde" }
hui-wgpu = { git = "https://github.com/griffi-gh/hui", rev = "6eb3d98ad4" } hui-winit = { git = "https://github.com/griffi-gh/hui", rev = "3a50d2d0dde", features = ["winit_30"] }
hui-winit = { git = "https://github.com/griffi-gh/hui", rev = "6eb3d98ad4", 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"

View file

@ -1,13 +1,12 @@
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::{RenderCtx, Renderer}; use crate::rendering::Renderer;
#[derive(Unique)] #[derive(Unique)]
pub struct UiState { pub struct UiState {
pub hui: UiInstance, pub hui: UiInstance,
pub renderer: WgpuUiRenderer, //pub renderer: GliumUiRenderer
} }
pub fn kubi_ui_init( pub fn kubi_ui_init(
@ -16,7 +15,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: WgpuUiRenderer::new(renderer.device(), renderer.surface_config().format), //renderer: GliumUiRenderer::new(&renderer.display),
}); });
} }
@ -27,21 +26,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_renderer } = ui; let UiState { hui, /*renderer,*/ .. } = ui;
hui.end(); hui.end();
ui_renderer.update(hui, renderer.queue(), renderer.device(), renderer.size_vec2()); //renderer.update(hui);
} }
pub fn kubi_ui_draw( // pub fn kubi_ui_draw(
ctx: &mut RenderCtx, // ui: NonSendSync<UniqueView<UiState>>,
ui: NonSendSync<UniqueView<UiState>>, // mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
) { // 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<()>,

View file

@ -1,7 +1,7 @@
use shipyard::{AllStoragesViewMut, IntoIter, IntoWorkload, SystemModificator, Unique, UniqueView, UniqueViewMut, View, Workload}; use shipyard::{AllStoragesViewMut, IntoIter, IntoWorkload, SystemModificator, Unique, UniqueView, UniqueViewMut, View, Workload, WorkloadModificator};
use winit::dpi::PhysicalSize; use winit::dpi::PhysicalSize;
use glam::Vec3; use glam::Vec3;
use crate::{events::WindowResizedEvent, hui_integration::kubi_ui_draw, state::is_ingame}; use crate::{events::WindowResizedEvent, 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,8 +76,6 @@ 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();
} }