#[doc(alias = "GSPGPU_Event")]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Event {
Psc0 = ctru_sys::GSPGPU_EVENT_PSC0,
Psc1 = ctru_sys::GSPGPU_EVENT_PSC1,
VBlank0 = ctru_sys::GSPGPU_EVENT_VBlank0,
VBlank1 = ctru_sys::GSPGPU_EVENT_VBlank1,
PPF = ctru_sys::GSPGPU_EVENT_PPF,
P3D = ctru_sys::GSPGPU_EVENT_P3D,
DMA = ctru_sys::GSPGPU_EVENT_DMA,
}
#[doc(alias = "GSPGPU_FramebufferFormat")]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum FramebufferFormat {
Rgba8 = ctru_sys::GSP_RGBA8_OES,
Bgr8 = ctru_sys::GSP_BGR8_OES,
Rgb565 = ctru_sys::GSP_RGB565_OES,
Rgb5A1 = ctru_sys::GSP_RGB5_A1_OES,
Rgba4 = ctru_sys::GSP_RGBA4_OES,
}
impl FramebufferFormat {
pub fn pixel_depth_bytes(&self) -> usize {
use self::FramebufferFormat::*;
match *self {
Rgba8 => 4,
Bgr8 => 3,
Rgb565 => 2,
Rgb5A1 => 2,
Rgba4 => 2,
}
}
}
#[doc(alias = "gspWaitForEvent")]
pub fn wait_for_event(ev: Event, discard_current: bool) {
unsafe {
ctru_sys::gspWaitForEvent(ev.into(), discard_current);
}
}
impl From<ctru_sys::GSPGPU_FramebufferFormat> for FramebufferFormat {
fn from(g: ctru_sys::GSPGPU_FramebufferFormat) -> Self {
use self::FramebufferFormat::*;
match g {
ctru_sys::GSP_RGBA8_OES => Rgba8,
ctru_sys::GSP_BGR8_OES => Bgr8,
ctru_sys::GSP_RGB565_OES => Rgb565,
ctru_sys::GSP_RGB5_A1_OES => Rgb5A1,
ctru_sys::GSP_RGBA4_OES => Rgba4,
_ => unreachable!(),
}
}
}
from_impl!(FramebufferFormat, ctru_sys::GSPGPU_FramebufferFormat);
from_impl!(Event, ctru_sys::GSPGPU_Event);