mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-21 22:38:41 -06:00
owo
This commit is contained in:
parent
f15ae91155
commit
726dfa4b52
|
@ -1,4 +1,4 @@
|
||||||
use std::time::Instant;
|
use std::{time::Instant, vec};
|
||||||
use glam::{UVec2, vec4};
|
use glam::{UVec2, vec4};
|
||||||
use glium::{backend::glutin::SimpleWindowBuilder, Surface};
|
use glium::{backend::glutin::SimpleWindowBuilder, Surface};
|
||||||
use winit::{
|
use winit::{
|
||||||
|
@ -10,7 +10,7 @@ use kubi_ui::{
|
||||||
element::{
|
element::{
|
||||||
progress_bar::ProgressBar,
|
progress_bar::ProgressBar,
|
||||||
container::{Container, Sides, Alignment},
|
container::{Container, Sides, Alignment},
|
||||||
text::Text, rect::Rect
|
text::Text, rect::Rect, spacer::Spacer
|
||||||
},
|
},
|
||||||
UiSize,
|
UiSize,
|
||||||
elements,
|
elements,
|
||||||
|
@ -28,6 +28,7 @@ fn main() {
|
||||||
let mut backend = GliumUiRenderer::new(&display);
|
let mut backend = GliumUiRenderer::new(&display);
|
||||||
|
|
||||||
let font_handle = kui.add_font_from_bytes(include_bytes!("../../assets/fonts/roboto/Roboto-Regular.ttf"));
|
let font_handle = kui.add_font_from_bytes(include_bytes!("../../assets/fonts/roboto/Roboto-Regular.ttf"));
|
||||||
|
let instant = Instant::now();
|
||||||
|
|
||||||
event_loop.run(|event, window_target| {
|
event_loop.run(|event, window_target| {
|
||||||
window_target.set_control_flow(ControlFlow::Poll);
|
window_target.set_control_flow(ControlFlow::Poll);
|
||||||
|
@ -81,20 +82,23 @@ fn main() {
|
||||||
text_size: 32,
|
text_size: 32,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
elem.add(Rect {
|
if instant.elapsed().as_secs() & 1 != 0 {
|
||||||
size: (UiSize::Percentage(1.), UiSize::Pixels(10.)),
|
elem.add(Rect {
|
||||||
color: Some(vec4(1., 0., 0., 1.)),
|
size: (UiSize::Percentage(1.), UiSize::Pixels(10.)),
|
||||||
});
|
color: Some(vec4(1., 0., 0., 1.)),
|
||||||
elem.add(Rect {
|
});
|
||||||
size: (UiSize::Percentage(1.), UiSize::Pixels(10.)),
|
elem.add(Rect {
|
||||||
color: Some(vec4(0., 0., 0., 1.)),
|
size: (UiSize::Percentage(1.), UiSize::Pixels(10.)),
|
||||||
});
|
color: Some(vec4(0., 0., 0., 1.)),
|
||||||
elem.add(Text {
|
});
|
||||||
text: "OVERLAP TEST".into(),
|
elem.add(Spacer(100.));
|
||||||
font: font_handle,
|
elem.add(Text {
|
||||||
text_size: 15,
|
text: "FLAG SHOULD NOT OVERLAP".into(),
|
||||||
..Default::default()
|
text_size: 64,
|
||||||
});
|
color: vec4(1., 0., 1., 1.),
|
||||||
|
..Default::default()
|
||||||
|
});
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}, resolution);
|
}, resolution);
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
draw::{UiDrawCommand, UiDrawCommands}
|
draw::{UiDrawCommand, UiDrawCommands}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Spacer(f32);
|
pub struct Spacer(pub f32);
|
||||||
|
|
||||||
impl Default for Spacer {
|
impl Default for Spacer {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
|
|
Loading…
Reference in a new issue