Expand description
A collection of commonly used items that we recommend importing for ease of use.
Re-exports§
pub use crate::app;
pub use crate::app::App;
pub use crate::app::LoopMode;
pub use crate::draw::Draw;
pub use crate::event::AxisMotion;
pub use crate::event::Event;
pub use crate::event::TouchEvent;
pub use crate::event::TouchpadPressure;
pub use crate::event::Update;
pub use crate::event::WindowEvent;
pub use crate::frame::Frame;
pub use crate::frame::RawFrame;
pub use crate::io::load_from_json;
pub use crate::io::load_from_toml;
pub use crate::io::safe_file_save;
pub use crate::io::save_to_json;
pub use crate::io::save_to_toml;
pub use crate::text;
pub use crate::text::text;
pub use crate::time::DurationF64;
pub use crate::window;
pub use crate::window::Window;
pub use crate::wgpu;
pub use crate::event::WindowEvent::*;
Modules§
- bounds
- cast
- float
- geom
- Types, functions and other items related to geometry. This module is the source of all graphics and lazer primitives and aids work in 2D and 3D space.
- identities
- int
- ops
- pow
- real
- rgb
- RGB types, spaces and standards.
- sign
Structs§
- Affine2
- A 2D affine transform, which can represent translation, rotation, scaling and shear.
- Affine3A
- A 3D affine transform, which can represent translation, rotation, scaling and shear.
- BVec2
- A 2-dimensional boolean vector.
- BVec3
- A 3-dimensional boolean vector.
- BVec4
- A 4-dimensional boolean vector.
- Buffer
Init Descriptor - Describes a Buffer when allocating.
- Cuboid
- A light-weight
Cuboid
type with many helper and utility methods. - DAffine2
- A 2D affine transform, which can represent translation, rotation, scaling and shear.
- DAffine3
- A 3D affine transform, which can represent translation, rotation, scaling and shear.
- DMat2
- A 2x2 column major matrix.
- DMat3
- A 3x3 column major matrix.
- DMat4
- A 4x4 column major matrix.
- DQuat
- A quaternion representing an orientation.
- DVec2
- A 2-dimensional vector.
- DVec3
- A 3-dimensional vector.
- DVec4
- A 4-dimensional vector.
- Hsl
- Linear HSL color space.
- Hsv
- Linear HSV color space.
- IVec2
- A 2-dimensional vector.
- IVec3
- A 3-dimensional vector.
- IVec4
- A 4-dimensional vector.
- Mat2
- A 2x2 column major matrix.
- Mat3
- A 3x3 column major matrix.
- Mat4
- A 4x4 column major matrix.
- Mat3A
- A 3x3 column major matrix.
- Parse
Float Error - Quat
- A quaternion representing an orientation.
- Rect
- Defines a Rectangle’s bounds across the x and y axes.
- UVec2
- A 2-dimensional vector.
- UVec3
- A 3-dimensional vector.
- UVec4
- A 4-dimensional vector.
- Vec2
- A 2-dimensional vector.
- Vec3
- A 3-dimensional vector without SIMD support.
- Vec4
- A 4-dimensional vector.
- Vec3A
- A 3-dimensional vector with SIMD support.
- Window
Id - Identifier of a window. Unique for each window.
Enums§
- Float
Error Kind - Fullscreen
- Fullscreen modes.
- Key
- Symbolic name for a keyboard key.
- Mouse
Button - Describes a button of a mouse controller.
- Mouse
Scroll Delta - Describes a difference in the mouse scroll wheel state.
- Touch
Phase - Describes touch-screen input state.
Constants§
- ALICEBLUE
- ANTIQUEWHITE
- AQUA
- AQUAMARINE
- AZURE
- BEIGE
- BISQUE
- BLACK
- BLANCHEDALMOND
- BLEND_
ADD - BLEND_
DARKEST - BLEND_
LIGHTEST - BLEND_
NORMAL - BLEND_
REVERSE_ SUBTRACT - BLEND_
SUBTRACT - BLUE
- BLUEVIOLET
- BROWN
- BURLYWOOD
- CADETBLUE
- CHARTREUSE
- CHOCOLATE
- CORAL
- CORNFLOWERBLUE
- CORNSILK
- CRIMSON
- CYAN
- DARKBLUE
- DARKCYAN
- DARKGOLDENROD
- DARKGRAY
- DARKGREEN
- DARKGREY
- DARKKHAKI
- DARKMAGENTA
- DARKOLIVEGREEN
- DARKORANGE
- DARKORCHID
- DARKRED
- DARKSALMON
- DARKSEAGREEN
- DARKSLATEBLUE
- DARKSLATEGRAY
- DARKSLATEGREY
- DARKTURQUOISE
- DARKVIOLET
- DEEPPINK
- DEEPSKYBLUE
- DIMGRAY
- DIMGREY
- DODGERBLUE
- FIREBRICK
- FLORALWHITE
- FORESTGREEN
- FUCHSIA
- GAINSBORO
- GHOSTWHITE
- GOLD
- GOLDENROD
- GRAY
- GREEN
- GREENYELLOW
- GREY
- HONEYDEW
- HOTPINK
- INDIANRED
- INDIGO
- IVORY
- KHAKI
- LAVENDER
- LAVENDERBLUSH
- LAWNGREEN
- LEMONCHIFFON
- LIGHTBLUE
- LIGHTCORAL
- LIGHTCYAN
- LIGHTGOLDENRODYELLOW
- LIGHTGRAY
- LIGHTGREEN
- LIGHTGREY
- LIGHTPINK
- LIGHTSALMON
- LIGHTSEAGREEN
- LIGHTSKYBLUE
- LIGHTSLATEGRAY
- LIGHTSLATEGREY
- LIGHTSTEELBLUE
- LIGHTYELLOW
- LIME
- LIMEGREEN
- LINEN
- MAGENTA
- MAROON
- MEDIUMAQUAMARINE
- MEDIUMBLUE
- MEDIUMORCHID
- MEDIUMPURPLE
- MEDIUMSEAGREEN
- MEDIUMSLATEBLUE
- MEDIUMSPRINGGREEN
- MEDIUMTURQUOISE
- MEDIUMVIOLETRED
- MIDNIGHTBLUE
- MINTCREAM
- MISTYROSE
- MOCCASIN
- NAVAJOWHITE
- NAVY
- OLDLACE
- OLIVE
- OLIVEDRAB
- ORANGE
- ORANGERED
- ORCHID
- PALEGOLDENROD
- PALEGREEN
- PALETURQUOISE
- PALEVIOLETRED
- PAPAYAWHIP
- PEACHPUFF
- PERU
- PI
- Archimedes’ constant (π)
- PINK
- PI_F64
- Archimedes’ constant (π)
- PLUM
- POWDERBLUE
- PURPLE
- REBECCAPURPLE
- RED
- ROSYBROWN
- ROYALBLUE
- SADDLEBROWN
- SALMON
- SANDYBROWN
- SEAGREEN
- SEASHELL
- SIENNA
- SILVER
- SKYBLUE
- SLATEBLUE
- SLATEGRAY
- SLATEGREY
- SNOW
- SPRINGGREEN
- STEELBLUE
- TAN
- TAU
- The full circle constant (τ)
- TAU_F64
- The full circle constant (τ)
- TEAL
- THISTLE
- TOMATO
- TURQUOISE
- VIOLET
- WHEAT
- WHITE
- WHITESMOKE
- YELLOW
- YELLOWGREEN
Traits§
- AsPrimitive
- A generic interface for casting between machine scalars with the
as
operator, which admits narrowing and precision loss. Implementers of this traitAsPrimitive
should behave like a primitive numeric type (e.g. a newtype around another primitive), and the intended conversion must never fail. - Bounded
- Numbers which have upper and lower bounds
- Checked
Add - Performs addition that returns
None
instead of wrapping around on overflow. - Checked
Div - Performs division that returns
None
instead of panicking on division by zero and instead of wrapping around on underflow and overflow. - Checked
Euclid - Checked
Mul - Performs multiplication that returns
None
instead of wrapping around on underflow or overflow. - Checked
Neg - Performs negation that returns
None
if the result can’t be represented. - Checked
Rem - Performs an integral remainder that returns
None
instead of panicking on division by zero and instead of wrapping around on underflow and overflow. - Checked
Shl - Performs a left shift that returns
None
on shifts larger than or equal to the type width. - Checked
Shr - Performs a right shift that returns
None
on shifts larger than or equal to the type width. - Checked
Sub - Performs subtraction that returns
None
instead of wrapping around on underflow. - Const
One - Defines an associated constant representing the multiplicative identity
element for
Self
. - Const
Zero - Defines an associated constant representing the additive identity element
for
Self
. - Device
Ext - Utility methods not meant to be in the main API.
- Euclid
- Float
- Generic trait for floating point numbers
- Float
Const - From
Bytes - From
Primitive - A generic trait for converting a number to a value.
- Inv
- Unary operator for retrieving the multiplicative inverse, or reciprocal, of a value.
- Mat4
Look To - Create a transformation matrix that will cause a vector to point at
dir
usingup
for orientation. - MulAdd
- Fused multiply-add. Computes
(self * a) + b
with only one rounding error, yielding a more accurate result than an unfused multiply-add. - MulAdd
Assign - The fused multiply-add assignment operation
*self = (*self * a) + b
- Num
- The base trait for numeric types, covering
0
and1
values, comparisons, basic numeric operations, and string conversion. - NumAssign
- The trait for
Num
types which also implement assignment operators. - NumAssign
Ops - Generic trait for types implementing numeric assignment operators (like
+=
). - NumAssign
Ref - The trait for
NumAssign
types which also implement assignment operations taking the second operand by reference. - NumCast
- An interface for casting between machine scalars.
- NumOps
- Generic trait for types implementing basic numeric operations
- NumRef
- The trait for
Num
types which also implement numeric operations taking the second operand by reference. - One
- Defines a multiplicative identity element for
Self
. - Pow
- Binary operator for raising a value to a power.
- PrimInt
- Generic trait for primitive integers.
- RefNum
- The trait for
Num
references which implement numeric operations, taking the second operand either by value or by reference. - Saturating
- Saturating math operations. Deprecated, use
SaturatingAdd
,SaturatingSub
andSaturatingMul
instead. - Saturating
Add - Performs addition that saturates at the numeric bounds instead of overflowing.
- Saturating
Mul - Performs multiplication that saturates at the numeric bounds instead of overflowing.
- Saturating
Sub - Performs subtraction that saturates at the numeric bounds instead of overflowing.
- Signed
- Useful functions for signed numbers (i.e. numbers that can be negative).
- ToBytes
- ToPrimitive
- A generic trait for converting a value to a number.
- Unsigned
- A trait for values which cannot be negative
- Vec2
Angle - Short-hand for retrieving the angle of the vector in radians.
- Vec2
Rotate - Wrapping
Add - Performs addition that wraps around on overflow.
- Wrapping
Mul - Performs multiplication that wraps around on overflow.
- Wrapping
Neg - Performs a negation that does not panic.
- Wrapping
Shl - Performs a left shift that does not panic.
- Wrapping
Shr - Performs a right shift that does not panic.
- Wrapping
Sub - Performs subtraction that wraps around on overflow.
- Zero
- Defines an additive identity element for
Self
.
Functions§
- abs
- Computes the absolute value.
- abs_sub
- The positive difference of two numbers.
- cast
- Cast from one machine scalar to another.
- checked_
pow - Raises a value to the power of exp, returning
None
if an overflow occurred. - clamp
- Clamp a value between some range.
- clamp_
max - A value bounded by a maximum value
- clamp_
min - A value bounded by a minimum value
- deg_
to_ rad - Convert the given angle in degrees to the same angle in radians.
- dmat2
- Creates a 2x2 matrix from two column vectors.
- dmat3
- Creates a 3x3 matrix from three column vectors.
- dmat4
- Creates a 4x4 matrix from four column vectors.
- dquat
- Creates a quaternion from
x
,y
,z
andw
values. - dvec2
- Creates a 2-dimensional vector.
- dvec3
- Creates a 3-dimensional vector.
- dvec4
- Creates a 4-dimensional vector.
- fmod
- Models the C++ fmod function.
- gray
- A short-hand constructor for
Gray::new
. - hsl
- A short-hand constructor for
Hsl::new(RgbHue::from_degrees(h * 360.0), s, l)
. - hsla
- A short-hand constructor for
Hsla::new(RgbHue::from_degrees(h * 360.0), s, l, a)
. - hsv
- A short-hand constructor for
Hsv::new(RgbHue::from_degrees(h * 360.0), s, v)
. - hsva
- A short-hand constructor for
Hsva::new(RgbHue::from_degrees(h * 360.0), s, v, a)
. - ivec2
- Creates a 2-dimensional vector.
- ivec3
- Creates a 3-dimensional vector.
- ivec4
- Creates a 4-dimensional vector.
- lin_
srgb - A short-hand constructor for
LinSrgb::new
. - lin_
srgba - A short-hand constructor for
LinSrgba::new
. - map_
range - Maps a value from an input range to an output range.
- mat2
- Creates a 2x2 matrix from two column vectors.
- mat3
- Creates a 3x3 matrix from three column vectors.
- mat4
- Creates a 4x4 matrix from four column vectors.
- mat3a
- Creates a 3x3 matrix from three column vectors.
- one
- Returns the multiplicative identity,
1
. - partial_
max - The max between two partially ordered values.
- partial_
min - The min between two partially ordered values.
- pow
- Raises a value to the power of exp, using exponentiation by squaring.
- pt2
- Construct a 2-dimensional point.
- pt3
- Construct a 3-dimensional point.
- quat
- Creates a quaternion from
x
,y
,z
andw
values. - rad_
to_ deg - Convert the given angle in radians to the same angle in degrees.
- rad_
to_ turns - Convert the given value in radians to the equivalent value as a number of turns.
- random
- Generates a random value using the thread-local random number generator.
- random_
ascii - Generates and returns a random ascii character.
- random_
f32 - A wrapper function around the
random
function that avoids the need for specifying a type in the case that it cannot be inferred. The primary purpose for this is to simplify the random API for new rust users. - random_
f64 - A wrapper function around the
random
function that avoids the need for specifying a type in the case that it cannot be inferred. The primary purpose for this is to simplify the random API for new rust users. - random_
range - A function for generating a random value within the given range.
- rgb
- A short-hand constructor for
Rgb::new
. - rgb8
- A short-hand constructor for
Rgb::<u8>::new
. - rgba
- A short-hand constructor for
Rgba::new
. - rgba8
- A short-hand constructor for
Rgba<u8>::new
. - signum
- Returns the sign of the number.
- srgb
- A short-hand constructor for
Srgb::new
. - srgb8
- A short-hand constructor for
Srgb<u8>::new
. - srgba
- A short-hand constructor for
Srgba::new
. - srgba8
- A short-hand constructor for
Srgba<u8>::new
. - turns_
to_ rad - Convert the given value as a number of “turns” into the equivalent angle in radians.
- vec2
- Creates a 2-dimensional vector.
- vec3
- Creates a 3-dimensional vector.
- vec4
- Creates a 4-dimensional vector.
- vec3a
- Creates a 3-dimensional vector.
- zero
- Returns the additive identity,
0
.
Type Aliases§
- Gray
- A color represented as gray intensity.
- Hsla
- Linear HSL with an alpha component. See the
Hsla
implementation inAlpha
. - Hsva
- Linear HSV with an alpha component. See the
Hsva
implementation inAlpha
. - LinSrgb
- Linear sRGB.
- LinSrgba
- Linear sRGB with an alpha component.
- Point2
- A 2-dimensional point type.
- Point3
- A 3-dimensional point type.
- Rgb
- A color represented as red, green and blue intensities.
- Rgb8
- The same as
Rgb
, but withu8
’s. - Rgba
- The same as
Rgb
, but with an alpha value representing opacity. - Rgba8
- The same as
Rgba
, but withu8
’s. - Srgb
- Nonlinear sRGB.
- Srgba
- Nonlinear sRGB with an alpha component.
- Vector2
Deprecated - A common alias for the
glam::Vec2
type. - Vector3
Deprecated - A common alias for the
glam::Vec3
type. - Vector4
Deprecated - A common alias for the
glam::Vec4
type.