Trait ctru::services::gfx::Screen

source ·
pub trait Screen: Sealed {
    // Required methods
    fn as_raw(&self) -> gfxScreen_t;
    fn side(&self) -> Side;

    // Provided methods
    fn raw_framebuffer(&mut self) -> RawFrameBuffer<'_> { ... }
    fn framebuffer_format(&self) -> FramebufferFormat { ... }
    fn set_framebuffer_format(&mut self, fmt: FramebufferFormat) { ... }
}
Expand description

Trait to handle common functionality for all screens.

This trait is implemented by the screen structs for working with frame buffers and drawing to the screens. Graphics-related code can be made generic over this trait to work with any of the given screens.

Required Methods§

source

fn as_raw(&self) -> gfxScreen_t

Returns the libctru value for the Screen kind.

source

fn side(&self) -> Side

Returns the Screen side (left or right).

Provided Methods§

source

fn raw_framebuffer(&mut self) -> RawFrameBuffer<'_>

Returns a RawFrameBuffer for the screen (if the framebuffer was allocated on the HEAP).

§Notes

The pointer of the framebuffer returned by this function can change after each call to this function if double buffering is enabled, so it’s suggested to NOT save it for later use.

§Panics

If the Gfx service was initialised via Gfx::with_formats_vram() this function will crash the program with an ARM exception.

source

fn framebuffer_format(&self) -> FramebufferFormat

Gets the framebuffer format.

source

fn set_framebuffer_format(&mut self, fmt: FramebufferFormat)

Change the framebuffer format.

Swap::swap_buffers must be called after this method for the configuration change to take effect.

Implementors§