mirror of
https://github.com/griffi-gh/hUI.git
synced 2025-04-01 21:46:29 -05:00
fix remaining examples
This commit is contained in:
parent
287b6f4144
commit
5aaa7bb282
|
@ -137,7 +137,7 @@ fn main() {
|
|||
|
||||
hui.end_frame();
|
||||
|
||||
backend.update(&hui);
|
||||
backend.update(&hui.backend_data());
|
||||
backend.draw(&mut frame, resolution);
|
||||
|
||||
frame.finish().unwrap();
|
||||
|
|
|
@ -43,7 +43,7 @@ ui_main!{
|
|||
if instant.elapsed().as_secs_f32() < 5. {
|
||||
Text::default()
|
||||
.with_text("Downloading your mom...")
|
||||
.with_text_size(24)
|
||||
.with_text_size(24.)
|
||||
.add_child(ui);
|
||||
ProgressBar::default()
|
||||
.with_value(mom_ratio)
|
||||
|
@ -63,7 +63,7 @@ ui_main!{
|
|||
.with_children(|ui| {
|
||||
Text::default()
|
||||
.with_text(format!("{:.2}% ({:.1} GB)", mom_ratio * 100., mom_ratio * 10000.))
|
||||
.with_text_size(16)
|
||||
.with_text_size(16.)
|
||||
.add_child(ui);
|
||||
})
|
||||
.add_child(ui);
|
||||
|
@ -71,11 +71,11 @@ ui_main!{
|
|||
Text::default()
|
||||
.with_text("Error 413: Request Entity Too Large")
|
||||
.with_color((1., 0.125, 0.125, 1.))
|
||||
.with_text_size(20)
|
||||
.with_text_size(20.)
|
||||
.add_child(ui);
|
||||
Text::default()
|
||||
.with_text(format!("Exiting in {}...", 10 - instant.elapsed().as_secs()))
|
||||
.with_text_size(16)
|
||||
.with_text_size(16.)
|
||||
.add_child(ui);
|
||||
} else {
|
||||
std::process::exit(0);
|
||||
|
|
|
@ -57,14 +57,14 @@ fn main() {
|
|||
}));
|
||||
elem.push(Box::new(Text {
|
||||
text: "THIS LINE SHOULD BE SHARP!".into(),
|
||||
text_size: 32,
|
||||
text_size: 32.,
|
||||
..Default::default()
|
||||
}));
|
||||
elem.push(Box::new(Text {
|
||||
text: "All lines except 3 and 6 below will be blurry:".into(),
|
||||
..Default::default()
|
||||
}));
|
||||
for size in [9, 12, 16, 18, 24, 32] {
|
||||
for size in [9., 12., 16., 18., 24., 32.] {
|
||||
elem.push(Box::new(Text {
|
||||
text: "Testing default font, Proggy Tiny".into(),
|
||||
text_size: size,
|
||||
|
@ -82,7 +82,7 @@ fn main() {
|
|||
elem.push(Box::new(Text {
|
||||
text: "Hello, world!\nżółty liść. życie nie ma sensu i wszyscy zginemy;\nтест кирилиці їїїїїїїїїїї\njapanese text: テスト".into(),
|
||||
font: Some(font_handle),
|
||||
text_size: 32,
|
||||
text_size: 32.,
|
||||
..Default::default()
|
||||
}));
|
||||
if instant.elapsed().as_secs() & 1 != 0 {
|
||||
|
@ -97,7 +97,7 @@ fn main() {
|
|||
elem.push(Box::new(Spacer(100.)));
|
||||
elem.push(Box::new(Text {
|
||||
text: "FLAG SHOULD NOT OVERLAP WITH TEXT".into(),
|
||||
text_size: 64,
|
||||
text_size: 64.,
|
||||
color: vec4(1., 0., 1., 1.),
|
||||
..Default::default()
|
||||
}));
|
||||
|
@ -108,7 +108,7 @@ fn main() {
|
|||
|
||||
hui.end_frame();
|
||||
|
||||
backend.update(&hui);
|
||||
backend.update(&hui.backend_data());
|
||||
backend.draw(&mut frame, resolution);
|
||||
|
||||
frame.finish().unwrap();
|
||||
|
|
|
@ -21,7 +21,7 @@ ui_main!(|ui, size, _| {
|
|||
.with_children(|ui| {
|
||||
Text::default()
|
||||
.with_text("Hello, world")
|
||||
.with_text_size(100)
|
||||
.with_text_size(100.)
|
||||
.with_color(color::BLACK)
|
||||
.add_child(ui);
|
||||
Container::default()
|
||||
|
@ -33,7 +33,7 @@ ui_main!(|ui, size, _| {
|
|||
.with_children(|ui| {
|
||||
Text::default()
|
||||
.with_text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
|
||||
.with_text_size(24)
|
||||
.with_text_size(24.)
|
||||
.add_child(ui);
|
||||
})
|
||||
.add_child(ui);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use hui::{
|
||||
color, size,
|
||||
signal::Signal,
|
||||
draw::TextureFormat,
|
||||
layout::{Alignment, Direction},
|
||||
element::{
|
||||
container::Container,
|
||||
|
@ -12,6 +11,7 @@ use hui::{
|
|||
UiElementExt,
|
||||
},
|
||||
};
|
||||
use hui_painter::texture::SourceTextureFormat;
|
||||
|
||||
#[derive(Signal)]
|
||||
enum CounterSignal {
|
||||
|
@ -28,7 +28,7 @@ const IMAGE_DATA: &[u8] = include_bytes!("../assets/icons/visual-studio-code-ico
|
|||
ui_main!(
|
||||
"hUI: Internal input test",
|
||||
init: |ui| {
|
||||
let image = ui.add_image(TextureFormat::Rgba, IMAGE_DATA, 32);
|
||||
let image = ui.add_image(SourceTextureFormat::RGBA8, IMAGE_DATA, 32);
|
||||
(0, image)
|
||||
},
|
||||
run: |ui, size, &mut (ref mut counter, image)| {
|
||||
|
@ -42,7 +42,7 @@ ui_main!(
|
|||
.with_wrap(true)
|
||||
.with_children(|ui| {
|
||||
Text::new("Number of images:")
|
||||
.with_text_size(24)
|
||||
.with_text_size(24.)
|
||||
.add_child(ui);
|
||||
Break.add_child(ui);
|
||||
Container::default()
|
||||
|
@ -50,7 +50,7 @@ ui_main!(
|
|||
.with_background(color::ORANGE)
|
||||
.with_children(|ui| {
|
||||
Text::new("-")
|
||||
.with_text_size(32)
|
||||
.with_text_size(32.)
|
||||
.add_child(ui);
|
||||
})
|
||||
.on_click(|| CounterSignal::Decrement)
|
||||
|
@ -60,7 +60,7 @@ ui_main!(
|
|||
.with_align(Alignment::Center)
|
||||
.with_children(|ui| {
|
||||
Text::new(counter.to_string())
|
||||
.with_text_size(64)
|
||||
.with_text_size(64.)
|
||||
.add_child(ui);
|
||||
})
|
||||
.add_child(ui);
|
||||
|
@ -69,7 +69,7 @@ ui_main!(
|
|||
.with_background(color::ORANGE)
|
||||
.with_children(|ui| {
|
||||
Text::new("+")
|
||||
.with_text_size(32)
|
||||
.with_text_size(32.)
|
||||
.add_child(ui);
|
||||
})
|
||||
.on_click(|| CounterSignal::Increment)
|
||||
|
|
|
@ -27,7 +27,7 @@ ui_main!(
|
|||
init: |ui| {
|
||||
(
|
||||
NinePatchAsset {
|
||||
image: ui.add_image_file_path("./hui-examples/assets/ninepatch_button.png").unwrap(),
|
||||
image: todo!(), //ui.add_image_file_path("./hui-examples/assets/ninepatch_button.png").unwrap(),
|
||||
size: (190, 49),
|
||||
scalable_region: Rect {
|
||||
position: vec2(8. / 190., 8. / 49.),
|
||||
|
@ -50,7 +50,7 @@ ui_main!(
|
|||
.with_padding(10.)
|
||||
.with_children(|ui| {
|
||||
Text::new("Hello, world!\nThis is a 9-patch frame used as a background \nfor Container with a Text element.\nIt's scalable and looks great!\nBelow, there are two FillRects with the same \n9-patch frame used as the background.")
|
||||
.with_text_size(16)
|
||||
.with_text_size(16.)
|
||||
.add_child(ui);
|
||||
})
|
||||
.add_child(ui);
|
||||
|
@ -60,7 +60,7 @@ ui_main!(
|
|||
.add_child(ui);
|
||||
Text::new("This one's fancy:")
|
||||
.with_color(color::BLACK)
|
||||
.with_text_size(32)
|
||||
.with_text_size(32.)
|
||||
.add_child(ui);
|
||||
FrameView::default()
|
||||
.with_size(size!(700, 50))
|
||||
|
@ -73,7 +73,7 @@ ui_main!(
|
|||
.add_child(ui);
|
||||
Text::new("Slider customized with `NinePatchFrame`s:")
|
||||
.with_color(color::BLACK)
|
||||
.with_text_size(32)
|
||||
.with_text_size(32.)
|
||||
.add_child(ui);
|
||||
Slider::new(*value)
|
||||
.with_size(size!(50%, 30))
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
use hui::{
|
||||
color, size,
|
||||
draw::{ImageHandle, TextureFormat},
|
||||
layout::{Alignment, Direction},
|
||||
element::{
|
||||
container::Container,
|
||||
|
@ -12,13 +11,14 @@ use hui::{
|
|||
UiElementExt
|
||||
},
|
||||
};
|
||||
use hui_painter::texture::{SourceTextureFormat, TextureHandle};
|
||||
|
||||
#[path = "../boilerplate.rs"]
|
||||
#[macro_use]
|
||||
mod boilerplate;
|
||||
|
||||
struct Stuff {
|
||||
vscode_icon: ImageHandle,
|
||||
vscode_icon: TextureHandle,
|
||||
}
|
||||
|
||||
ui_main!(
|
||||
|
@ -27,7 +27,7 @@ ui_main!(
|
|||
let handle = ui.add_font(include_bytes!("../assets/fira/FiraSans-Light.ttf"));
|
||||
ui.push_font(handle);
|
||||
Stuff {
|
||||
vscode_icon: ui.add_image(TextureFormat::Rgba, include_bytes!("../assets/icons/visual-studio-code-icon_32x32.rgba"), 32),
|
||||
vscode_icon: ui.add_image(SourceTextureFormat::RGBA8, include_bytes!("../assets/icons/visual-studio-code-icon_32x32.rgba"), 32),
|
||||
}
|
||||
},
|
||||
run: |ui, size, stuff| {
|
||||
|
@ -48,7 +48,7 @@ ui_main!(
|
|||
.add_child(ui);
|
||||
for item in ["File", "Edit", "Selection", "View", "Go", "Run", "Terminal", "Help"] {
|
||||
Text::new(item)
|
||||
.with_text_size(15)
|
||||
.with_text_size(15.)
|
||||
.add_child(ui);
|
||||
}
|
||||
Container::default()
|
||||
|
@ -56,7 +56,7 @@ ui_main!(
|
|||
.with_align((Alignment::End, Alignment::Center))
|
||||
.with_children(|ui| {
|
||||
Text::new("- ×")
|
||||
.with_text_size(32)
|
||||
.with_text_size(32.)
|
||||
.add_child(ui);
|
||||
})
|
||||
.add_child(ui);
|
||||
|
@ -111,12 +111,12 @@ ui_main!(
|
|||
.with_padding((10., 2.))
|
||||
.with_children(|ui| {
|
||||
Text::new("><")
|
||||
.with_text_size(13)
|
||||
.with_text_size(13.)
|
||||
.add_child(ui);
|
||||
})
|
||||
.add_child(ui);
|
||||
Text::new("master")
|
||||
.with_text_size(15)
|
||||
.with_text_size(15.)
|
||||
.add_child(ui);
|
||||
})
|
||||
.add_child(ui);
|
||||
|
|
Loading…
Reference in a new issue