KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Framebuffer

API for framebuffer management. More...

Functions

void vid_set_vram (uint32_t base)
 Set the VRAM convenience pointers.
 
void vid_set_start (uint32_t base)
 Set the VRAM base of the framebuffer.
 
uint32_t vid_get_start (int32_t fb)
 Get the VRAM base of a framebuffer.
 
void vid_set_fb (int32_t fb)
 Set the current framebuffer in a multibuffered setup.
 
void vid_flip (int32_t fb)
 Flip to a framebuffer in a multibuffered setup.
 
void vid_clear (uint8_t r, uint8_t g, uint8_t b)
 Clear the framebuffer.
 
int vid_screen_shot (const char *destfn)
 Take a screenshot.
 

Variables

uint16_t * vram_s
 16-bit size pointer to the current drawing area.
 
uint32_t * vram_l
 32-bit size pointer to the current drawing area.
 

Detailed Description

API for framebuffer management.

Function Documentation

◆ vid_clear()

void vid_clear ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Clear the framebuffer.

This function sets the whole framebuffer to the specified color. Internally, this uses the store queues to actually clear the display entirely.

Note
This operates via the vram convenience pointers. In multibuffered mode, by default it will clear the framebuffer you are currently writing to rather than the one being displayed.
Parameters
rThe red value of the color (0-255).
gThe green value of the color (0-255).
bThe blue value of the color (0-255).

◆ vid_flip()

void vid_flip ( int32_t  fb)

Flip to a framebuffer in a multibuffered setup.

This function sets the displayed framebuffer to the specified buffer and sets the vram_s and vram_l pointers to point at the next framebuffer, to allow for tearing-free framebuffer-direct drawing.

Parameters
fbThe framebuffer to display or any other value to display the next one.

◆ vid_get_start()

uint32_t vid_get_start ( int32_t  fb)

Get the VRAM base of a framebuffer.

This function gets the position of the specified framebuffer within VRAM. Any invalid fb value will be treated as the current framebuffer.

Parameters
fbThe number of the framebuffer or -1 for current.

◆ vid_screen_shot()

int vid_screen_shot ( const char *  destfn)

Take a screenshot.

This function takes the current framebuffer (/vram_l) and dumps it out to a PPM file.

Parameters
destfnThe filename to save to.
Returns
0 on success, <0 on failure.

◆ vid_set_fb()

void vid_set_fb ( int32_t  fb)

Set the current framebuffer in a multibuffered setup.

This function sets the displayed framebuffer to the specified buffer. Unlike vid_set_fb, this does not point the vram pointers to the next framebuffer, allowing for non-linear management of the FBs.

Parameters
fbThe framebuffer to display or any other value to display the next one.

◆ vid_set_start()

void vid_set_start ( uint32_t  base)

Set the VRAM base of the framebuffer.

This function sets the vram_s and vram_l pointers to specified offset within VRAM and sets the start position of the framebuffer to the same offset.

Parameters
baseThe offset within VRAM to set the base to.

◆ vid_set_vram()

void vid_set_vram ( uint32_t  base)

Set the VRAM convenience pointers.

This function sets the vram_s and vram_l pointers to specified offset within VRAM. In multibuffered mode it allows manual management of them.

Parameters
baseThe offset within VRAM to set the base to.

Variable Documentation

◆ vram_l

uint32_t* vram_l
extern

32-bit size pointer to the current drawing area.

◆ vram_s

uint16_t* vram_s
extern

16-bit size pointer to the current drawing area.