diff --git a/examples/cmake/CMakeLists.txt b/examples/cmake/CMakeLists.txt index 4e6235f..2ee694b 100644 --- a/examples/cmake/CMakeLists.txt +++ b/examples/cmake/CMakeLists.txt @@ -29,7 +29,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE ) target_sources(${PROJECT_NAME} PRIVATE - "src/main.c" + "source/main.c" ) target_link_libraries(${PROJECT_NAME} PRIVATE diff --git a/examples/cmake/source/main.c b/examples/cmake/source/main.c new file mode 100644 index 0000000..1f5a87d --- /dev/null +++ b/examples/cmake/source/main.c @@ -0,0 +1,37 @@ +/*=========================================== + GRRLIB (GX Version) + - Template Code - + + Minimum Code To Use GRRLIB +============================================*/ +#include + +#include +#include + +int main(int argc, char **argv) { + // Initialise the Graphics & Video subsystem + GRRLIB_Init(); + + // 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() +} diff --git a/examples/cmake/src/main.c b/examples/cmake/src/main.c deleted file mode 100644 index 21b8352..0000000 --- a/examples/cmake/src/main.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include - -int main(void) -{ - // Initializes GRRLIB and WiiPad - GRRLIB_Init(); - WPAD_Init(); - - GRRLIB_SetBackgroundColour(255, 0, 0, 1); // Sets the background color to red - - // Main loop with the whole of content - while (1) { - GRRLIB_Render(); // Renders our content - } - - GRRLIB_Exit(); // Finish GRRLIB work - exit(0); // Exit from executable -}