App

Struct App 

Source
pub struct App {}
Expand description

A struct representing an application.

Implementations§

Source§

impl App

Source

pub fn get_frame() -> i32

Gets the current passed frame number.

Source

pub fn get_buffer_size() -> Size

Gets the size of the main frame buffer texture used for rendering.

Source

pub fn get_visual_size() -> Size

Gets the logic visual size of the screen. The visual size only changes when application window size changes. And it won’t be affacted by the view buffer scaling factor.

Source

pub fn get_device_pixel_ratio() -> f32

Gets the ratio of the pixel density displayed by the device Can be calculated as the size of the rendering buffer divided by the size of the application window.

Source

pub fn get_platform() -> String

Gets the platform the game engine is running on.

Source

pub fn get_version() -> String

Gets the version string of the game engine. Should be in format of “v0.0.0”.

Source

pub fn get_deps() -> String

Gets the dependencies of the game engine.

Source

pub fn get_delta_time() -> f64

Gets the time in seconds since the last frame update.

Source

pub fn get_elapsed_time() -> f64

Gets the elapsed time since current frame was started, in seconds.

Source

pub fn get_total_time() -> f64

Gets the total time the game engine has been running until last frame ended, in seconds. Should be a contant number when invoked in a same frame for multiple times.

Source

pub fn get_running_time() -> f64

Gets the total time the game engine has been running until this field being accessed, in seconds. Should be a increasing number when invoked in a same frame for multiple times.

Source

pub fn get_rand() -> i64

Gets a random number generated by a random number engine based on Mersenne Twister algorithm. So that the random number generated by a same seed should be consistent on every platform.

Source

pub fn get_max_fps() -> i32

Gets the maximum valid frames per second the game engine is allowed to run at. The max FPS is being inferred by the device screen max refresh rate.

Source

pub fn is_debugging() -> bool

Gets whether the game engine is running in debug mode.

Source

pub fn set_locale(val: &str)

Sets the system locale string, in format like: zh-Hans, en.

Source

pub fn get_locale() -> String

Gets the system locale string, in format like: zh-Hans, en.

Source

pub fn set_theme_color(val: &Color)

Sets the theme color for Dora SSR.

Source

pub fn get_theme_color() -> Color

Gets the theme color for Dora SSR.

Source

pub fn set_seed(val: i32)

Sets the random number seed.

Source

pub fn get_seed() -> i32

Gets the random number seed.

Source

pub fn set_target_fps(val: i32)

Sets the target frames per second the game engine is supposed to run at. Only works when fpsLimited is set to true.

Source

pub fn get_target_fps() -> i32

Gets the target frames per second the game engine is supposed to run at. Only works when fpsLimited is set to true.

Source

pub fn set_win_size(val: &Size)

Sets the application window size. May differ from visual size due to the different DPIs of display devices. It is not available to set this property on platform Android and iOS.

Source

pub fn get_win_size() -> Size

Gets the application window size. May differ from visual size due to the different DPIs of display devices. It is not available to set this property on platform Android and iOS.

Source

pub fn set_win_position(val: &Vec2)

Sets the application window position. It is not available to set this property on platform Android and iOS.

Source

pub fn get_win_position() -> Vec2

Gets the application window position. It is not available to set this property on platform Android and iOS.

Source

pub fn set_fps_limited(val: bool)

Sets whether the game engine is limiting the frames per second. Set fpsLimited to true, will make engine run in a busy loop to track the precise frame time to switch to the next frame. And this behavior can lead to 100% CPU usage. This is usually common practice on Windows PCs for better CPU usage occupation. But it also results in extra heat and power consumption.

Source

pub fn is_fps_limited() -> bool

Gets whether the game engine is limiting the frames per second. Set fpsLimited to true, will make engine run in a busy loop to track the precise frame time to switch to the next frame. And this behavior can lead to 100% CPU usage. This is usually common practice on Windows PCs for better CPU usage occupation. But it also results in extra heat and power consumption.

Source

pub fn set_idled(val: bool)

Sets whether the game engine is currently idled. Set idled to true, will make game logic thread use a sleep time and going idled for next frame to come. Due to the imprecision in sleep time. This idled state may cause game engine over slept for a few frames to lost. idled state can reduce some CPU usage.

Source

pub fn is_idled() -> bool

Gets whether the game engine is currently idled. Set idled to true, will make game logic thread use a sleep time and going idled for next frame to come. Due to the imprecision in sleep time. This idled state may cause game engine over slept for a few frames to lost. idled state can reduce some CPU usage.

Source

pub fn set_full_screen(val: bool)

Sets whether the game engine is running in full screen mode. It is not available to set this property on platform Android and iOS.

Source

pub fn is_full_screen() -> bool

Gets whether the game engine is running in full screen mode. It is not available to set this property on platform Android and iOS.

Source

pub fn set_always_on_top(val: bool)

Sets whether the game engine window is always on top. Default is true. It is not available to set this property on platform Android and iOS.

Source

pub fn is_always_on_top() -> bool

Gets whether the game engine window is always on top. Default is true. It is not available to set this property on platform Android and iOS.

Source

pub fn shutdown()

Shuts down the game engine. It is not working and acts as a dummy function for platform Android and iOS to follow the specification of how mobile platform applications should operate.

Auto Trait Implementations§

§

impl Freeze for App

§

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 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.