mirror of
https://github.com/griffi-gh/hUI.git
synced 2024-11-25 00:18:41 -06:00
rename remaining stuff
This commit is contained in:
parent
b572f86595
commit
d2b7dbe7cb
|
@ -6,7 +6,7 @@ use winit::{
|
|||
event_loop::{EventLoopBuilder, ControlFlow}
|
||||
};
|
||||
use hui::{
|
||||
KubiUi,
|
||||
UiInstance,
|
||||
element::{
|
||||
progress_bar::ProgressBar,
|
||||
container::{Container, Sides, Alignment},
|
||||
|
@ -24,10 +24,10 @@ fn main() {
|
|||
let (window, display) = SimpleWindowBuilder::new().build(&event_loop);
|
||||
window.set_title("Mom Downloader 2000");
|
||||
|
||||
let mut kui = KubiUi::new();
|
||||
let mut hui = UiInstance::new();
|
||||
let mut backend = GliumUiRenderer::new(&display);
|
||||
|
||||
let font_handle = kui.add_font_from_bytes(include_bytes!("../assets/roboto/Roboto-Regular.ttf"));
|
||||
let font_handle = hui.add_font_from_bytes(include_bytes!("../assets/roboto/Roboto-Regular.ttf"));
|
||||
|
||||
let instant = Instant::now();
|
||||
|
||||
|
@ -43,11 +43,11 @@ fn main() {
|
|||
|
||||
let resolution = UVec2::from(display.get_framebuffer_dimensions()).as_vec2();
|
||||
|
||||
kui.begin();
|
||||
hui.begin();
|
||||
|
||||
let mom_ratio = (instant.elapsed().as_secs_f32() / 60.).powf(0.5);
|
||||
|
||||
kui.add(Container {
|
||||
hui.add(Container {
|
||||
align: (Alignment::Center, Alignment::Center),
|
||||
size: (UiSize::Percentage(1.), UiSize::Percentage(1.)),
|
||||
background: Some(vec4(0.1, 0.1, 0.1, 1.)),
|
||||
|
@ -98,9 +98,9 @@ fn main() {
|
|||
..Default::default()
|
||||
}, resolution);
|
||||
|
||||
kui.end();
|
||||
hui.end();
|
||||
|
||||
backend.update(&kui);
|
||||
backend.update(&hui);
|
||||
backend.draw(&mut frame, resolution);
|
||||
|
||||
frame.finish().unwrap();
|
||||
|
|
|
@ -6,7 +6,7 @@ use winit::{
|
|||
event_loop::{EventLoopBuilder, ControlFlow}
|
||||
};
|
||||
use hui::{
|
||||
KubiUi,
|
||||
UiInstance,
|
||||
element::{
|
||||
UiElement,
|
||||
progress_bar::ProgressBar,
|
||||
|
@ -22,7 +22,7 @@ fn main() {
|
|||
let event_loop = EventLoopBuilder::new().build().unwrap();
|
||||
let (window, display) = SimpleWindowBuilder::new().build(&event_loop);
|
||||
|
||||
let mut kui = KubiUi::new();
|
||||
let mut hui = UiInstance::new();
|
||||
let mut backend = GliumUiRenderer::new(&display);
|
||||
|
||||
let instant = Instant::now();
|
||||
|
@ -39,9 +39,9 @@ fn main() {
|
|||
|
||||
let resolution = UVec2::from(display.get_framebuffer_dimensions()).as_vec2();
|
||||
|
||||
kui.begin();
|
||||
hui.begin();
|
||||
|
||||
kui.add(Container {
|
||||
hui.add(Container {
|
||||
gap: 5.,
|
||||
padding: Sides::all(5.),
|
||||
elements: vec![
|
||||
|
@ -77,9 +77,9 @@ fn main() {
|
|||
..Default::default()
|
||||
}, resolution);
|
||||
|
||||
kui.end();
|
||||
hui.end();
|
||||
|
||||
backend.update(&kui);
|
||||
backend.update(&hui);
|
||||
backend.draw(&mut frame, resolution);
|
||||
|
||||
frame.finish().unwrap();
|
||||
|
|
|
@ -6,7 +6,7 @@ use winit::{
|
|||
event_loop::{EventLoopBuilder, ControlFlow}
|
||||
};
|
||||
use hui::{
|
||||
KubiUi,
|
||||
UiInstance,
|
||||
element::{
|
||||
UiElement,
|
||||
progress_bar::ProgressBar,
|
||||
|
@ -25,7 +25,7 @@ fn main() {
|
|||
let event_loop = EventLoopBuilder::new().build().unwrap();
|
||||
let (window, display) = SimpleWindowBuilder::new().build(&event_loop);
|
||||
|
||||
let mut kui = KubiUi::new();
|
||||
let mut hui = UiInstance::new();
|
||||
let mut backend = GliumUiRenderer::new(&display);
|
||||
|
||||
let instant = Instant::now();
|
||||
|
@ -41,11 +41,11 @@ fn main() {
|
|||
|
||||
let resolution = UVec2::from(display.get_framebuffer_dimensions()).as_vec2();
|
||||
|
||||
kui.begin();
|
||||
hui.begin();
|
||||
|
||||
let z = instant.elapsed().as_secs_f32().sin().powi(2);
|
||||
|
||||
kui.add(Container {
|
||||
hui.add(Container {
|
||||
gap: 5.,
|
||||
padding: Sides::all(5.),
|
||||
align: (Alignment::Begin, Alignment::Center),
|
||||
|
@ -59,7 +59,7 @@ fn main() {
|
|||
..Default::default()
|
||||
}, resolution);
|
||||
|
||||
kui.add(Container {
|
||||
hui.add(Container {
|
||||
gap: 5.,
|
||||
padding: Sides::all(5.),
|
||||
align: (Alignment::End, Alignment::Center),
|
||||
|
@ -133,9 +133,9 @@ fn main() {
|
|||
..Default::default()
|
||||
}, resolution);
|
||||
|
||||
kui.end();
|
||||
hui.end();
|
||||
|
||||
backend.update(&kui);
|
||||
backend.update(&hui);
|
||||
backend.draw(&mut frame, resolution);
|
||||
|
||||
frame.finish().unwrap();
|
||||
|
|
|
@ -6,7 +6,7 @@ use winit::{
|
|||
event_loop::{EventLoopBuilder, ControlFlow}
|
||||
};
|
||||
use hui::{
|
||||
KubiUi,
|
||||
UiInstance,
|
||||
element::{
|
||||
container::Container,
|
||||
text::Text, rect::Rect, spacer::Spacer
|
||||
|
@ -23,10 +23,10 @@ fn main() {
|
|||
let (window, display) = SimpleWindowBuilder::new().build(&event_loop);
|
||||
window.set_title("Text rendering test");
|
||||
|
||||
let mut kui = KubiUi::new();
|
||||
let mut hui = UiInstance::new();
|
||||
let mut backend = GliumUiRenderer::new(&display);
|
||||
|
||||
let font_handle = kui.add_font_from_bytes(include_bytes!("../assets/roboto/Roboto-Regular.ttf"));
|
||||
let font_handle = hui.add_font_from_bytes(include_bytes!("../assets/roboto/Roboto-Regular.ttf"));
|
||||
let instant = Instant::now();
|
||||
|
||||
event_loop.run(|event, window_target| {
|
||||
|
@ -41,9 +41,9 @@ fn main() {
|
|||
|
||||
let resolution = UVec2::from(display.get_framebuffer_dimensions()).as_vec2();
|
||||
|
||||
kui.begin();
|
||||
hui.begin();
|
||||
|
||||
kui.add(Container {
|
||||
hui.add(Container {
|
||||
size: (UiSize::Percentage(1.), UiSize::Percentage(1.)),
|
||||
background: Some(vec4(0.1, 0.1, 0.1, 1.)),
|
||||
elements: elements(|elem| {
|
||||
|
@ -102,9 +102,9 @@ fn main() {
|
|||
..Default::default()
|
||||
}, resolution);
|
||||
|
||||
kui.end();
|
||||
hui.end();
|
||||
|
||||
backend.update(&kui);
|
||||
backend.update(&hui);
|
||||
backend.draw(&mut frame, resolution);
|
||||
|
||||
frame.finish().unwrap();
|
||||
|
|
|
@ -10,7 +10,7 @@ use glium::{
|
|||
uniform, uniforms::{Sampler, SamplerBehavior, SamplerWrapFunction},
|
||||
};
|
||||
use hui::{
|
||||
KubiUi,
|
||||
UiInstance,
|
||||
draw::{UiDrawPlan, UiVertex, BindTexture},
|
||||
text::FontTextureInfo, IfModified,
|
||||
};
|
||||
|
@ -122,7 +122,7 @@ pub struct GliumUiRenderer {
|
|||
|
||||
impl GliumUiRenderer {
|
||||
pub fn new<F: Facade>(facade: &F) -> Self {
|
||||
log::info!("init glium backend for kui");
|
||||
log::info!("initializing hui glium backend");
|
||||
Self {
|
||||
program: Program::from_source(facade, VERTEX_SHADER, FRAGMENT_SHADER, None).unwrap(),
|
||||
program_tex: Program::from_source(facade, VERTEX_SHADER, FRAGMENT_SHADER_TEX, None).unwrap(),
|
||||
|
@ -172,11 +172,11 @@ impl GliumUiRenderer {
|
|||
).unwrap()));
|
||||
}
|
||||
|
||||
pub fn update(&mut self, kui: &KubiUi) {
|
||||
if let Some(texture) = kui.font_texture().if_modified() {
|
||||
pub fn update(&mut self, hui: &UiInstance) {
|
||||
if let Some(texture) = hui.font_texture().if_modified() {
|
||||
self.update_font_texture(texture);
|
||||
}
|
||||
if let Some(plan) = kui.draw_plan().if_modified() {
|
||||
if let Some(plan) = hui.draw_plan().if_modified() {
|
||||
self.update_draw_plan(plan);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ pub trait IfModified<T> {
|
|||
fn if_modified(&self) -> Option<&T>;
|
||||
}
|
||||
|
||||
pub struct KubiUi {
|
||||
pub struct UiInstance {
|
||||
//mouse_position: Vec2,
|
||||
stateful_state: StateRepo,
|
||||
//event_queue: VecDeque<UiEvent>,
|
||||
|
@ -33,9 +33,9 @@ pub struct KubiUi {
|
|||
text_renderer: TextRenderer,
|
||||
}
|
||||
|
||||
impl KubiUi {
|
||||
impl UiInstance {
|
||||
pub fn new() -> Self {
|
||||
KubiUi {
|
||||
UiInstance {
|
||||
//mouse_position: Vec2::ZERO,
|
||||
stateful_state: StateRepo::default(),
|
||||
//event_queue: VecDeque::new(),
|
||||
|
@ -87,7 +87,7 @@ impl KubiUi {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for KubiUi {
|
||||
impl Default for UiInstance {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue