wut  v1.5.0
Wii U Toolchain
Typedefs | Enumerations | Functions
Screen

Software-rendered graphics system, suitable for text output and simple graphics. More...

Collaboration diagram for Screen:

Typedefs

typedef enum OSScreenID OSScreenID
 Defines the ID of a display usable with OSScreen. More...
 

Enumerations

enum  OSScreenID {
  SCREEN_TV = 0 ,
  SCREEN_DRC = 1
}
 Defines the ID of a display usable with OSScreen. More...
 

Functions

void OSScreenInit ()
 Initialises the OSScreen library for use. More...
 
void OSScreenShutdown ()
 Cleans up and shuts down the OSScreen library. More...
 
uint32_t OSScreenGetBufferSizeEx (OSScreenID screen)
 Gets the amount of memory required to fit both buffers of a given screen. More...
 
void OSScreenSetBufferEx (OSScreenID screen, void *addr)
 Sets the memory location for both buffers of a given screen. More...
 
void OSScreenClearBufferEx (OSScreenID screen, uint32_t colour)
 Clear the work buffer of the given screen by setting all of its pixels to a given colour. More...
 
void OSScreenFlipBuffersEx (OSScreenID screen)
 Swap the buffers of the given screen. More...
 
void OSScreenPutFontEx (OSScreenID screen, uint32_t row, uint32_t column, const char *buffer)
 Draws text at the given position. More...
 
void OSScreenPutPixelEx (OSScreenID screen, uint32_t x, uint32_t y, uint32_t colour)
 Draws a single pixel at the given position. More...
 
void OSScreenEnableEx (OSScreenID screen, BOOL enable)
 Enables or disables a given screen. More...
 

Detailed Description

Software-rendered graphics system, suitable for text output and simple graphics.

OSScreen is much more straightforward than GX2, which makes it appealing for situations that do not require complex graphics. It can draw text and pixels (one at a time!) to both the Gamepad and TV.

To use OSScreen, first call OSScreenInit. Then, allocate a memory area and pass it to OSScreen with OSScreenSetBufferEx - after enabling the screens with OSScreenEnableEx, the library will be ready to draw! Drawing is accomplished with OSScreenClearBufferEx, OSScreenPutFontEx and OSScreenPutPixelEx. Once drawing is complete, call OSScreenFlipBuffersEx to show the results on-screen. Rinse and repeat!

Typedef Documentation

◆ OSScreenID

typedef enum OSScreenID OSScreenID

Defines the ID of a display usable with OSScreen.

Enumeration Type Documentation

◆ OSScreenID

enum OSScreenID

Defines the ID of a display usable with OSScreen.

Enumerator
SCREEN_TV 

Represents the TV connected to the system.

SCREEN_DRC 

Represents the screen in the DRC (gamepad).

Definition at line 44 of file screen.h.

Function Documentation

◆ OSScreenInit()

void OSScreenInit ( )

Initialises the OSScreen library for use.

This function must be called before using any other OSScreen functions.

See also

◆ OSScreenShutdown()

void OSScreenShutdown ( )

Cleans up and shuts down the OSScreen library.

See also

◆ OSScreenGetBufferSizeEx()

uint32_t OSScreenGetBufferSizeEx ( OSScreenID  screen)

Gets the amount of memory required to fit both buffers of a given screen.

Parameters
screenThe ID of the screen to be sized.
See also

◆ OSScreenSetBufferEx()

void OSScreenSetBufferEx ( OSScreenID  screen,
void *  addr 
)

Sets the memory location for both buffers of a given screen.

This location must be of the size prescribed by OSScreenGetBufferSizeEx and at an address aligned to 0x100 bytes.

Parameters
screenThe ID of the screen whose memory location should be changed.
addrPointer to the memory to use. This area must be 0x100 aligned, and of the size given by OSScreenGetBufferSizeEx.
See also

◆ OSScreenClearBufferEx()

void OSScreenClearBufferEx ( OSScreenID  screen,
uint32_t  colour 
)

Clear the work buffer of the given screen by setting all of its pixels to a given colour.

Parameters
screenThe ID of the screen to clear. Only the work buffer will be cleared.
colourThe colour to use, in big-endian RGBX8 format - 0xRRGGBBXX, where X bits are ignored.
Note
Since this function only affects the work buffer, its effect will not appear on screen immediately. See OSScreenFlipBuffersEx.
See also

◆ OSScreenFlipBuffersEx()

void OSScreenFlipBuffersEx ( OSScreenID  screen)

Swap the buffers of the given screen.

The work buffer will become the visible buffer and will start being shown on-screen, while the visible buffer becomes the new work buffer. This operation is known as "flipping" the buffers.

You must call this function once drawing is complete, otherwise draws will not appear on-screen.

Parameters
screenThe ID of the screen to flip.

◆ OSScreenPutFontEx()

void OSScreenPutFontEx ( OSScreenID  screen,
uint32_t  row,
uint32_t  column,
const char *  buffer 
)

Draws text at the given position.

The text will be drawn to the work buffer with a built-in monospace font, coloured white, and anti-aliased. The position coordinates are in characters, not pixels.

Parameters
screenThe ID of the screen to draw to. Only the work buffer will be affected.
rowThe row, in characters, to place the text in. 0 corresponds to the top of the screen.
columnThe column, in characters, to place the text at. 0 corresponds to the left of the screen.
bufferPointer to the string of text to draw. Null-terminated.
Note
Since this function only affects the work buffer, its effect will not appear on screen immediately. See OSScreenFlipBuffersEx.
See also

◆ OSScreenPutPixelEx()

void OSScreenPutPixelEx ( OSScreenID  screen,
uint32_t  x,
uint32_t  y,
uint32_t  colour 
)

Draws a single pixel at the given position.

The pixel, a 32-bit RGBX colour, will be placed in the work buffer at the coordinates given.

Parameters
screenThe ID of the screen to place the pixel in.
xThe x-coordinate, in pixels, to draw the pixel at.
yThe y-coordinate, in pixels, to draw the pixel at.
colourThe desired colour of the pixel to draw, in RGBX32 colour (0xRRGGBBXX, where the XX value is ignored).
Note
Since this function only affects the work buffer, its effect will not appear on screen immediately. See OSScreenFlipBuffersEx.
See also

◆ OSScreenEnableEx()

void OSScreenEnableEx ( OSScreenID  screen,
BOOL  enable 
)

Enables or disables a given screen.

If a screen is disabled, it shows black.

Parameters
screenThe ID of the screen to enable or disable.
enabletrue if the screen should be enabled, otherwise false.