diff --git a/README.md b/README.md index fa19ed6..888a6c5 100644 --- a/README.md +++ b/README.md @@ -138,13 +138,13 @@ folder. ### Creating Your Application Creating a visual or interactive application using `pix-engine` requires -implementing only a single method of the [`PixEngine`][appstate] trait for your -application: [`PixEngine::on_update`][appstate::on_update] which gets executed as +implementing only a single method of the [`PixEngine`][pixengine] trait for your +application: [`PixEngine::on_update`][pixengine::on_update] which gets executed as often as possible. Within that function you'll have access to a mutable [`PixState`][pixstate] object which provides several methods for modifying settings and drawing to the screen. -[`PixEngine`][appstate] provides additional methods that can be implemented to +[`PixEngine`][pixengine] provides additional methods that can be implemented to respond to user events and handle application startup and teardown. Here's an example application which simply draws a circle following the mouse @@ -490,8 +490,8 @@ implementation and evolution of this crate: [wasm]: https://www.rust-lang.org/what/wasm [tetanes]: https://crates.io/crates/tetanes [nes]: https://en.wikipedia.org/wiki/Nintendo_Entertainment_System -[appstate]: crate::prelude::PixEngine -[appstate::on_update]: crate::prelude::PixEngine::on_update +[pixengine]: crate::prelude::PixEngine +[pixengine::on_update]: crate::prelude::PixEngine::on_update [pixstate]: crate::prelude::PixState [serde]: https://crates.io/crates/serde [anyhow]: https://crates.io/crates/anyhow diff --git a/src/engine.rs b/src/engine.rs index 18dc04d..1b7f470 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -1,4 +1,4 @@ -//! Primary [`PiEngine`] trait and functions which drive your application. +//! Primary [`PixEngine`] trait and functions which drive your application. //! //! This is the core module of the `pix-engine` crate and is responsible for building and running //! any application using it. @@ -67,7 +67,7 @@ use std::{ /// /// Please see the [module-level documentation] for more examples. /// -/// [module-level documentation]: crate::appstate +/// [module-level documentation]: crate::engine #[allow(unused_variables)] pub trait PixEngine { /// Called once upon engine start when [`Engine::run`] is called. @@ -980,7 +980,7 @@ impl EngineBuilder { } /// Set a target frame rate to render at, controls how often - /// [`Engine::on_update`] is called. + /// [`PixEngine::on_update`] is called. pub fn target_frame_rate(&mut self, rate: usize) -> &mut Self { self.settings.target_frame_rate = Some(rate); self @@ -1035,12 +1035,12 @@ impl Engine { /// Starts the `Engine` application and begins executing the frame loop on a given /// application which must implement [`Engine`]. The only required method of which is - /// [`Engine::on_update`]. + /// [`PixEngine::on_update`]. /// /// # Errors /// /// Any error in the entire library can propagate here and terminate the program. See the - /// [error](crate::error) module for details. Also see [`Engine::on_stop`]. + /// [error](crate::error) module for details. Also see [`PixEngine::on_stop`]. /// /// # Example /// @@ -1066,11 +1066,11 @@ impl Engine { // Handle events before on_start to initialize window self.handle_events(app)?; - debug!("Starting with `Engine::on_start`"); + debug!("Starting with `PixEngine::on_start`"); self.state.clear()?; let on_start = app.on_start(&mut self.state); if on_start.is_err() || self.state.should_quit() { - debug!("Quitting during startup with `Engine::on_stop`"); + debug!("Quitting during startup with `PixEngine::on_stop`"); if let Err(ref err) = on_start { error!("Error: {}", err); } @@ -1080,7 +1080,7 @@ impl Engine { // on_stop loop enables on_stop to prevent application close if necessary 'on_stop: loop { - debug!("Starting `Engine::on_update` loop."); + debug!("Starting `PixEngine::on_update` loop."); // running loop continues until an event or on_update returns false or errors let result = 'running: loop { let start_time = Instant::now(); @@ -1116,7 +1116,7 @@ impl Engine { } }; - debug!("Quitting with `Engine::on_stop`"); + debug!("Quitting with `PixEngine::on_stop`"); let on_stop = app.on_stop(&mut self.state); if self.state.should_quit() { info!("Quitting `Engine`..."); diff --git a/src/gui/theme.rs b/src/gui/theme.rs index 163832f..32eac51 100644 --- a/src/gui/theme.rs +++ b/src/gui/theme.rs @@ -207,7 +207,7 @@ impl ThemeBuilder { self } - /// Convert `Builder` into a [Theme] instance. + /// Convert `ThemeBuilder` into a [Theme] instance. pub fn build(&self) -> Theme { Theme { name: self.name.clone(), @@ -583,7 +583,7 @@ impl Spacing { /// A UI `Theme` containing font families, sizes, styles, and colors. /// -/// See the [Builder] examples for building a custom theme. +/// See the [`ThemeBuilder`] examples for building a custom theme. /// /// # Example /// @@ -628,9 +628,9 @@ impl Default for Theme { } impl Theme { - /// Constructs a default [Builder] which can build a `Theme` instance. + /// Constructs a default [`ThemeBuilder`] which can build a `Theme` instance. /// - /// See [Builder] for examples. + /// See [`ThemeBuilder`] for examples. #[inline] pub fn builder() -> ThemeBuilder { ThemeBuilder::default() diff --git a/src/shape/ellipse.rs b/src/shape/ellipse.rs index 22c99de..57104b4 100644 --- a/src/shape/ellipse.rs +++ b/src/shape/ellipse.rs @@ -35,7 +35,7 @@ use serde::{Deserialize, Serialize}; /// /// Please see the [module-level documentation] for examples. /// -/// [module-level documentation]: crate::shape::ellipse +/// [module-level documentation]: mod@crate::shape::ellipse #[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Hash)] #[repr(transparent)] #[must_use] diff --git a/src/shape/point.rs b/src/shape/point.rs index f9353fe..660da99 100644 --- a/src/shape/point.rs +++ b/src/shape/point.rs @@ -35,7 +35,7 @@ use std::{fmt, ops::MulAssign}; /// /// Please see the [module-level documentation] for examples. /// -/// [module-level documentation]: crate::shape::point +/// [module-level documentation]: mod@crate::shape::point #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(transparent)] #[must_use] diff --git a/src/shape/quad.rs b/src/shape/quad.rs index 045d98d..994b2ec 100644 --- a/src/shape/quad.rs +++ b/src/shape/quad.rs @@ -35,7 +35,7 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; /// /// Please see the [module-level documentation] for examples. /// -/// [module-level documentation]: crate::shape::quad +/// [module-level documentation]: mod@crate::shape::quad #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] #[repr(transparent)] #[must_use] diff --git a/src/shape/rect.rs b/src/shape/rect.rs index 028284a..7afe402 100644 --- a/src/shape/rect.rs +++ b/src/shape/rect.rs @@ -37,7 +37,7 @@ use std::ops::{Add, Sub}; /// /// Please see the [module-level documentation] for examples. /// -/// [module-level documentation]: crate::shape::rect +/// [module-level documentation]: mod@crate::shape::rect #[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Hash)] #[repr(transparent)] #[must_use] diff --git a/src/shape/sphere.rs b/src/shape/sphere.rs index 43dd8b1..f58564b 100644 --- a/src/shape/sphere.rs +++ b/src/shape/sphere.rs @@ -28,7 +28,7 @@ use serde::{Deserialize, Serialize}; /// /// Please see the [module-level documentation] for examples. /// -/// [module-level documentation]: crate::shape::sphere +/// [module-level documentation]: mod@crate::shape::sphere #[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Hash)] #[repr(transparent)] #[must_use] diff --git a/src/texture.rs b/src/texture.rs index c283b2f..ed49449 100644 --- a/src/texture.rs +++ b/src/texture.rs @@ -116,6 +116,8 @@ impl PixState { /// } /// # } /// ``` + /// + /// [`Error::InvalidTexture`]: crate::error::Error::InvalidTexture pub fn texture(&mut self, texture_id: TextureId, src: R1, dst: R2) -> PixResult<()> where R1: Into>>, @@ -176,6 +178,8 @@ impl PixState { /// } /// # } /// ``` + /// + /// [`Error::InvalidTexture`]: crate::error::Error::InvalidTexture pub fn texture_transformed( &mut self, texture_id: TextureId, @@ -209,7 +213,7 @@ impl PixState { /// Constructs a `Texture` to render to. Passing `None` for [`PixelFormat`] will use /// [`PixelFormat::default`]. The texture will be created and tied to the current window /// target. To create a texture for a window other than the primary window, call - /// [`PixState::set_window`]. + /// [`PixState::set_window_target`]. /// /// # Errors /// @@ -331,7 +335,7 @@ impl PixState { /// Set a `Texture` as the priamry target for drawing operations. Pushes current settings and UI /// cursor to the stack, so any changes made while a texture target is set will be in effect - /// until [`PixState::reset_texture_target`] is called. + /// until [`PixState::clear_texture_target`] is called. /// /// # Errors ///