mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-22 06:48:43 -06:00
integrate hui-winit
This commit is contained in:
parent
8e907a9fbc
commit
8c5b0aa47e
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -960,6 +960,17 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hui-winit"
|
||||||
|
version = "0.1.0-alpha.4"
|
||||||
|
source = "git+https://github.com/griffi-gh/hui?rev=dd5af8b9e2#dd5af8b9e2dc4cb2beb0b130d82167258ea2bd4e"
|
||||||
|
dependencies = [
|
||||||
|
"glam",
|
||||||
|
"hui",
|
||||||
|
"log",
|
||||||
|
"winit",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "humantime"
|
name = "humantime"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
|
@ -1148,6 +1159,7 @@ dependencies = [
|
||||||
"hashbrown 0.14.3",
|
"hashbrown 0.14.3",
|
||||||
"hui",
|
"hui",
|
||||||
"hui-glium",
|
"hui-glium",
|
||||||
|
"hui-winit",
|
||||||
"image",
|
"image",
|
||||||
"kubi-logging",
|
"kubi-logging",
|
||||||
"kubi-shared",
|
"kubi-shared",
|
||||||
|
|
|
@ -13,6 +13,7 @@ kubi-shared = { path = "../kubi-shared" }
|
||||||
kubi-logging = { path = "../kubi-logging" }
|
kubi-logging = { path = "../kubi-logging" }
|
||||||
hui = { version = "0.1.0-alpha.4", git = "https://github.com/griffi-gh/hui", rev = "dd5af8b9e2" }
|
hui = { version = "0.1.0-alpha.4", git = "https://github.com/griffi-gh/hui", rev = "dd5af8b9e2" }
|
||||||
hui-glium = { version = "0.1.0-alpha.4", git = "https://github.com/griffi-gh/hui", rev = "dd5af8b9e2" }
|
hui-glium = { version = "0.1.0-alpha.4", git = "https://github.com/griffi-gh/hui", rev = "dd5af8b9e2" }
|
||||||
|
hui-winit = { version = "0.1.0-alpha.4", git = "https://github.com/griffi-gh/hui", rev = "dd5af8b9e2" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
glium = { git = "https://github.com/glium/glium", rev = "a352c667" }
|
glium = { git = "https://github.com/glium/glium", rev = "a352c667" }
|
||||||
glutin = "0.31"
|
glutin = "0.31"
|
||||||
|
|
|
@ -41,3 +41,10 @@ pub fn kubi_ui_draw(
|
||||||
) {
|
) {
|
||||||
ui.renderer.draw(&mut target.0, size.0.as_vec2());
|
ui.renderer.draw(&mut target.0, size.0.as_vec2());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn hui_process_winit_events(
|
||||||
|
event: &winit::event::Event<()>,
|
||||||
|
mut ui: NonSendSync<UniqueViewMut<UiState>>,
|
||||||
|
) {
|
||||||
|
hui_winit::handle_winit_event(&mut ui.hui, event);
|
||||||
|
}
|
||||||
|
|
|
@ -95,6 +95,8 @@ use chat::init_chat_manager;
|
||||||
use crosshair_ui::{init_crosshair_image, draw_crosshair};
|
use crosshair_ui::{init_crosshair_image, draw_crosshair};
|
||||||
use settings_ui::render_settings_ui;
|
use settings_ui::render_settings_ui;
|
||||||
|
|
||||||
|
use crate::hui_integration::hui_process_winit_events;
|
||||||
|
|
||||||
/// stuff required to init the renderer and other basic systems
|
/// stuff required to init the renderer and other basic systems
|
||||||
fn pre_startup() -> Workload {
|
fn pre_startup() -> Workload {
|
||||||
(
|
(
|
||||||
|
@ -280,6 +282,7 @@ pub fn kubi_main(
|
||||||
|
|
||||||
window_target.set_control_flow(ControlFlow::Poll);
|
window_target.set_control_flow(ControlFlow::Poll);
|
||||||
|
|
||||||
|
world.run_with_data(hui_process_winit_events, &event);
|
||||||
process_winit_events(&mut world, &event);
|
process_winit_events(&mut world, &event);
|
||||||
|
|
||||||
#[allow(clippy::collapsible_match, clippy::single_match)]
|
#[allow(clippy::collapsible_match, clippy::single_match)]
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
use hui::{color, element::{br::Break, container::Container, slider::Slider, text::Text, UiElementExt}, layout::{Alignment, Direction}, signal::Signal, size};
|
use hui::{
|
||||||
|
element::{br::Break, container::Container, slider::Slider, text::Text, UiElementExt},
|
||||||
|
layout::{Alignment, Direction},
|
||||||
|
signal::Signal,
|
||||||
|
frame_rect, size,
|
||||||
|
};
|
||||||
use shipyard::{NonSendSync, UniqueView, UniqueViewMut};
|
use shipyard::{NonSendSync, UniqueView, UniqueViewMut};
|
||||||
use winit::keyboard::KeyCode;
|
use winit::keyboard::KeyCode;
|
||||||
use crate::{hui_integration::UiState, input::RawKbmInputState, rendering::WindowSize, settings::GameSettings};
|
use crate::{hui_integration::UiState, input::RawKbmInputState, rendering::WindowSize, settings::GameSettings};
|
||||||
|
@ -20,10 +25,14 @@ pub fn render_settings_ui(
|
||||||
}
|
}
|
||||||
Container::default()
|
Container::default()
|
||||||
.with_size(size!(100%))
|
.with_size(size!(100%))
|
||||||
|
.with_background((0., 0., 0., 0.5))
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_children(|ui| {
|
.with_children(|ui| {
|
||||||
Container::default()
|
Container::default()
|
||||||
.with_background(color::BLACK)
|
.with_background(frame_rect! {
|
||||||
|
color: (0.2, 0.2, 0.2),
|
||||||
|
corner_radius: 8.
|
||||||
|
})
|
||||||
.with_size(size!(50%, 50%))
|
.with_size(size!(50%, 50%))
|
||||||
.with_direction(Direction::Horizontal)
|
.with_direction(Direction::Horizontal)
|
||||||
.with_gap(10.)
|
.with_gap(10.)
|
||||||
|
|
Loading…
Reference in a new issue