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

This API provides a virtual framebuffer abstraction for the VMU with a series of convenient methods for drawing complex and dynamic content. More...

Files

file  vmu_fb.h
 VMU framebuffer.
 

Data Structures

struct  vmufb_t
 Virtual framebuffer for the VMU. More...
 
struct  vmufb_font_t
 VMU framebuffer font meta-data. More...
 

Functions

void vmufb_paint_area (vmufb_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, const char *data)
 Render into the VMU framebuffer.
 
void vmufb_clear_area (vmufb_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h)
 Clear a specific area of the VMU framebuffer.
 
void vmufb_clear (vmufb_t *fb)
 Clear the VMU framebuffer.
 
void vmufb_present (const vmufb_t *fb, maple_device_t *dev)
 Present the VMU framebuffer to a VMU.
 
void vmufb_print_string_into (vmufb_t *fb, const vmufb_font_t *font, unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int line_spacing, const char *str)
 Render a string into the VMU framebuffer.
 
static __inline__ void vmufb_print_string (vmufb_t *fb, const vmufb_font_t *font, const char *str)
 Render a string into the VMU framebuffer.
 
void vmu_printf (const char *fmt,...) __printflike(1
 Render a string to attached VMUs using the built-in font.
 
void const vmufb_font_tvmu_set_font (const vmufb_font_t *font)
 Sets the default font for drawing text to the VMU.
 
const vmufb_font_tvmu_get_font (void)
 Returns the default font used to draw text to the VMU.
 

Detailed Description

This API provides a virtual framebuffer abstraction for the VMU with a series of convenient methods for drawing complex and dynamic content.

Function Documentation

◆ vmu_get_font()

const vmufb_font_t * vmu_get_font ( void )

Returns the default font used to draw text to the VMU.

Returns
Pointer to the font currently set as the default
See also
vmu_set_font()

◆ vmu_printf()

void vmu_printf ( const char * fmt,
... )

Render a string to attached VMUs using the built-in font.

Uses the built-in VMU font to render a string to all VMUs connected to the system.

Note
The font currently set as the default font will be used.
Parameters
fmtThe format string, optionally followed by extra arguments.
See also
vmu_set_font()

◆ vmu_set_font()

void const vmufb_font_t * vmu_set_font ( const vmufb_font_t * font)

Sets the default font for drawing text to the VMU.

This function allows you to set a custom font for drawing text to the VMU screen. If the font parameter is set to NULL, the built-in VMU font will be used as the default.

Warning
The API does not take ownership of or copy font, so the given pointer must remain valid as long as it is set as the default!
Parameters
fontPointer to the font to set as default
Returns
Pointer to the previous default font
See also
vmu_get_font()

◆ vmufb_clear()

void vmufb_clear ( vmufb_t * fb)

Clear the VMU framebuffer.

This function clears the whole VMU framebuffer.

Parameters
fbA pointer to the vmufb_t to paint to.

◆ vmufb_clear_area()

void vmufb_clear_area ( vmufb_t * fb,
unsigned int x,
unsigned int y,
unsigned int w,
unsigned int h )

Clear a specific area of the VMU framebuffer.

This function clears the area of the VMU framebuffer designated by the x, y, w and h values.

Parameters
fbA pointer to the vmufb_t to paint to.
xThe horizontal position of the top-left corner of the drawing area, in pixels
yThe vertical position of the top-left corner of the drawing area, in pixels
wThe width of the drawing area, in pixels
hThe height of the drawing area, in pixels

◆ vmufb_paint_area()

void vmufb_paint_area ( vmufb_t * fb,
unsigned int x,
unsigned int y,
unsigned int w,
unsigned int h,
const char * data )

Render into the VMU framebuffer.

This function will paint the provided pixel data into the VMU framebuffer, into the rectangle provided by the x, y, w and h values.

Parameters
fbA pointer to the vmufb_t to paint to.
xThe horizontal position of the top-left corner of the drawing area, in pixels
yThe vertical position of the top-left corner of the drawing area, in pixels
wThe width of the drawing area, in pixels
hThe height of the drawing area, in pixels
dataA pointer to the pixel data that will be painted into the drawing area.

◆ vmufb_present()

void vmufb_present ( const vmufb_t * fb,
maple_device_t * dev )

Present the VMU framebuffer to a VMU.

This function presents the previously rendered VMU framebuffer to the VMU identified by the dev argument.

Parameters
fbA pointer to the vmufb_t to paint to.
devThe maple device of the VMU to present to

◆ vmufb_print_string()

static __inline__ void vmufb_print_string ( vmufb_t * fb,
const vmufb_font_t * font,
const char * str )
static

Render a string into the VMU framebuffer.

Simplified version of vmufb_print_string_into(). This is the same as calling vmufb_print_string_into with x=0, y=0, w=48, h=32, line_spacing=0.

Parameters
fbA pointer to the vmufb_t to paint to.
fontA pointer to the vmufb_font_t that will be used for painting the text (or NULL to use the default)
strThe text to render

References VMU_SCREEN_HEIGHT, VMU_SCREEN_WIDTH, and vmufb_print_string_into().

◆ vmufb_print_string_into()

void vmufb_print_string_into ( vmufb_t * fb,
const vmufb_font_t * font,
unsigned int x,
unsigned int y,
unsigned int w,
unsigned int h,
unsigned int line_spacing,
const char * str )

Render a string into the VMU framebuffer.

This function uses the provided font to render text into the VMU framebuffer.

Parameters
fbA pointer to the vmufb_t to paint to.
fontA pointer to the vmufb_font_t that will be used for painting the text (or NULL to use the default)
xThe horizontal position of the top-left corner of the drawing area, in pixels
yThe vertical position of the top-left corner of the drawing area, in pixels
wThe width of the drawing area, in pixels
hThe height of the drawing area, in pixels
line_spacingSpecify the number of empty lines that should separate two lines of text
strThe text to render

Referenced by vmufb_print_string().