pub struct WebGl2BackendInit {
pub canvas: HtmlCanvasElement,
pub context: WebGl2RenderingContext,
pub width: u32,
pub height: u32,
pub clear_color: Color,
}Expand description
Constructor inputs for WebGl2Backend.
WebGl2Backend::init is the only constructor, and it needs a live
document: it queries the canvas by selector and acquires a webgl2
context. Every field on the backend is pub(crate), so without this
struct there is no way to build one from outside the crate and the
state-diffing, draw-call and resize surface is untestable. Naming the
inputs lets a caller that already holds a context construct a backend
without going through DOM lookup.
Fields§
§canvas: HtmlCanvasElementThe canvas the backend draws into.
context: WebGl2RenderingContextThe webgl2 context every call goes through.
width: u32The physical pixel width of the drawing buffer.
height: u32The physical pixel height of the drawing buffer.
clear_color: ColorThe colour begin_frame clears to.
Implementations§
Source§impl WebGl2BackendInit
impl WebGl2BackendInit
pub fn get_canvas(&self) -> &HtmlCanvasElement
pub fn get_mut_canvas(&mut self) -> &mut HtmlCanvasElement
pub fn set_canvas(&mut self, val: HtmlCanvasElement) -> &mut Self
pub fn get_context(&self) -> &WebGl2RenderingContext
pub fn get_mut_context(&mut self) -> &mut WebGl2RenderingContext
pub fn set_context(&mut self, val: WebGl2RenderingContext) -> &mut Self
pub fn get_width(&self) -> &u32
pub fn get_mut_width(&mut self) -> &mut u32
pub fn set_width(&mut self, val: u32) -> &mut Self
pub fn get_height(&self) -> &u32
pub fn get_mut_height(&mut self) -> &mut u32
pub fn set_height(&mut self, val: u32) -> &mut Self
pub fn get_clear_color(&self) -> &Color
pub fn get_mut_clear_color(&mut self) -> &mut Color
pub fn set_clear_color(&mut self, val: Color) -> &mut Self
Source§impl WebGl2BackendInit
impl WebGl2BackendInit
pub fn new( canvas: HtmlCanvasElement, context: WebGl2RenderingContext, width: u32, height: u32, clear_color: Color, ) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WebGl2BackendInit
impl RefUnwindSafe for WebGl2BackendInit
impl Send for WebGl2BackendInit
impl Sync for WebGl2BackendInit
impl Unpin for WebGl2BackendInit
impl UnsafeUnpin for WebGl2BackendInit
impl UnwindSafe for WebGl2BackendInit
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