[−][src]Struct yagl::AppContext
A reference to an instance of this struct is passed to most methods on Game. This struct allows Game methods to be able to interact with yagl about App related things (e.g. requesting to exit)
Implementations
impl<'a> AppContext<'a>
[src]
impl<'a> AppContext<'a>
[src]
Graphics methods
pub fn scale(&self) -> [f32; 2]
[src]
Returns the bounds of the visible screen
By default, the scale is set such that they correspond to the size of the screen in pixels, but this can be overriden by explicitly calling set_scale
When the window is resized, the scale will always be rescaled to match the default. To override this behavior, you should implement Game::resize
pub fn set_scale(&mut self, scale: [f32; 2])
[src]
pub fn new_sheet_from_bytes(&mut self, bytes: &[u8]) -> Result<Rc<SpriteSheet>>
[src]
Creates a new sprite sheet from the bytes of some image
file.
The data is ultimately parsed passing to the
load_from_memory
function in the image
crate.
pub fn new_sheet_from_colors<C, V>(
&mut self,
width: u32,
height: u32,
colors: V
) -> Result<Rc<SpriteSheet>> where
C: Into<Color>,
V: IntoIterator<Item = C>,
[src]
&mut self,
width: u32,
height: u32,
colors: V
) -> Result<Rc<SpriteSheet>> where
C: Into<Color>,
V: IntoIterator<Item = C>,
Creates a new sprite sheet from explicitly specified colors
pub fn new_sheet_from_color<C: Into<Color>>(
&mut self,
color: C
) -> Result<Rc<SpriteSheet>>
[src]
&mut self,
color: C
) -> Result<Rc<SpriteSheet>>
Creates a new sprite sheet 1 pixel by 1 pixel wide with the given color
pub fn new_sheet_from_rgba_bytes(
&mut self,
width: u32,
height: u32,
bytes: Vec<u8>
) -> Result<Rc<SpriteSheet>>
[src]
&mut self,
width: u32,
height: u32,
bytes: Vec<u8>
) -> Result<Rc<SpriteSheet>>
Creates a new sprite sheet from a Vec
pub fn load_courier_font_sheet(&mut self) -> Result<Rc<SpriteSheet>>
[src]
pub fn new_batch(&mut self, sheet: Rc<SpriteSheet>) -> Result<SpriteBatch>
[src]
Creates a new SpriteBatch from a SpriteSheet
pub fn new_batch_from_color<C: Into<Color>>(
&mut self,
color: C
) -> Result<SpriteBatch>
[src]
&mut self,
color: C
) -> Result<SpriteBatch>
pub fn new_text_grid(
&mut self,
char_width: f32,
dim: [u32; 2]
) -> Result<TextGrid>
[src]
&mut self,
char_width: f32,
dim: [u32; 2]
) -> Result<TextGrid>
Create a new text grid from a character width and [nrows, ncols] pair. Uses the default courier font bundled with A2D
Auto Trait Implementations
impl<'a> !RefUnwindSafe for AppContext<'a>
impl<'a> !Send for AppContext<'a>
impl<'a> !Sync for AppContext<'a>
impl<'a> Unpin for AppContext<'a>
impl<'a> !UnwindSafe for AppContext<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,