Skip to content

Instantly share code, notes, and snippets.

@vgmoose
Last active September 24, 2016 03:47
Show Gist options
  • Save vgmoose/d68e30e32c781f0920c632444dd24aa4 to your computer and use it in GitHub Desktop.
Save vgmoose/d68e30e32c781f0920c632444dd24aa4 to your computer and use it in GitHub Desktop.
Sample Wii U application that demonstrates drawing to the screen and may also be satire
/** MIT License **/
// drawPixel, flipBuffers, and mySpaceGlobals.button are defined in Space Game: https://github.com/vgmoose/space
// see draw.c, program.h, and space.h in the src folder
// video: https://twitter.com/VGMoose/status/761912934251503616
// elf: https://gofile.io/?id=ONAOmK
int x, y;
int count = -1;
int leave = 0;
while (!leave)
{
int top = 0;
int bot = 239;
int left = 0;
int right = 426;
count = (count + 1) % 3;
int r = (count == 0)? 255 : 0;
int g = (count == 1)? 255 : 0;
int b = (count == 2)? 255 : 0;
while (bot >= 120)
{
for (int z=0; z<2; z++)
{
VPADRead(0, &vpad_data, 1, &error);
//Get the status of the gamepad
mySpaceGlobals.button = vpad_data.btns_h;
for (x=left; x<right; x++)
{
drawPixel(x, top, r, g, b);
}
for (y=top; y<bot; y++)
{
drawPixel(right, y, r, g, b);
}
for (x=right; x>=left; x--)
{
drawPixel(x, bot, r, g, b);
}
for (y=bot; y>=top; y--)
{
drawPixel(left, y, r, g, b);
}
flipBuffers();
}
// make everything smaller
bot --;
top ++;
left ++;
right --;
//To exit the game
if (mySpaceGlobals.button&VPAD_BUTTON_HOME)
{
leave = 1;
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment