58 lines
1.6 KiB
C
58 lines
1.6 KiB
C
/*===========================================
|
|
GRRLIB (GX Version)
|
|
- Template Code -
|
|
|
|
Minimum Code To Use GRRLIB
|
|
============================================*/
|
|
#include <grrlib.h>
|
|
|
|
#include <stdlib.h>
|
|
#include <wiiuse/wpad.h>
|
|
|
|
const int screen_width = 720;
|
|
const int screen_height = 480;
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
//Global variables
|
|
float playerPosY = 30;
|
|
float playerPosX = 10;
|
|
|
|
// 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;
|
|
|
|
// ---------------------------------------------------------------------
|
|
GRRLIB_FillScreen(0x00A0A0FF);
|
|
|
|
GRRLIB_Rectangle(playerPosX, playerPosY, 40, 40, 0xFFB890FF, true);
|
|
|
|
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP){
|
|
playerPosY -= 3;
|
|
}else if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN){
|
|
playerPosY += 3;
|
|
}else if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT){
|
|
playerPosX -= 3;
|
|
}else if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_RIGHT){
|
|
playerPosX += 3;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
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()
|
|
} |