pub struct Scene { /* private fields */ }Expand description
Batched draw list assembled each frame before it is handed to Pane::render.
Widgets append geometry via the push_* / text* methods. The renderer
sorts by z, uploads all vertices in one write, then issues draw calls.
Call Scene::clear at the start of each frame to reuse the allocation.
Implementations§
Source§impl Scene
impl Scene
Sourcepub fn push_full(
&mut self,
verts: Vec<[f32; 2]>,
shader: ShaderId,
color: Color,
z: f32,
clip: Option<ClipRect>,
corner_radius: f32,
)
pub fn push_full( &mut self, verts: Vec<[f32; 2]>, shader: ShaderId, color: Color, z: f32, clip: Option<ClipRect>, corner_radius: f32, )
Push a plain geometry batch (no border, no widget state).
Shorthand for push_widget with border_width = 0 and state = [0; 4].
Sourcepub fn push_widget(
&mut self,
verts: Vec<[f32; 2]>,
shader: ShaderId,
color: Color,
z: f32,
clip: Option<ClipRect>,
corner_radius: f32,
border_width: f32,
state: [f32; 4],
)
pub fn push_widget( &mut self, verts: Vec<[f32; 2]>, shader: ShaderId, color: Color, z: f32, clip: Option<ClipRect>, corner_radius: f32, border_width: f32, state: [f32; 4], )
Push a widget geometry batch with full control over all vertex attributes.
state is passed through to the shader as @location(5):
[hovered, pressed, focused, disabled], each 0.0 or 1.0.
Sourcepub fn push_image(
&mut self,
rect: Rect,
shader: ShaderId,
texture: TextureId,
z: f32,
clip: Option<ClipRect>,
)
pub fn push_image( &mut self, rect: Rect, shader: ShaderId, texture: TextureId, z: f32, clip: Option<ClipRect>, )
Push a textured quad using the full texture (UV 0,0 → 1,1).
Sourcepub fn push_image_uv(
&mut self,
rect: Rect,
shader: ShaderId,
texture: TextureId,
depth: f32,
clip: Option<ClipRect>,
uv_rect: Option<UvRect>,
)
pub fn push_image_uv( &mut self, rect: Rect, shader: ShaderId, texture: TextureId, depth: f32, clip: Option<ClipRect>, uv_rect: Option<UvRect>, )
Push a textured quad with an optional sub-rect UV override (for sprite sheets / GIF frames).
Sourcepub fn text(
&mut self,
text: &str,
x: f32,
y: f32,
w: f32,
size: f32,
color: Color,
)
pub fn text( &mut self, text: &str, x: f32, y: f32, w: f32, size: f32, color: Color, )
Draw center-aligned text in a box of width w at grid position (x, y).
Sourcepub fn text_left(&mut self, text: &str, x: f32, y: f32, size: f32, color: Color)
pub fn text_left(&mut self, text: &str, x: f32, y: f32, size: f32, color: Color)
Draw left-aligned text starting at grid position (x, y) with no width constraint.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scene
impl RefUnwindSafe for Scene
impl Send for Scene
impl Sync for Scene
impl Unpin for Scene
impl UnsafeUnpin for Scene
impl UnwindSafe for Scene
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().