pub struct Rect {Show 15 fields
pub position: Vec3,
pub size: Vec2,
pub color: Color,
pub image: Option<usize>,
pub uv: Vec4,
pub border_width: f32,
pub border_color: Color,
pub radius: f32,
pub camera_type: CameraType,
pub store_id: Index,
pub order: DrawOrder,
pub render_layer: u32,
pub bounds: Option<Bounds>,
pub order_override: Option<Vec3>,
pub changed: bool,
}Expand description
Rectangle to render to screen. Can contain a Images otherwise just colors.
Fields§
§position: 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_type: CameraTypeCameraType used to render with.
store_id: IndexInstance Buffers Store ID.
order: DrawOrderthe draw order of the rect. created/updated when update is called.
render_layer: u32Rendering Layer of the rect used in DrawOrder.
bounds: Option<Bounds>Optional Bounds for Clipping the Rect too.
order_override: Option<Vec3>Overides the absolute order values based on position.
changed: boolIf anything got updated we need to update the buffers too.
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn new(renderer: &mut GpuRenderer, render_layer: u32) -> Self
pub fn new(renderer: &mut GpuRenderer, render_layer: u32) -> Self
Creates a new Rect with rendering layer.
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_override(&mut self, order_override: Option<Vec3>) -> &mut Self
pub fn set_order_override(&mut self, order_override: Option<Vec3>) -> &mut Self
Updates the Rect’s order_override.
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_use_camera(&mut self, camera_type: CameraType) -> &mut Self
pub fn set_use_camera(&mut self, camera_type: CameraType) -> &mut Self
Sets the Rect’s CameraType 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_position(&mut self, position: Vec3) -> &mut Self
pub fn set_position(&mut self, position: Vec3) -> &mut Self
Sets the Rect’s Position.
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.
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