wut
v1.7.0
Wii U Toolchain
|
Software-rendered graphics system, suitable for text output and simple graphics. More...
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 column, uint32_t row, 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... | |
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 enum OSScreenID OSScreenID |
Defines the ID of a display usable with OSScreen.
enum OSScreenID |
void OSScreenInit | ( | ) |
Initialises the OSScreen library for use.
This function must be called before using any other OSScreen functions.
void OSScreenShutdown | ( | ) |
Cleans up and shuts down the OSScreen library.
uint32_t OSScreenGetBufferSizeEx | ( | OSScreenID | screen | ) |
Gets the amount of memory required to fit both buffers of a given screen.
screen | The ID of the screen to be sized. |
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.
screen | The ID of the screen whose memory location should be changed. |
addr | Pointer to the memory to use. This area must be 0x100 aligned, and of the size given by OSScreenGetBufferSizeEx. |
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.
screen | The ID of the screen to clear. Only the work buffer will be cleared. |
colour | The colour to use, in big-endian RGBX8 format - 0xRRGGBBXX, where X bits are ignored. |
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.
screen | The ID of the screen to flip. |
void OSScreenPutFontEx | ( | OSScreenID | screen, |
uint32_t | column, | ||
uint32_t | row, | ||
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.
screen | The ID of the screen to draw to. Only the work buffer will be affected. |
column | The column, in characters, to place the text at. 0 corresponds to the left of the screen. |
row | The row, in characters, to place the text in. 0 corresponds to the top of the screen. |
buffer | Pointer to the string of text to draw. Null-terminated. |
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.
screen | The ID of the screen to place the pixel in. |
x | The x-coordinate, in pixels, to draw the pixel at. |
y | The y-coordinate, in pixels, to draw the pixel at. |
colour | The desired colour of the pixel to draw, in RGBX32 colour (0xRRGGBBXX, where the XX value is ignored). |
void OSScreenEnableEx | ( | OSScreenID | screen, |
BOOL | enable | ||
) |
Enables or disables a given screen.
If a screen is disabled, it shows black.
screen | The ID of the screen to enable or disable. |
enable | true if the screen should be enabled, otherwise false. |