2019-11-25 14:17:13 +01:00
|
|
|
//! Configure your application.
|
2019-12-03 20:49:57 +01:00
|
|
|
#[cfg(target_os = "windows")]
|
2020-03-30 18:00:15 +02:00
|
|
|
#[path = "settings/windows.rs"]
|
2019-12-03 20:49:57 +01:00
|
|
|
mod platform;
|
|
|
|
|
#[cfg(not(target_os = "windows"))]
|
2020-03-30 18:00:15 +02:00
|
|
|
#[path = "settings/not_windows.rs"]
|
2019-12-03 07:20:22 +01:00
|
|
|
mod platform;
|
2019-11-30 21:32:46 +09:00
|
|
|
|
|
|
|
|
pub use platform::PlatformSpecific;
|
|
|
|
|
|
2019-11-25 14:17:13 +01:00
|
|
|
/// The settings of an application.
|
2020-03-30 18:00:15 +02:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
|
|
|
|
pub struct Settings<Flags> {
|
2019-11-25 14:17:13 +01:00
|
|
|
/// The [`Window`] settings
|
|
|
|
|
///
|
|
|
|
|
/// [`Window`]: struct.Window.html
|
|
|
|
|
pub window: Window,
|
2019-12-29 12:29:47 +01:00
|
|
|
|
2020-03-30 18:00:15 +02:00
|
|
|
/// The data needed to initialize an [`Application`].
|
|
|
|
|
///
|
|
|
|
|
/// [`Application`]: trait.Application.html
|
|
|
|
|
pub flags: Flags,
|
2019-11-25 14:17:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// The window settings of an application.
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
|
|
|
pub struct Window {
|
|
|
|
|
/// The size of the window.
|
|
|
|
|
pub size: (u32, u32),
|
|
|
|
|
|
|
|
|
|
/// Whether the window should be resizable or not.
|
|
|
|
|
pub resizable: bool,
|
2019-11-30 20:38:32 +09:00
|
|
|
|
|
|
|
|
/// Whether the window should have a border, a title bar, etc.
|
|
|
|
|
pub decorations: bool,
|
2019-11-30 21:32:46 +09:00
|
|
|
|
2019-12-03 07:20:22 +01:00
|
|
|
/// Platform specific settings.
|
2019-11-30 21:32:46 +09:00
|
|
|
pub platform_specific: platform::PlatformSpecific,
|
2019-11-25 14:17:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Default for Window {
|
|
|
|
|
fn default() -> Window {
|
|
|
|
|
Window {
|
|
|
|
|
size: (1024, 768),
|
|
|
|
|
resizable: true,
|
2019-11-30 20:38:32 +09:00
|
|
|
decorations: true,
|
2019-11-30 21:32:46 +09:00
|
|
|
platform_specific: Default::default(),
|
2019-11-25 14:17:13 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|