Struct PixelBufferBuilder

Source
pub struct PixelBufferBuilder<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> PixelBufferBuilder<'a>

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more