Browse Source

[demo] add [DEBUG BUILD] warning text

strong-ids
Emil Ernerfeldt 4 years ago
parent
commit
496fdb52b4
  1. 1
      egui/src/demos/app.rs
  2. 1
      egui/src/demos/demo_windows.rs
  3. 23
      egui/src/demos/mod.rs

1
egui/src/demos/app.rs

@ -86,6 +86,7 @@ impl FrameHistory {
"Includes Egui layout and tesselation time.\n\
Does not include GPU usage, nor overhead for sending data to GPU.",
);
crate::demos::warn_if_debug_build(ui);
crate::CollapsingHeader::new("CPU usage history")
.default_open(false)

1
egui/src/demos/demo_windows.rs

@ -63,6 +63,7 @@ impl DemoWindows {
crate::SidePanel::left(Id::new("side_panel"), 200.0).show(ctx, |ui| {
ui.heading("Egui Demo");
crate::demos::warn_if_debug_build(ui);
ui.label("Egui is an immediate mode GUI library written in Rust.");
ui.add(crate::Hyperlink::new("https://github.com/emilk/egui").text("Egui home page"));

23
egui/src/demos/mod.rs

@ -20,3 +20,26 @@ pub const LOREM_IPSUM: &str = "Lorem ipsum dolor sit amet, consectetur adipiscin
pub const LOREM_IPSUM_LONG: &str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.";
// ----------------------------------------------------------------------------
#[cfg(debug_assertions)]
pub fn has_debug_assertions() -> bool {
true
}
#[cfg(not(debug_assertions))]
pub fn has_debug_assertions() -> bool {
false
}
pub fn warn_if_debug_build(ui: &mut crate::Ui) {
if has_debug_assertions() {
ui.label(
crate::Label::new("[Debug build]")
.small()
.text_color(crate::color::RED),
)
.on_hover_text("Egui has detect that debug assertions are enabled.");
}
}

Loading…
Cancel
Save