pub struct ShapeRenderer { /* private fields */ }Expand description
helps to draw basic BasicShapes
Implementations§
Source§impl ShapeRenderer
impl ShapeRenderer
Sourcepub fn new(device: &Device, config: &SurfaceConfiguration) -> ShapeRenderer
pub fn new(device: &Device, config: &SurfaceConfiguration) -> ShapeRenderer
creates a new ShapeRenderer which can render BasicShape. these can be created with ShapeRenderer::rect, ShapeRenderer::oval
can be reused with ShapeRenderer::clear function
Sourcepub fn render<'a, 'b: 'a>(
&'b self,
encoder: &mut CommandEncoder,
texture_view: &TextureView,
device: &Device,
)
pub fn render<'a, 'b: 'a>( &'b self, encoder: &mut CommandEncoder, texture_view: &TextureView, device: &Device, )
renders the current BasicShapes which can be added with ShapeRenderer::rect, ShapeRenderer::oval, …
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
clears the current drawn BasicShapes which can be added with ShapeRenderer::rect, ShapeRenderer::oval, …
Sourcepub fn set_frame_size(&mut self, frame_size: (f32, f32)) -> &mut Self
pub fn set_frame_size(&mut self, frame_size: (f32, f32)) -> &mut Self
sets the current frame_size
Sourcepub fn frame_size(&self) -> (f32, f32)
pub fn frame_size(&self) -> (f32, f32)
frame_size.0 is the with in which BasicShape get displayed.
frame_size.1 is the height in which BasicShape get displayed
(0,0) -> center of screen
Sourcepub fn set_frame_offset(&mut self, frame_offset: (f32, f32)) -> &mut Self
pub fn set_frame_offset(&mut self, frame_offset: (f32, f32)) -> &mut Self
sets the current frame_offset
Sourcepub fn frame_offset(&self) -> (f32, f32)
pub fn frame_offset(&self) -> (f32, f32)
frame_offset are values which get added to all BasicShape
Sourcepub fn resize(
&mut self,
device: &Device,
config: &SurfaceConfiguration,
) -> &mut Self
pub fn resize( &mut self, device: &Device, config: &SurfaceConfiguration, ) -> &mut Self
resizes the depthBuffer should be called on every window resize
Sourcepub fn background_color(&mut self, background_color: Color) -> &mut Self
pub fn background_color(&mut self, background_color: Color) -> &mut Self
sets the clearColor/ backgroundColor
Sourcepub fn image(&mut self, texture_index: usize) -> &mut Image
pub fn image(&mut self, texture_index: usize) -> &mut Image
renders Image and returns a Ref to it
pub fn add_texture_from_bytes( &mut self, bytes: &[u8], device: &Device, queue: &Queue, ) -> &mut Self
Auto Trait Implementations§
impl !Freeze for ShapeRenderer
impl !RefUnwindSafe for ShapeRenderer
impl !UnwindSafe for ShapeRenderer
impl Send for ShapeRenderer
impl Sync for ShapeRenderer
impl Unpin for ShapeRenderer
impl UnsafeUnpin for ShapeRenderer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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