#[derive(Debug)]
pub enum LinuxX11Gl {
GLXOnly,
EGLOnly,
GLXWithEGLFallback,
EGLWithGLXFallback,
}
#[derive(Debug)]
pub enum LinuxBackend {
X11Only,
WaylandOnly,
X11WithWaylandFallback,
WaylandWithX11Fallback,
}
#[derive(Debug)]
pub struct Platform {
pub linux_x11_gl: LinuxX11Gl,
pub linux_backend: LinuxBackend,
pub swap_interval: Option<i32>,
pub framebuffer_alpha: bool,
}
impl Default for Platform {
fn default() -> Platform {
Platform {
linux_x11_gl: LinuxX11Gl::GLXWithEGLFallback,
swap_interval: None,
linux_backend: LinuxBackend::X11Only,
framebuffer_alpha: false,
}
}
}
#[derive(Debug)]
pub struct Conf {
pub window_title: String,
pub window_width: i32,
pub window_height: i32,
pub high_dpi: bool,
pub fullscreen: bool,
pub sample_count: i32,
pub window_resizable: bool,
pub icon: Option<Icon>,
pub platform: Platform,
}
#[derive(Clone)]
pub struct Icon {
pub small: [u8; 16 * 16 * 4],
pub medium: [u8; 32 * 32 * 4],
pub big: [u8; 64 * 64 * 4],
}
impl Icon {
pub fn miniquad_logo() -> Icon {
Icon {
small: crate::default_icon::SMALL,
medium: crate::default_icon::MEDIUM,
big: crate::default_icon::BIG,
}
}
}
impl std::fmt::Debug for Icon {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Icon").finish()
}
}
#[cfg(not(target_os = "android"))]
impl Default for Conf {
fn default() -> Conf {
Conf {
window_title: "".to_owned(),
window_width: 800,
window_height: 600,
high_dpi: false,
fullscreen: false,
sample_count: 1,
window_resizable: true,
icon: Some(Icon::miniquad_logo()),
platform: Default::default(),
}
}
}
#[cfg(target_os = "android")]
impl Default for Conf {
fn default() -> Conf {
Conf {
window_title: "".to_owned(),
window_width: 800,
window_height: 600,
high_dpi: true,
fullscreen: true,
sample_count: 1,
window_resizable: false,
icon: Some(Icon::miniquad_logo()),
platform: Default::default(),
}
}
}