This commit is contained in:
griffi-gh 2023-12-02 21:20:20 +01:00
parent 82dd665008
commit 9ffe7a795f
2 changed files with 21 additions and 17 deletions

View file

@ -1,4 +1,4 @@
use std::time::Instant;
use std::{time::Instant, vec};
use glam::{UVec2, vec4};
use glium::{backend::glutin::SimpleWindowBuilder, Surface};
use winit::{
@ -10,7 +10,7 @@ use kubi_ui::{
element::{
progress_bar::ProgressBar,
container::{Container, Sides, Alignment},
text::Text, rect::Rect
text::Text, rect::Rect, spacer::Spacer
},
UiSize,
elements,
@ -28,6 +28,7 @@ fn main() {
let mut backend = GliumUiRenderer::new(&display);
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| {
window_target.set_control_flow(ControlFlow::Poll);
@ -81,6 +82,7 @@ fn main() {
text_size: 32,
..Default::default()
});
if instant.elapsed().as_secs() & 1 != 0 {
elem.add(Rect {
size: (UiSize::Percentage(1.), UiSize::Pixels(10.)),
color: Some(vec4(1., 0., 0., 1.)),
@ -89,12 +91,14 @@ fn main() {
size: (UiSize::Percentage(1.), UiSize::Pixels(10.)),
color: Some(vec4(0., 0., 0., 1.)),
});
elem.add(Spacer(100.));
elem.add(Text {
text: "OVERLAP TEST".into(),
font: font_handle,
text_size: 15,
text: "FLAG SHOULD NOT OVERLAP".into(),
text_size: 64,
color: vec4(1., 0., 1., 1.),
..Default::default()
});
}
}),
..Default::default()
}, resolution);

View file

@ -8,7 +8,7 @@ use crate::{
draw::{UiDrawCommand, UiDrawCommands}
};
pub struct Spacer(f32);
pub struct Spacer(pub f32);
impl Default for Spacer {
fn default() -> Self {