fixed finicky clear button combo
This commit is contained in:
parent
ad058fbe93
commit
52ea93de45
48
main.c
48
main.c
|
@ -48,6 +48,15 @@ int main(int argc, char **argv)
|
||||||
OSScreenPutFontEx(SCREEN_TV, 0, 0, "SimpleDrawU (TV).");
|
OSScreenPutFontEx(SCREEN_TV, 0, 0, "SimpleDrawU (TV).");
|
||||||
OSScreenPutFontEx(SCREEN_DRC, 0, 0, "SimpleDrawU (Gamepad).");
|
OSScreenPutFontEx(SCREEN_DRC, 0, 0, "SimpleDrawU (Gamepad).");
|
||||||
|
|
||||||
|
enum penColor {
|
||||||
|
white = 0xFFFFFF00,
|
||||||
|
black = 0x00000000,
|
||||||
|
red = 0xBF5B5B00,
|
||||||
|
yellow = 0xC6B95500,
|
||||||
|
blue = 0x3C8D8800,
|
||||||
|
green = 0x86B46000,
|
||||||
|
};
|
||||||
|
|
||||||
while (WHBProcIsRunning())
|
while (WHBProcIsRunning())
|
||||||
{
|
{
|
||||||
VPADRead(VPAD_CHAN_0, &status, 1, &error);
|
VPADRead(VPAD_CHAN_0, &status, 1, &error);
|
||||||
|
@ -77,37 +86,37 @@ int main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// clear screen
|
// clear screen
|
||||||
if ((status.trigger & VPAD_BUTTON_PLUS) && (status.trigger & VPAD_BUTTON_MINUS))
|
if ((status.hold & VPAD_BUTTON_PLUS) && (status.hold & VPAD_BUTTON_MINUS))
|
||||||
{
|
{
|
||||||
OSScreenClearBufferEx(SCREEN_TV, 0x00000000);
|
OSScreenClearBufferEx(SCREEN_TV, 0x00000000);
|
||||||
OSScreenClearBufferEx(SCREEN_DRC, 0x00000000);
|
OSScreenClearBufferEx(SCREEN_DRC, 0x00000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// select color
|
// select color
|
||||||
if (status.trigger & VPAD_BUTTON_PLUS)
|
if (status.hold & VPAD_BUTTON_PLUS)
|
||||||
{
|
{
|
||||||
penColor = 0xFFFFFF00;
|
penColor = white;
|
||||||
} // white
|
}
|
||||||
if (status.trigger & VPAD_BUTTON_MINUS)
|
if (status.hold & VPAD_BUTTON_MINUS)
|
||||||
{
|
{
|
||||||
penColor = 0x00000000;
|
penColor = black;
|
||||||
} // black
|
}
|
||||||
if (status.trigger & VPAD_BUTTON_A)
|
if (status.hold & VPAD_BUTTON_A)
|
||||||
{
|
{
|
||||||
penColor = 0xBF5B5B00;
|
penColor = red;
|
||||||
} // red
|
}
|
||||||
if (status.trigger & VPAD_BUTTON_B)
|
if (status.hold & VPAD_BUTTON_B)
|
||||||
{
|
{
|
||||||
penColor = 0xC6B95500;
|
penColor = yellow;
|
||||||
} // yellow
|
}
|
||||||
if (status.trigger & VPAD_BUTTON_X)
|
if (status.hold & VPAD_BUTTON_X)
|
||||||
{
|
{
|
||||||
penColor = 0x3C8D8800;
|
penColor = blue;
|
||||||
} // blue
|
}
|
||||||
if (status.trigger & VPAD_BUTTON_Y)
|
if (status.hold & VPAD_BUTTON_Y)
|
||||||
{
|
{
|
||||||
penColor = 0x86B46000;
|
penColor = green;
|
||||||
} // green
|
}
|
||||||
|
|
||||||
// draw on screen
|
// draw on screen
|
||||||
if (gamepadTouchScreen.touched)
|
if (gamepadTouchScreen.touched)
|
||||||
|
@ -128,7 +137,6 @@ int main(int argc, char **argv)
|
||||||
DCFlushRange(tvBuffer, tvBufferSize);
|
DCFlushRange(tvBuffer, tvBufferSize);
|
||||||
DCFlushRange(drcBuffer, drcBufferSize);
|
DCFlushRange(drcBuffer, drcBufferSize);
|
||||||
|
|
||||||
committing your graphics changes. */
|
|
||||||
OSScreenFlipBuffersEx(SCREEN_TV);
|
OSScreenFlipBuffersEx(SCREEN_TV);
|
||||||
OSScreenFlipBuffersEx(SCREEN_DRC);
|
OSScreenFlipBuffersEx(SCREEN_DRC);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue