pub struct App {}Expand description
A struct representing an application.
Implementations§
Source§impl App
impl App
Sourcepub fn get_buffer_size() -> Size
pub fn get_buffer_size() -> Size
Gets the size of the main frame buffer texture used for rendering.
Sourcepub fn get_visual_size() -> Size
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.
Sourcepub fn get_device_pixel_ratio() -> f32
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.
Sourcepub fn get_platform() -> String
pub fn get_platform() -> String
Gets the platform the game engine is running on.
Sourcepub fn get_version() -> String
pub fn get_version() -> String
Gets the version string of the game engine. Should be in format of “v0.0.0”.
Sourcepub fn get_delta_time() -> f64
pub fn get_delta_time() -> f64
Gets the time in seconds since the last frame update.
Sourcepub fn get_elapsed_time() -> f64
pub fn get_elapsed_time() -> f64
Gets the elapsed time since current frame was started, in seconds.
Sourcepub fn get_total_time() -> f64
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.
Sourcepub fn get_running_time() -> f64
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.
Sourcepub fn get_rand() -> i64
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.
Sourcepub fn get_max_fps() -> i32
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.
Sourcepub fn is_debugging() -> bool
pub fn is_debugging() -> bool
Gets whether the game engine is running in debug mode.
Sourcepub fn set_locale(val: &str)
pub fn set_locale(val: &str)
Sets the system locale string, in format like: zh-Hans, en.
Sourcepub fn get_locale() -> String
pub fn get_locale() -> String
Gets the system locale string, in format like: zh-Hans, en.
Sourcepub fn set_theme_color(val: &Color)
pub fn set_theme_color(val: &Color)
Sets the theme color for Dora SSR.
Sourcepub fn get_theme_color() -> Color
pub fn get_theme_color() -> Color
Gets the theme color for Dora SSR.
Sourcepub fn set_target_fps(val: i32)
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.
Sourcepub fn get_target_fps() -> i32
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.
Sourcepub fn set_win_size(val: &Size)
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.
Sourcepub fn get_win_size() -> Size
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.
Sourcepub fn set_win_position(val: &Vec2)
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.
Sourcepub fn get_win_position() -> Vec2
pub fn get_win_position() -> Vec2
Gets the application window position. It is not available to set this property on platform Android and iOS.
Sourcepub fn set_fps_limited(val: bool)
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.
Sourcepub fn is_fps_limited() -> bool
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.
Sourcepub fn set_idled(val: bool)
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.
Sourcepub fn is_idled() -> bool
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.
Sourcepub fn set_full_screen(val: bool)
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.
Sourcepub fn is_full_screen() -> bool
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.
Sourcepub fn set_always_on_top(val: bool)
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.
Sourcepub fn is_always_on_top() -> bool
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.