diff --git a/egui/src/app.rs b/egui/src/app.rs index 2877fe48d..ae95a576d 100644 --- a/egui/src/app.rs +++ b/egui/src/app.rs @@ -1,5 +1,7 @@ //! Traits and helper for writing Egui apps. //! +//! This module is very experimental, and you don't need to use it. +//! //! Egui can be used as a library, but you can also use it as a framework to write apps in. //! This module defined the `App` trait that can be implemented and used with the `egui_web` and `egui_glium` crates. @@ -19,7 +21,7 @@ pub trait App { /// How the backend runs the app #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum RunMode { - /// Repint the UI all the time (at the display refresh rate of e.g. 60 Hz). + /// Repaint the UI all the time (at the display refresh rate of e.g. 60 Hz). /// This is good for games where things are constantly moving. /// This can also be achieved with `RunMode::Reactive` combined with calling `egui::Context::request_repaint()` each frame. Continuous, @@ -50,7 +52,7 @@ pub trait Backend { fn fps(&self) -> f32; /// Signal the backend that we'd like to exit the app now. - /// This does nothing for web apps.s + /// This does nothing for web apps. fn quit(&mut self) {} } diff --git a/egui/src/containers/scroll_area.rs b/egui/src/containers/scroll_area.rs index be783cbb6..c041d2318 100644 --- a/egui/src/containers/scroll_area.rs +++ b/egui/src/containers/scroll_area.rs @@ -191,7 +191,7 @@ impl Prepared { let max_scroll_bar_width = max_scroll_bar_width_with_margin(ui); if show_scroll_this_frame && current_scroll_bar_width <= 0.0 { - // Avoid frame delay; start shwoing scroll bar right away: + // Avoid frame delay; start showing scroll bar right away: current_scroll_bar_width = remap_clamp( ui.input().predicted_dt, 0.0..=ui.style().animation_time, diff --git a/egui/src/input.rs b/egui/src/input.rs index 8b09da7d4..69e321d50 100644 --- a/egui/src/input.rs +++ b/egui/src/input.rs @@ -1,3 +1,5 @@ +//! The input needed by Egui. + use crate::math::*; /// If mouse moves more than this, it is no longer a click (but maybe a drag) @@ -5,9 +7,9 @@ const MAX_CLICK_DIST: f32 = 6.0; /// The new mouse press must come within this many seconds from previous mouse release const MAX_CLICK_DELAY: f64 = 0.3; -/// What the integration gives to the gui. -/// All coordinates in egui is in point/logical coordinates -/// with origin (0, 0) in the top left corner. +/// What the backend provides to Egui at the start of each frame. +/// +/// All coordinates are in points (logical pixels) with origin (0, 0) in the top left corner. #[derive(Clone, Debug, Default)] pub struct RawInput { /// Is the button currently down? @@ -24,6 +26,7 @@ pub struct RawInput { pub screen_size: Vec2, /// Also known as device pixel ratio, > 1 for HDPI screens. + /// If text looks blurry on high resolution screens, you probably forgot to set this. pub pixels_per_point: Option, /// Time in seconds. Relative to whatever. Used for animations. @@ -332,7 +335,7 @@ impl RawInput { pub fn ui(&self, ui: &mut crate::Ui) { use crate::label; // TODO: simpler way to show values, e.g. `ui.value("Mouse Pos:", self.mouse_pos); - // TODO: easily change default font! + // TODO: `ui.style_mut().text_style = TextStyle::Monospace`; ui.add(label!("mouse_down: {}", self.mouse_down)); ui.add(label!("mouse_pos: {:.1?}", self.mouse_pos)); ui.add(label!("scroll_delta: {:?} points", self.scroll_delta)); @@ -366,7 +369,7 @@ impl InputState { ui.add(label!("scroll_delta: {:?} points", self.scroll_delta)); ui.add(label!("screen_size: {:?} points", self.screen_size)); ui.add(label!( - "{} points for each physical pixel (hdpi factor)", + "{} points for each physical pixel (HDPI factor)", self.pixels_per_point )); ui.add(label!("time: {:.3} s", self.time)); diff --git a/egui/src/layers.rs b/egui/src/layers.rs index 5d6be6d15..07339bf55 100644 --- a/egui/src/layers.rs +++ b/egui/src/layers.rs @@ -67,7 +67,7 @@ impl PaintList { } } -// TODO: improve this +// TODO: improve GraphicLayers #[derive(Clone, Default)] pub struct GraphicLayers(AHashMap); diff --git a/egui/src/layout.rs b/egui/src/layout.rs index 7f240d736..beb8582fe 100644 --- a/egui/src/layout.rs +++ b/egui/src/layout.rs @@ -61,12 +61,13 @@ pub(crate) fn anchor_rect(rect: Rect, anchor: (Align, Align)) -> Rect { #[derive(Clone, Copy, Debug, PartialEq)] // #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Layout { - /// Lay out things horizontally or vertically? + /// Lay out things horizontally or vertically? Main axis. dir: Direction, + /// How to align things on the cross axis. /// For vertical layouts: put things to left, center or right? /// For horizontal layouts: put things to top, center or bottom? - /// None means justified, which means full width (vertical layout) or height (horizontal layouts). + /// `None` means justified, which means full width (vertical layout) or height (horizontal layouts). align: Option, /// Lay out things in reversed order, i.e. from the right or bottom-up. diff --git a/egui/src/menu.rs b/egui/src/menu.rs index f99558fb5..79821059d 100644 --- a/egui/src/menu.rs +++ b/egui/src/menu.rs @@ -1,4 +1,4 @@ -//! Menu bar functionality. +//! Menu bar functionality (very basic so far). //! //! Usage: //! ``` rust @@ -79,7 +79,7 @@ pub fn bar(ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> (R, Rect) let clicked_outside = !ui.hovered(ui.rect()) && ui.input().mouse.released; if clicked_outside || ui.input().key_pressed(Key::Escape) { - // TODO: this prevent sub-menus in menus. We should fix that. + // TODO: this prevents sub-menus in menus. We should fix that. let bar_id = ui.id(); BarState::close_menus(ui.ctx(), bar_id); } diff --git a/egui/src/types.rs b/egui/src/types.rs index bd85fc305..2c613d7b4 100644 --- a/egui/src/types.rs +++ b/egui/src/types.rs @@ -63,7 +63,7 @@ pub struct InteractInfo { /// The mouse is hovering above this thing pub hovered: bool, - /// The mouse pressed this thing ealier, and now released on this thing too. + /// The mouse pressed this thing earlier, and now released on this thing too. pub clicked: bool, pub double_clicked: bool, diff --git a/egui/src/widgets.rs b/egui/src/widgets.rs index 4e0b9dc5d..89f82d1b1 100644 --- a/egui/src/widgets.rs +++ b/egui/src/widgets.rs @@ -514,7 +514,7 @@ impl Widget for Separator { // TODO: only allocate `spacing`, but not our full width/height // as that would make the false impression that we *need* all that space, - // wich would prevent regions from autoshrinking + // which would prevent regions from auto-shrinking let (points, rect) = match ui.layout().dir() { Direction::Horizontal => {