Struct uni_app::sys::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 !RefUnwindSafe for App

§

impl !Send for App

§

impl !Sync for App

§

impl Unpin for App

§

impl !UnwindSafe for App

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.