mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Merge branch 'master' of https://github.com/emilk/egui into multiples_viewports
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "egui_demo_lib"
|
||||
version = "0.22.0"
|
||||
version = "0.23.0"
|
||||
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
|
||||
description = "Example library for egui"
|
||||
edition = "2021"
|
||||
@@ -11,7 +11,13 @@ readme = "README.md"
|
||||
repository = "https://github.com/emilk/egui/tree/master/crates/egui_demo_lib"
|
||||
categories = ["gui", "graphics"]
|
||||
keywords = ["glium", "egui", "gui", "gamedev"]
|
||||
include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
|
||||
include = [
|
||||
"../LICENSE-APACHE",
|
||||
"../LICENSE-MIT",
|
||||
"**/*.rs",
|
||||
"Cargo.toml",
|
||||
"data/icon.png",
|
||||
]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
@@ -32,9 +38,9 @@ syntect = ["egui_extras/syntect"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
egui = { version = "0.22.0", path = "../egui", default-features = false }
|
||||
egui_extras = { version = "0.22.0", path = "../egui_extras" }
|
||||
egui_plot = { version = "0.22.0", path = "../egui_plot" }
|
||||
egui = { version = "0.23.0", path = "../egui", default-features = false }
|
||||
egui_extras = { version = "0.23.0", path = "../egui_extras" }
|
||||
egui_plot = { version = "0.23.0", path = "../egui_plot" }
|
||||
log = { version = "0.4", features = ["std"] }
|
||||
unicode_names2 = { version = "0.6.0", default-features = false }
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
@@ -11,6 +11,7 @@ impl super::Demo for About {
|
||||
fn show(&mut self, ctx: &egui::Context, open: &mut bool) {
|
||||
egui::Window::new(self.name())
|
||||
.default_width(320.0)
|
||||
.default_height(480.0)
|
||||
.open(open)
|
||||
.show(ctx, |ui| {
|
||||
use super::View as _;
|
||||
@@ -41,6 +42,15 @@ impl super::View for About {
|
||||
ui.add_space(12.0); // ui.separator();
|
||||
ui.heading("Links");
|
||||
links(ui);
|
||||
|
||||
ui.add_space(12.0);
|
||||
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 0.0;
|
||||
ui.label("egui development is sponsored by ");
|
||||
ui.hyperlink_to("Rerun.io", "https://www.rerun.io/");
|
||||
ui.label(", a startup building an SDK for visualizing streams of multimodal data");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,15 +75,10 @@ fn about_immediate_mode(ui: &mut egui::Ui) {
|
||||
);
|
||||
ui.add_space(8.0);
|
||||
|
||||
ui.label("Note how there are no callbacks or messages, and no button state to store.");
|
||||
|
||||
ui.label("Immediate mode has its roots in gaming, where everything on the screen is painted at the display refresh rate, i.e. at 60+ frames per second. \
|
||||
In immediate mode GUIs, the entire interface is laid out and painted at the same high rate. \
|
||||
This makes immediate mode GUIs especially well suited for highly interactive applications.");
|
||||
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 0.0;
|
||||
ui.label("More about immediate mode ");
|
||||
ui.label("There are no callbacks or messages, and no button state to store. ");
|
||||
ui.label("Read more about immediate mode ");
|
||||
ui.hyperlink_to("here", "https://github.com/emilk/egui#why-immediate-mode");
|
||||
ui.label(".");
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use egui::{Context, Modifiers, ScrollArea, Ui};
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use egui::{Context, Modifiers, NumExt as _, ScrollArea, Ui};
|
||||
|
||||
use super::About;
|
||||
use super::Demo;
|
||||
use super::View;
|
||||
@@ -180,7 +181,7 @@ impl DemoWindows {
|
||||
fn mobile_ui(&mut self, ctx: &Context) {
|
||||
if self.about_is_open {
|
||||
let screen_size = ctx.input(|i| i.screen_rect.size());
|
||||
let default_width = (screen_size.x - 20.0).min(400.0);
|
||||
let default_width = (screen_size.x - 32.0).at_most(400.0);
|
||||
|
||||
let mut close = false;
|
||||
egui::Window::new(self.about.name())
|
||||
@@ -243,7 +244,6 @@ impl DemoWindows {
|
||||
.resizable(false)
|
||||
.default_width(150.0)
|
||||
.show(ctx, |ui| {
|
||||
egui::trace!(ui);
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.heading("✒ egui demos");
|
||||
});
|
||||
|
||||
@@ -197,7 +197,7 @@ impl WidgetGallery {
|
||||
ui.end_row();
|
||||
|
||||
ui.add(doc_link_label("Image", "Image"));
|
||||
let egui_icon = egui::include_image!("../../assets/icon.png");
|
||||
let egui_icon = egui::include_image!("../../data/icon.png");
|
||||
ui.add(egui::Image::new(egui_icon.clone()));
|
||||
ui.end_row();
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ pub struct WindowOptions {
|
||||
closable: bool,
|
||||
collapsible: bool,
|
||||
resizable: bool,
|
||||
constrain: bool,
|
||||
scroll2: [bool; 2],
|
||||
disabled_time: f64,
|
||||
|
||||
@@ -22,6 +23,7 @@ impl Default for WindowOptions {
|
||||
closable: true,
|
||||
collapsible: true,
|
||||
resizable: true,
|
||||
constrain: true,
|
||||
scroll2: [true; 2],
|
||||
disabled_time: f64::NEG_INFINITY,
|
||||
anchored: false,
|
||||
@@ -43,6 +45,7 @@ impl super::Demo for WindowOptions {
|
||||
closable,
|
||||
collapsible,
|
||||
resizable,
|
||||
constrain,
|
||||
scroll2,
|
||||
disabled_time,
|
||||
anchored,
|
||||
@@ -59,6 +62,7 @@ impl super::Demo for WindowOptions {
|
||||
let mut window = egui::Window::new(title)
|
||||
.id(egui::Id::new("demo_window_options")) // required since we change the title
|
||||
.resizable(resizable)
|
||||
.constrain(constrain)
|
||||
.collapsible(collapsible)
|
||||
.title_bar(title_bar)
|
||||
.scroll2(scroll2)
|
||||
@@ -81,6 +85,7 @@ impl super::View for WindowOptions {
|
||||
closable,
|
||||
collapsible,
|
||||
resizable,
|
||||
constrain,
|
||||
scroll2,
|
||||
disabled_time: _,
|
||||
anchored,
|
||||
@@ -99,6 +104,8 @@ impl super::View for WindowOptions {
|
||||
ui.checkbox(closable, "closable");
|
||||
ui.checkbox(collapsible, "collapsible");
|
||||
ui.checkbox(resizable, "resizable");
|
||||
ui.checkbox(constrain, "constrain")
|
||||
.on_hover_text("Constrain window to the screen");
|
||||
ui.checkbox(&mut scroll2[0], "hscroll");
|
||||
ui.checkbox(&mut scroll2[1], "vscroll");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user