Struct bevy::gizmos::grid::GridBuilder2d
pub struct GridBuilder2d<'a, 'w, 's, Config, Clear>{ /* private fields */ }
Expand description
A builder returned by Gizmos::grid
and Gizmos::grid_2d
Implementations§
§impl<Config, Clear> GridBuilder2d<'_, '_, '_, Config, Clear>
impl<Config, Clear> GridBuilder2d<'_, '_, '_, Config, Clear>
pub fn skew_x(self, skew: f32) -> GridBuilder2d<'_, '_, '_, Config, Clear>
pub fn skew_x(self, skew: f32) -> GridBuilder2d<'_, '_, '_, Config, Clear>
Skews the grid by tan(skew)
in the x direction.
skew
is in radians
pub fn skew_y(self, skew: f32) -> GridBuilder2d<'_, '_, '_, Config, Clear>
pub fn skew_y(self, skew: f32) -> GridBuilder2d<'_, '_, '_, Config, Clear>
Skews the grid by tan(skew)
in the y direction.
skew
is in radians
pub fn skew(self, skew: Vec2) -> GridBuilder2d<'_, '_, '_, Config, Clear>
pub fn skew(self, skew: Vec2) -> GridBuilder2d<'_, '_, '_, Config, Clear>
Skews the grid by tan(skew)
in the x and y directions.
skew
is in radians
pub fn outer_edges_x(self) -> GridBuilder2d<'_, '_, '_, Config, Clear>
pub fn outer_edges_x(self) -> GridBuilder2d<'_, '_, '_, Config, Clear>
Declare that the outer edges of the grid along the x axis should be drawn. By default, the outer edges will not be drawn.
pub fn outer_edges_y(self) -> GridBuilder2d<'_, '_, '_, Config, Clear>
pub fn outer_edges_y(self) -> GridBuilder2d<'_, '_, '_, Config, Clear>
Declare that the outer edges of the grid along the y axis should be drawn. By default, the outer edges will not be drawn.
pub fn outer_edges(self) -> GridBuilder2d<'_, '_, '_, Config, Clear>
pub fn outer_edges(self) -> GridBuilder2d<'_, '_, '_, Config, Clear>
Declare that all outer edges of the grid should be drawn. By default, the outer edges will not be drawn.
Examples found in repository?
examples/gizmos/2d_gizmos.rs (line 55)
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
fn draw_example_collection(
mut gizmos: Gizmos,
mut my_gizmos: Gizmos<MyRoundGizmos>,
time: Res<Time>,
) {
let sin = time.elapsed_seconds().sin() * 50.;
gizmos.line_2d(Vec2::Y * -sin, Vec2::splat(-80.), RED);
gizmos.ray_2d(Vec2::Y * sin, Vec2::splat(80.), LIME);
gizmos
.grid_2d(
Vec2::ZERO,
0.0,
UVec2::new(16, 12),
Vec2::new(60., 60.),
// Light gray
LinearRgba::gray(0.65),
)
.outer_edges();
// Triangle
gizmos.linestrip_gradient_2d([
(Vec2::Y * 300., BLUE),
(Vec2::new(-255., -155.), RED),
(Vec2::new(255., -155.), LIME),
(Vec2::Y * 300., BLUE),
]);
gizmos.rect_2d(
Vec2::ZERO,
time.elapsed_seconds() / 3.,
Vec2::splat(300.),
BLACK,
);
// The circles have 32 line-segments by default.
my_gizmos.circle_2d(Vec2::ZERO, 120., BLACK);
my_gizmos.ellipse_2d(
Vec2::ZERO,
time.elapsed_seconds() % TAU,
Vec2::new(100., 200.),
YELLOW_GREEN,
);
// You may want to increase this for larger circles.
my_gizmos.circle_2d(Vec2::ZERO, 300., NAVY).segments(64);
// Arcs default amount of segments is linearly interpolated between
// 1 and 32, using the arc length as scalar.
my_gizmos.arc_2d(Vec2::ZERO, sin / 10., PI / 2., 350., ORANGE_RED);
gizmos.arrow_2d(
Vec2::ZERO,
Vec2::from_angle(sin / -10. + PI / 2.) * 50.,
YELLOW,
);
// You can create more complex arrows using the arrow builder.
gizmos
.arrow_2d(Vec2::ZERO, Vec2::from_angle(sin / -10.) * 50., GREEN)
.with_double_end()
.with_tip_length(10.);
}
Trait Implementations§
§impl<Config, Clear> Drop for GridBuilder2d<'_, '_, '_, Config, Clear>
impl<Config, Clear> Drop for GridBuilder2d<'_, '_, '_, Config, Clear>
Auto Trait Implementations§
impl<'a, 'w, 's, Config, Clear> Freeze for GridBuilder2d<'a, 'w, 's, Config, Clear>
impl<'a, 'w, 's, Config, Clear> RefUnwindSafe for GridBuilder2d<'a, 'w, 's, Config, Clear>where
Config: RefUnwindSafe,
Clear: RefUnwindSafe,
impl<'a, 'w, 's, Config, Clear> Send for GridBuilder2d<'a, 'w, 's, Config, Clear>
impl<'a, 'w, 's, Config, Clear> Sync for GridBuilder2d<'a, 'w, 's, Config, Clear>
impl<'a, 'w, 's, Config, Clear> Unpin for GridBuilder2d<'a, 'w, 's, Config, Clear>
impl<'a, 'w, 's, Config, Clear> !UnwindSafe for GridBuilder2d<'a, 'w, 's, Config, Clear>
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
Return the
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more