pub struct GraphicsContext { /* private fields */ }Implementations§
Source§impl GraphicsContext
impl GraphicsContext
pub fn apply_pipeline(&mut self, pipeline: &Pipeline)
pub fn set_cull_face(&mut self, cull_face: CullFace)
pub fn set_color_write(&mut self, color_write: (bool, bool, bool, bool))
pub fn set_blend( &mut self, color_blend: Option<BlendState>, alpha_blend: Option<BlendState>, )
pub fn set_stencil(&mut self, stencil_test: Option<StencilState>)
Sourcepub fn apply_viewport(&mut self, x: i32, y: i32, w: i32, h: i32)
pub fn apply_viewport(&mut self, x: i32, y: i32, w: i32, h: i32)
Set a new viewport rectangle. Should be applied after begin_pass.
Sourcepub fn apply_scissor_rect(&mut self, x: i32, y: i32, w: i32, h: i32)
pub fn apply_scissor_rect(&mut self, x: i32, y: i32, w: i32, h: i32)
Set a new scissor rectangle. Should be applied after begin_pass.
pub fn apply_bindings(&mut self, bindings: &Bindings)
pub fn apply_uniforms<U>(&mut self, uniforms: &U)
pub fn clear( &self, color: Option<(f32, f32, f32, f32)>, depth: Option<f32>, stencil: Option<i32>, )
Sourcepub fn begin_default_pass(&mut self, action: PassAction)
pub fn begin_default_pass(&mut self, action: PassAction)
start rendering to the default frame buffer
Sourcepub fn begin_pass(
&mut self,
pass: impl Into<Option<RenderPass>>,
action: PassAction,
)
pub fn begin_pass( &mut self, pass: impl Into<Option<RenderPass>>, action: PassAction, )
start rendering to an offscreen framebuffer
pub fn end_render_pass(&mut self)
pub fn commit_frame(&mut self)
Sourcepub fn draw(&self, base_element: i32, num_elements: i32, num_instances: i32)
pub fn draw(&self, base_element: i32, num_elements: i32, num_instances: i32)
Draw elements using currently applied bindings and pipeline.
base_elementspecifies starting offset inindex_buffer.num_elementsspecifies length of the slice ofindex_bufferto draw.num_instancesspecifies how many instances should be rendered.
NOTE: num_instances > 1 might be not supported by the GPU (gl2.1 and gles2).
features.instancing check is required.
Source§impl GraphicsContext
impl GraphicsContext
pub fn display(&self) -> &(dyn NativeDisplay + 'static)
pub fn display_mut(&self) -> &mut (dyn NativeDisplay + 'static)
Sourcepub fn screen_size(&self) -> (f32, f32)
pub fn screen_size(&self) -> (f32, f32)
The current framebuffer size in pixels NOTE: High DPI Rendering
Sourcepub fn dpi_scale(&self) -> f32
pub fn dpi_scale(&self) -> f32
The dpi scaling factor (window pixels to framebuffer pixels) NOTE: High DPI Rendering
Sourcepub fn high_dpi(&self) -> bool
pub fn high_dpi(&self) -> bool
True when high_dpi was requested and actually running in a high-dpi scenario NOTE: High DPI Rendering
Sourcepub fn order_quit(&mut self)
pub fn order_quit(&mut self)
This function simply quits the application without giving the user a chance to intervene. Usually this might be called when the user clicks the ‘Ok’ button in a ‘Really Quit?’ dialog box Window might not be actually closed right away (exit(0) might not happen in the order_quit implmentation) and execution might continue for some time after But the window is going to be inevitably closed at some point.
Sourcepub fn request_quit(&mut self)
pub fn request_quit(&mut self)
Calling request_quit() will trigger “quit_requested_event” event , giving the user code a chance to intervene and cancel the pending quit process (for instance to show a ‘Really Quit?’ dialog box). If the event handler callback does nothing, the application will be quit as usual. To prevent this, call the function “cancel_quit()”“ from inside the event handler.
Sourcepub fn cancel_quit(&mut self)
pub fn cancel_quit(&mut self)
Cancels a pending quit request, either initiated by the user clicking the window close button, or programmatically by calling “request_quit()”. The only place where calling this function makes sense is from inside the event handler callback when the “quit_requested_event” event has been received
Sourcepub fn set_cursor_grab(&mut self, grab: bool)
pub fn set_cursor_grab(&mut self, grab: bool)
Capture mouse cursor to the current window On WASM this will automatically hide cursor On desktop this will bound cursor to windows border NOTICE: on desktop cursor will not be automatically released after window lost focus so set_cursor_grab(false) on window’s focus lost is recommended. TODO: implement window focus events
Sourcepub fn show_mouse(&mut self, shown: bool)
pub fn show_mouse(&mut self, shown: bool)
Show or hide the mouse cursor
Sourcepub fn set_mouse_cursor(&mut self, cursor_icon: CursorIcon)
pub fn set_mouse_cursor(&mut self, cursor_icon: CursorIcon)
Set the mouse cursor icon.
Sourcepub fn set_window_size(&mut self, new_width: u32, new_height: u32)
pub fn set_window_size(&mut self, new_width: u32, new_height: u32)
Set the application’s window size.
pub fn set_fullscreen(&mut self, fullscreen: bool)
Sourcepub fn clipboard_get(&mut self) -> Option<String>
pub fn clipboard_get(&mut self) -> Option<String>
Get current OS clipboard value
Sourcepub fn clipboard_set(&mut self, data: &str)
pub fn clipboard_set(&mut self, data: &str)
Save value to OS clipboard
pub fn dropped_file_count(&mut self) -> usize
pub fn dropped_file_bytes(&mut self, index: usize) -> Option<Vec<u8>>
pub fn dropped_file_path(&mut self, index: usize) -> Option<PathBuf>
Sourcepub fn show_keyboard(&mut self, show: bool)
pub fn show_keyboard(&mut self, show: bool)
Show/hide onscreen keyboard. Only works on Android right now.
Auto Trait Implementations§
impl Freeze for GraphicsContext
impl !RefUnwindSafe for GraphicsContext
impl !Send for GraphicsContext
impl !Sync for GraphicsContext
impl Unpin for GraphicsContext
impl !UnwindSafe for GraphicsContext
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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 more