pub struct AppInfo { /* private fields */ }
Expand description
A struct for specifying initialization information for running an App
.
Methods for setting fields in AppInfo
are intended to be chained together like
the builder pattern.
Example
use gate::AppInfo;
let info = AppInfo::with_max_dims(160., 90.)
.min_dims(120., 86.)
.tile_width(16)
.title("My Game")
.target_fps(30.)
.print_workload_info()
.print_gl_info();
Implementations
sourceimpl AppInfo
impl AppInfo
sourcepub fn with_max_dims(max_width: f64, max_height: f64) -> AppInfo
pub fn with_max_dims(max_width: f64, max_height: f64) -> AppInfo
Returns a new AppInfo
, initialized with the maximum app dimensions.
These dimensions are specified in conceptual “app pixels”,
which defines the units used by the renderers.
Even if a window is resized, this conecptual max_width
and max_height
will never be exceeded.
Max width/height must be at least 1.
sourcepub fn min_dims(self, min_width: f64, min_height: f64) -> Self
pub fn min_dims(self, min_width: f64, min_height: f64) -> Self
Specifies the minimum dimensions in “app pixels” (default is 0).
Even if you want height to be fixed, it is good practice to design the app so that min_height is slightly less than max_height. Under normal circumstances, the app dimensions will not fall below these minimum dimensions, but there are some extreme cases in which it could. App dimensions will never fall below 1.
sourcepub fn tile_width(self, tile_width: u32) -> Self
pub fn tile_width(self, tile_width: u32) -> Self
Specifies the tile width for meshing tiles.
If this value is set, the app dimensions are chosen carefully to ensure that the width of a tile is aligned to native pixels.
sourcepub fn title(self, title: &'static str) -> Self
pub fn title(self, title: &'static str) -> Self
Specifies a window title (default is “untitled app”).
sourcepub fn native_dims(self, width: u32, height: u32) -> Self
pub fn native_dims(self, width: u32, height: u32) -> Self
Specifies the intial native width and height of the window (default is 800
by 600
).
sourcepub fn target_fps(self, target_fps: f64) -> Self
pub fn target_fps(self, target_fps: f64) -> Self
Specifies the target frames-per-second (default is 60.
).
sourcepub fn print_workload_info(self) -> Self
pub fn print_workload_info(self) -> Self
If invoked, workload info will be printed to standard output periodically.
sourcepub fn print_gl_info(self) -> Self
pub fn print_gl_info(self) -> Self
If invoked, the OpenGL version info will be printed out at the start of the application.