aboutsummaryrefslogtreecommitdiff
path: root/ctru-sys/src/gfx.rs
blob: 1af87eea502161d38e0713f38f3589c2256fba8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use services::gspgpu::*;

#[inline]
pub fn RGB565(r: u32, g: u32, b: u32) -> u32 {
    (((b)&0x1f)|(((g)&0x3f)<<5)|(((r)&0x1f)<<11))
}

#[inline]
pub fn RGB8_to_565(r: u32, g: u32, b: u32) -> u32 {
    (((b)>>3)&0x1f)|((((g)>>2)&0x3f)<<5)|((((r)>>3)&0x1f)<<11)
}

#[repr(C)]
pub enum gfxScreen_t {
    GFX_TOP = 0,
    GFX_BOTTOM = 1
}

#[repr(C)]
pub enum gfx3dSide_t {
    GFX_LEFT = 0,
    GFX_RIGHT = 1
}

extern "C" {
    pub static mut gfxTopLeftFramebuffers: [*mut u8; 2usize];
    pub static mut gfxTopRightFramebuffers: [*mut u8; 2usize];
    pub static mut gfxBottomFramebuffers: [*mut u8; 2usize];

    pub fn gfxInitDefault();
    pub fn gfxInit(topFormat: GSPGPU_FramebufferFormats,
                   bottomFormat: GSPGPU_FramebufferFormats, vrambuffers: u8);
    pub fn gfxExit();
    pub fn gfxSet3D(enable: u8);
    pub fn gfxIs3D() -> u8;
    pub fn gfxSetScreenFormat(screen: gfxScreen_t,
                              format: GSPGPU_FramebufferFormats);
    pub fn gfxGetScreenFormat(screen: gfxScreen_t)
     -> GSPGPU_FramebufferFormats;
    pub fn gfxSetDoubleBuffering(screen: gfxScreen_t, doubleBuffering: u8);
    pub fn gfxFlushBuffers();
    pub fn gfxConfigScreen(scr: gfxScreen_t, immediate: u8);
    pub fn gfxSwapBuffers();
    pub fn gfxSwapBuffersGpu();
    pub fn gfxGetFramebuffer(screen: gfxScreen_t, side: gfx3dSide_t,
                             width: *mut u16, height: *mut u16) -> *mut u8;

}