pub enum WrappingMode {
Wrap,
Ignore,
Panic,
}
Expand description
The wrapping mode is used to determine how you want to handle out-of-bounds pixels during plotting pixels to the screen. Here’s how each possible value functions:
Variants§
Wrap
WrappingMode::Wrap
wraps any out of bounds pixels around to the other side. This is useful if you have an object that travels the entirety of the screen and appears on the other side when it reaches the end.
Ignore
WrappingMode::Ignore
simply skips all out-of-bounds pixels. This is useful if you might have an object clipping through the edge of the screen but don’t want it to wrap to the other side like WrappingMode::Wrap
or panic and end the process like WrappingMode::Panic
Panic
WrappingMode::Panic
will panic!
if any pixels are out of bounds. You should use this if you have your own wrapping system implemented
Implementations§
Source§impl WrappingMode
impl WrappingMode
Sourcepub fn handle_bounds(&self, pos: Vec2D, bounds: Vec2D) -> Option<Vec2D>
pub fn handle_bounds(&self, pos: Vec2D, bounds: Vec2D) -> Option<Vec2D>
Handle the position based on the given bounds and the WrappingMode
variation (See the WrappingMode
documentation for more info)
§Panics
WrappingMode::Panic
will panic if the position is out of bounds
Trait Implementations§
Source§impl Clone for WrappingMode
impl Clone for WrappingMode
Source§fn clone(&self) -> WrappingMode
fn clone(&self) -> WrappingMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more