Struct gate::AppContext [−][src]
pub struct AppContext<A: AppAssetId> { pub audio: Audio<A>, // some fields omitted }
Context passed to methods in App
.
Fields
audio: Audio<A>
Audio playback.
Methods
impl<A: AppAssetId> AppContext<A>
[src]
impl<A: AppAssetId> AppContext<A>
pub fn dims(&self) -> (f64, f64)
[src]
pub fn dims(&self) -> (f64, f64)
Returns the app (width, height), which are restricted by the min/max dimensions
specified in AppInfo
.
pub fn cursor(&self) -> (f64, f64)
[src]
pub fn cursor(&self) -> (f64, f64)
Returns the mouse cursor (x, y) position in app coordinates.
The x coordinate lies in the range 0
to self.dims().0
.
The y coordinate lies in the range 0
to self.dims().1
.
pub fn native_px(&self) -> f64
[src]
pub fn native_px(&self) -> f64
Returns the width of a native pixel, measured in "app pixels".
This value will always be at most 1.
pub fn native_px_align(&self, x: f64, y: f64) -> (f64, f64)
[src]
pub fn native_px_align(&self, x: f64, y: f64) -> (f64, f64)
Convenience method for aligning an (x, y)
position to the nearest native pixel boundaries.
This is typically used to align a camera position.
See also self.native_px()
.
pub fn close(&mut self)
[src]
pub fn close(&mut self)
Closes the app entirely.
When compiling to wasm32-unknown-unknown
, the app may be resumed after it is closed
via invoking a JavaScript method.
Auto Trait Implementations
impl<A> !Send for AppContext<A>
impl<A> !Send for AppContext<A>
impl<A> !Sync for AppContext<A>
impl<A> !Sync for AppContext<A>