Skip to main content

App

Struct App 

Source
pub struct App {
    pub events: Rc<RefCell<Vec<AppEvent>>>,
    /* private fields */
}
Expand description

the main application struct

Fields§

§events: Rc<RefCell<Vec<AppEvent>>>

Implementations§

Source§

impl App

Source

pub fn new(config: AppConfig) -> App

create a new game window

Source

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

return the screen resolution in physical pixels

Source

pub fn get_params() -> Vec<String>

return the command line / URL parameters

Source

pub fn set_fullscreen(&mut self, b: bool)

activate or deactivate fullscreen. only works on native target

Source

pub fn print<T: Into<String>>(msg: T)

print a message on standard output (native) or js console (web)

Source

pub fn exit()

exit current process (close the game window). On web target, this does nothing.

Source

pub fn hidpi_factor(&self) -> f32

returns the HiDPI factor for current screen

Source

pub fn canvas<'p>(&'p self) -> Box<dyn FnMut(&str) -> *const c_void + 'p>

return the opengl context for this window

Source

pub fn get_dropped_file(&mut self) -> Option<File>

Source

pub fn run<'a, F>(self, callback: F)
where F: 'static + FnMut(&mut Self),

start the game loop, calling provided callback every frame

Auto Trait Implementations§

§

impl !Freeze for App

§

impl !RefUnwindSafe for App

§

impl !Send for App

§

impl !Sync for App

§

impl !UnwindSafe for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.