From 6120bbd7c3f2cfc5ddf9d070296174a173abbcbd Mon Sep 17 00:00:00 2001 From: csBlueChip Date: Sun, 23 Aug 2009 14:59:48 +0000 Subject: [PATCH] Added extra documentation to template code --- examples/template/source/main.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) 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() }