mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2025-01-15 10:09:17 +00:00
Use template code for cmake example
This commit is contained in:
parent
78258b52c5
commit
bad483cc57
3 changed files with 38 additions and 21 deletions
|
@ -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
|
||||
|
|
37
examples/cmake/source/main.c
Normal file
37
examples/cmake/source/main.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*===========================================
|
||||
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
|
||||
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()
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
#include <grrlib.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
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
|
||||
}
|
Loading…
Reference in a new issue