use std::ops::Deref;
use std::path::{Path, PathBuf};
use libc;
pub struct LibDir(pub PathBuf);
impl Default for LibDir {
fn default() -> Self {
LibDir(Path::new("/opt/vc/lib").to_path_buf())
}
}
impl Deref for LibDir {
type Target = Path;
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[derive(Clone, Copy)]
pub enum Display {
Hdmi,
Analog,
Lcd,
}
impl Display {
pub fn index(&self) -> libc::uint16_t {
match *self {
Display::Hdmi => 2,
Display::Analog => 1,
Display::Lcd => 0,
}
}
}
impl Default for Display {
fn default() -> Self { Display::Hdmi }
}
#[derive(Copy, Clone)]
pub struct ColorBits(pub u32);
impl Default for ColorBits {
fn default() -> Self {
ColorBits(8)
}
}
impl Deref for ColorBits {
type Target = u32;
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[derive(Copy, Clone)]
pub struct DepthBits(pub u32);
impl Default for DepthBits {
fn default() -> Self {
DepthBits(16)
}
}
impl Deref for DepthBits {
type Target = u32;
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[derive(Copy, Clone, Default)]
pub struct WindowConfig {
pub display: Display,
pub surface_size: Option<(u32, u32)>,
pub red: ColorBits,
pub green: ColorBits,
pub blue: ColorBits,
pub alpha: Option<ColorBits>,
pub depth: Option<DepthBits>,
}