Begin major refactor

This commit is contained in:
griffi-gh 2024-08-04 18:06:49 +02:00
parent 6eb3d98ad4
commit 7ef1929906
19 changed files with 93 additions and 25 deletions

View file

@ -1,3 +1,3 @@
[workspace]
resolver = "2"
members = ["hui", "hui-derive", "hui-examples", "hui-glium", "hui-wgpu", "hui-winit"]
members = ["hui", "hui-derive", "hui-examples", "hui-glium", "hui-painter", "hui-shared", "hui-wgpu", "hui-winit"]

View file

@ -86,11 +86,11 @@
</th>
<td>
<code>hui-glium = &lt;master&gt;</code><br>
<code>glium = "0.34"</code>
<code>glium = "0.35"</code>
</td>
<td>
<code>hui-winit = &lt;master&gt;</code><br>
<code>winit = "0.30"</code> or <code>winit = "0.29"</code>
<code>winit = "0.30"</code>
</td>
<td>
<code>hui-wgpu = &lt;master&gt;</code><br>

View file

@ -8,11 +8,11 @@ publish = false
[dev-dependencies]
hui = { path = "../hui" }
hui-glium = { path = "../hui-glium" }
hui-winit = { path = "../hui-winit", features = ["winit_29"] }
hui-winit = { path = "../hui-winit" }
kubi-logging = { git = "https://github.com/griffi-gh/kubi", rev = "c162893fd" }
glium = "0.34"
winit = "0.29"
glam = "0.27"
glium = "0.35"
winit = "0.30"
glam = "0.28"
log = "0.4"
image = { version = "0.25", features = ["jpeg", "png"] }

View file

@ -17,6 +17,6 @@ include = [
[dependencies]
hui = { version = "=0.1.0-alpha.5", path = "../hui", default-features = false }
glium = { version = "0.34", default-features = false }
glam = "0.27"
glium = { version = "0.35", default-features = false }
glam = "0.28"
log = "0.4"

20
hui-painter/Cargo.toml Normal file
View file

@ -0,0 +1,20 @@
[package]
name = "hui-painter"
description = "UI rendering middleware for hUI, abstracts away triangulation, text rendering and all the other hard stuff."
repository = "https://github.com/griffi-gh/hui"
readme = "../README.md"
authors = ["griffi-gh <prasol258@gmail.com>"]
rust-version = "1.75"
version = "0.1.0-alpha.5"
edition = "2021"
license = "GPL-3.0-or-later"
publish = true
include = [
"assets/**/*",
"src/**/*.rs",
"Cargo.toml",
]
[dependencies]
hui-shared = { version = "0.1.0-alpha.5", path = "../hui-shared" }
glam = "0.28"

17
hui-painter/src/lib.rs Normal file
View file

@ -0,0 +1,17 @@
//TODO painter rewrite
mod rect;
pub use rect::PaintRectParams;
pub struct PaintTransformParams {
transform: glam::Affine2,
}
pub enum PaintCommand {
Rect(PaintRectParams),
Transform(PaintTransformParams, Box<PaintCommand>),
}
pub struct Painter {
}

19
hui-painter/src/rect.rs Normal file
View file

@ -0,0 +1,19 @@
use glam::Vec2;
use hui_shared::rect::{Corners, FillColor};
pub struct PaintRectParams {
/// Position of the top-left corner of the rectangle.
pub position: Vec2,
/// Position of the bottom-right corner of the rectangle.
pub size: Vec2,
/// Color of the rectangle.
pub color: FillColor,
/// Border width.
pub border_radius: Corners<f32>,
/// Border color.
pub border_radius_points_override: Option<f32>,
}

7
hui-shared/Cargo.toml Normal file
View file

@ -0,0 +1,7 @@
[package]
name = "hui-shared"
version = "0.1.0-alpha.5"
edition = "2021"
[dependencies]
glam = "0.28"

1
hui-shared/src/lib.rs Normal file
View file

@ -0,0 +1 @@
pub mod rect;

View file

@ -20,4 +20,4 @@ hui = { version = "=0.1.0-alpha.5", path = "../hui", default-features = false }
wgpu = { version = "0.20", default-features = false, features = ["wgsl"]}
bytemuck = "1.15"
log = "0.4"
glam = "0.27"
glam = "0.28"

View file

@ -15,12 +15,13 @@ include = [
[dependencies]
hui = { version = "=0.1.0-alpha.5", path = "../hui", default-features = false }
winit_30 = { package = "winit", version = "0.30", default-features = false, optional = true }
winit_29 = { package = "winit", version = "0.29", default-features = false, optional = true }
glam = "0.27"
winit = { version = "0.30", default-features = false }
# winit_30 = { package = "winit", version = "0.30", default-features = false, optional = true }
# winit_29 = { package = "winit", version = "0.29", default-features = false, optional = true }
glam = "0.28"
log = "0.4"
[features]
default = []
winit_30 = ["dep:winit_30"]
winit_29 = ["dep:winit_29"]
# winit_30 = ["dep:winit_30"]
# winit_29 = ["dep:winit_29"]

View file

@ -1,9 +1,9 @@
#[cfg(all(feature = "winit_30", feature = "winit_29"))]
compile_error!("Only one of the winit_30 and winit_29 features can be enabled at a time");
#[cfg(not(any(feature = "winit_30", feature = "winit_29")))]
compile_error!("One of the winit_30 and winit_29 features must be enabled");
#[cfg(feature = "winit_30")] extern crate winit_30 as winit;
#[cfg(feature = "winit_29")] extern crate winit_29 as winit;
// #[cfg(all(feature = "winit_30", feature = "winit_29"))]
// compile_error!("Only one of the winit_30 and winit_29 features can be enabled at a time");
// #[cfg(not(any(feature = "winit_30", feature = "winit_29")))]
// compile_error!("One of the winit_30 and winit_29 features must be enabled");
// #[cfg(feature = "winit_30")] extern crate winit_30 as winit;
// #[cfg(feature = "winit_29")] extern crate winit_29 as winit;
use glam::vec2;
use hui::{event::UiEvent, UiInstance};

View file

@ -17,10 +17,12 @@ include = [
[dependencies]
hui-derive = { version = "0.1.0-alpha.5", path = "../hui-derive", optional = true }
hui-shared = { version = "0.1.0-alpha.5", path = "../hui-shared" }
hui-painter = { version = "0.1.0-alpha.5", path = "../hui-painter" }
hashbrown = "0.14"
nohash-hasher = "0.2"
glam = "0.27"
fontdue = "0.8"
glam = "0.28.0"
fontdue = "0.9"
rect_packer = "0.2"
log = "0.4"
document-features = "0.2"
@ -28,7 +30,7 @@ derive_setters = "0.1"
derive_more = "0.99"
tinyset = "0.4"
image = { version = "0.25", default-features = false, optional = true }
rustc-hash = "1.1"
rustc-hash = "2.0"
[features]
default = ["el_all", "image", "builtin_font", "pixel_perfect_text", "derive"]

View file

@ -11,10 +11,11 @@
#![forbid(unsafe_op_in_unsafe_fn)]
#![allow(unused_parens)]
pub use hui_shared::*;
mod instance;
mod macros;
pub mod layout;
pub mod rect;
pub mod element;
pub mod event;
pub mod input;