pub struct Rect {}Expand description
Rectangle to render to screen. Can contain a Images otherwise just colors.
Fields§
§pos: Vec3Position on the Screen.
size: Vec2Width and Height of the Rect.
color: ColorColor of the Rect.
image: Option<usize>Optional Image Index.
uv: Vec4Texture X, Y, W and H if any apply.
border_width: f32Width of the Rects Border.
border_color: ColorColor of the Rects Border.
radius: f32Rectangle Radius.
camera_view: CameraViewCameraView used to render with.
store_id: IndexInstance Buffers Store ID.
order: DrawOrderthe draw order of the rect. created/updated when update is called.
bounds: Option<Bounds>Optional Bounds for Clipping the Rect too.
changed: boolIf anything got updated we need to update the buffers too.
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn new(
renderer: &mut GpuRenderer,
pos: Vec3,
size: Vec2,
color: Color,
order_layer: u32,
) -> Self
pub fn new( renderer: &mut GpuRenderer, pos: Vec3, size: Vec2, color: Color, order_layer: u32, ) -> Self
Creates a new Rect with rendering order layer, position and size.
order_layer: Rendering Order Layer of the rect used in DrawOrder.
Sourcepub fn new_with(
renderer: &mut GpuRenderer,
image: Option<usize>,
pos: Vec3,
size: Vec2,
uv: Vec4,
order_layer: u32,
) -> Self
pub fn new_with( renderer: &mut GpuRenderer, image: Option<usize>, pos: Vec3, size: Vec2, uv: Vec4, order_layer: u32, ) -> Self
Creates a new Rect with rendering order layer, position and size, UV and Image
order_layer: Rendering Order Layer of the rect used in DrawOrder.
Sourcepub fn unload(self, renderer: &mut GpuRenderer)
pub fn unload(self, renderer: &mut GpuRenderer)
Unloads the Rect from the Instance Buffers Store.
Sourcepub fn set_order_pos(&mut self, order_override: Vec3) -> &mut Self
pub fn set_order_pos(&mut self, order_override: Vec3) -> &mut Self
Updates the Rect’s order to overide the last set position.
Use this after calls to set_position to set it to a specific rendering order.
Sourcepub fn set_order_layer(&mut self, order_layer: u32) -> &mut Self
pub fn set_order_layer(&mut self, order_layer: u32) -> &mut Self
Updates the Rect’s orders Render Layer.
Sourcepub fn set_order_alpha(&mut self, alpha: bool) -> &mut Self
pub fn set_order_alpha(&mut self, alpha: bool) -> &mut Self
Sourcepub fn update_bounds(&mut self, bounds: Option<Bounds>) -> &mut Self
pub fn update_bounds(&mut self, bounds: Option<Bounds>) -> &mut Self
Updates the Rect’s Clipping Bounds.
Sourcepub fn set_camera_view(&mut self, camera_view: CameraView) -> &mut Self
pub fn set_camera_view(&mut self, camera_view: CameraView) -> &mut Self
Sets the Rect’s CameraView for rendering.
Sourcepub fn set_border_color(&mut self, color: Color) -> &mut Self
pub fn set_border_color(&mut self, color: Color) -> &mut Self
Sets the Rect’s Border Color.
Sourcepub fn set_texture(
&mut self,
renderer: &GpuRenderer,
atlas: &mut AtlasSet,
path: String,
) -> Result<&mut Self, GraphicsError>
pub fn set_texture( &mut self, renderer: &GpuRenderer, atlas: &mut AtlasSet, path: String, ) -> Result<&mut Self, GraphicsError>
Sets the Rect’s Texture.
Sourcepub fn set_container_uv(&mut self, uv: Vec4) -> &mut Self
pub fn set_container_uv(&mut self, uv: Vec4) -> &mut Self
Sets the Rect’s Texture X,Y, W, H details.
Sourcepub fn set_border_width(&mut self, size: f32) -> &mut Self
pub fn set_border_width(&mut self, size: f32) -> &mut Self
Sets the Rect’s Border Width.
Sourcepub fn set_radius(&mut self, radius: f32) -> &mut Self
pub fn set_radius(&mut self, radius: f32) -> &mut Self
Sets the Rect’s Corner Radius.
Sourcepub fn create_quad(&mut self, renderer: &mut GpuRenderer, atlas: &mut AtlasSet)
pub fn create_quad(&mut self, renderer: &mut GpuRenderer, atlas: &mut AtlasSet)
Updates the Rect’s Buffers to prepare them for rendering.
Sourcepub fn update(
&mut self,
renderer: &mut GpuRenderer,
atlas: &mut AtlasSet,
) -> OrderedIndex
pub fn update( &mut self, renderer: &mut GpuRenderer, atlas: &mut AtlasSet, ) -> OrderedIndex
Used to check and update the vertex array.
Returns a OrderedIndex used in Rendering.
Sourcepub fn check_mouse_bounds(&self, mouse_pos: Vec2) -> bool
pub fn check_mouse_bounds(&self, mouse_pos: Vec2) -> bool
Checks if the Mouse position is within the Rects location.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
Blanket Implementations§
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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