Struct dunge::Context

source ·
pub struct Context { /* private fields */ }
Expand description

The application context.

Implementations§

source§

impl Context

source

pub fn window(&self) -> &Window

Returns the window.

source

pub fn plan_to_close(&self)

Plans the main loop to close.

Calling this function dosn’t guarantee closing. It triggers the close_requested function in the Loop, which can handle the closing event.

source

pub fn size(&self) -> (u32, u32)

Returns the canvas size.

source

pub fn set_limits(&mut self, limits: Limits)

Sets context’s Limits.

source

pub fn set_frame_parameters(&mut self, params: FrameParameters)

Sets context’s frame parameters via FrameParameters struct.

No effect if pixel_size in FrameParameters is 0.

source

pub fn create_layer<V, T>(&mut self) -> LayerHandle<V, T>where V: Vertex, T: Topology,

Creates a new layer with default parameters.

This is a shortcut for context.create_layer_with_parameters().build(). See create_layer_with_parameters for more info.

source

pub fn create_layer_with_parameters<V, T>( &mut self ) -> ParametersBuilder<'_, V, T>

Creates a layer builder with custom parameters.

source

pub fn delete_layer<V, T>( &mut self, handle: LayerHandle<V, T> ) -> Result<(), Error>

Deletes the layer.

Errors

See Error for detailed info.

source

pub fn create_texture(&mut self, data: TextureData<'_>) -> TextureHandle

Creates a new texture.

source

pub fn update_texture( &mut self, handle: TextureHandle, data: TextureData<'_> ) -> Result<(), Error>

Updates the texture.

Errors

See Error for detailed info.

source

pub fn delete_texture(&mut self, handle: TextureHandle) -> Result<(), Error>

Deletes the texture.

Errors

See Error for detailed info.

source

pub fn create_instances<I>(&mut self, data: I) -> InstanceHandlewhere I: IntoIterator, I::Item: IntoTransform, <I::Item as IntoTransform>::IntoQuat: IntoQuat,

Creates new instances.

source

pub fn update_instances<I>( &mut self, handle: InstanceHandle, data: I ) -> Result<(), Error>where I: IntoIterator, I::Item: IntoTransform, <I::Item as IntoTransform>::IntoQuat: IntoQuat,

Updates instances.

Errors

See Error for detailed info.

source

pub fn delete_instances(&mut self, handle: InstanceHandle) -> Result<(), Error>

Deletes instances.

Errors

See Error for detailed info.

source

pub fn create_mesh<V, T>( &mut self, data: &MeshData<'_, V, T> ) -> MeshHandle<V, T>where V: Vertex, T: Topology,

Creates a new mesh.

source

pub fn update_mesh<V, T>( &mut self, handle: MeshHandle<V, T>, data: &MeshData<'_, V, T> ) -> Result<(), Error>where V: Vertex, T: Topology,

Updates the mesh.

Errors

See Error for detailed info.

source

pub fn delete_mesh<V, T>( &mut self, handle: MeshHandle<V, T> ) -> Result<(), Error>

Deletes the mesh.

Errors

See Error for detailed info.

source

pub fn create_view<P>(&mut self, view: View<P>) -> ViewHandlewhere P: IntoProjection,

Creates a new view.

source

pub fn update_view<P>( &mut self, handle: ViewHandle, view: View<P> ) -> Result<(), Error>where P: IntoProjection,

Updates the view.

Errors

See Error for detailed info.

source

pub fn delete_view(&mut self, handle: ViewHandle) -> Result<(), Error>

Deletes the view.

Errors

See Error for detailed info.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<T> Upcast<T> for T

§

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