pub struct PixelBufferBuilder<'a> { /* private fields */ }Implementations§
Source§impl<'a> PixelBufferBuilder<'a>
impl<'a> PixelBufferBuilder<'a>
Sourcepub fn with_window(self, window: &'a mut Window) -> Self
pub fn with_window(self, window: &'a mut Window) -> Self
Sets the window for this PixelBuffer instance.
This is useful for creating a PixelBuffer instance that is bound to a specific window.
Sourcepub fn build(self) -> Result<PixelBuffer, PixelBufferBuilderError>
pub fn build(self) -> Result<PixelBuffer, PixelBufferBuilderError>
Examples found in repository?
examples/software.rs (line 14)
6fn main() {
7 let mut runner = est_render::runner::new().expect("Failed to create runner");
8 let mut window = runner
9 .create_window("Engine Example", Point2::new(800, 600))
10 .build()
11 .expect("Failed to create window");
12
13 let mut sw = est_render::software::new(Some(&mut window))
14 .build()
15 .expect("Failed to create pixel buffer");
16
17 let mut pixels = vec![128u32; (800 * 600) as usize];
18 let mut size_px = Point2::new(800.0, 600.0);
19
20 while runner.pool_events(None) {
21 for event in runner.get_events() {
22 match event {
23 Event::WindowClosed { .. } => {
24 return;
25 }
26 Event::WindowResized { size, .. } => {
27 pixels.resize((size.x * size.y) as usize, 128);
28 size_px = Point2::new(size.x as f32, size.y as f32);
29 }
30 _ => {}
31 }
32 }
33
34 if let Err(e) = sw.write_buffers(&pixels, size_px) {
35 eprintln!("Error writing buffers: {}", e);
36 }
37 }
38}Auto Trait Implementations§
impl<'a> Freeze for PixelBufferBuilder<'a>
impl<'a> !RefUnwindSafe for PixelBufferBuilder<'a>
impl<'a> !Send for PixelBufferBuilder<'a>
impl<'a> !Sync for PixelBufferBuilder<'a>
impl<'a> Unpin for PixelBufferBuilder<'a>
impl<'a> !UnwindSafe for PixelBufferBuilder<'a>
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
Mutably borrows from an owned value. Read more
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>
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.Source§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.Source§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.Source§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.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>
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