diff --git a/examples/template/source/main.c b/examples/template/source/main.c index 9f85e9e..a12bdbd 100644 --- a/examples/template/source/main.c +++ b/examples/template/source/main.c @@ -10,20 +10,28 @@ #include int main() { - u32 WPADDown; - + // Initialise the Graphics & Video subsystem GRRLIB_Init(); + + // Initialise the Wiimotes WPAD_Init(); + // Loop forever while(1) { - WPAD_ScanPads(); - WPADDown = WPAD_ButtonsDown(0); - GRRLIB_Render(); - if(WPADDown & WPAD_BUTTON_HOME) { - break; - } + 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 - return 0; + + exit(0); // Use exit() to exit a program, do not use 'return' from main() }