GRRLIB 4.5.0
Loading...
Searching...
No Matches
template/source/main.c

This example shows the minimum code required to use GRRLIB.

This example shows the minimum code required to use GRRLIB.It could be used as a template to start a new project. More elaborate examples can be found inside the examples folder.

/*===========================================
GRRLIB (GX Version)
- Template Code -
Minimum Code To Use GRRLIB
============================================*/
#include <grrlib.h>
#include <stdlib.h>
#include <wiiuse/wpad.h>
int main(int argc, char **argv) {
// Initialise the Graphics & Video subsystem
// Initialise the Wiimotes
WPAD_Init();
// Loop forever
while(1) {
WPAD_ScanPads(); // Scan the Wiimotes
// If [HOME] was pressed on the first Wiimote, break out of the loop
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break;
// ---------------------------------------------------------------------
// Place your drawing code here
// ---------------------------------------------------------------------
GRRLIB_Render(); // Render the frame buffer to the TV
}
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
exit(0); // Use exit() to exit a program, do not use 'return' from main()
}
void GRRLIB_Exit(void)
Call this before exiting your application.
Definition GRRLIB_core.c:221
void GRRLIB_Render(void)
Call this function after drawing.
Definition GRRLIB_render.c:407
int GRRLIB_Init(void)
Initialize GRRLIB.
Definition GRRLIB_core.c:53
GRRLIB user include file.