#include <stdio.h>
int main(int argc, char **argv)
{
char keysNames[32][32] = {
"KEY_A", "KEY_B", "KEY_SELECT", "KEY_START",
"KEY_DRIGHT", "KEY_DLEFT", "KEY_DUP", "KEY_DDOWN",
"KEY_R", "KEY_L", "KEY_X", "KEY_Y",
"", "", "KEY_ZL", "KEY_ZR",
"", "", "", "",
"KEY_TOUCH", "", "", "",
"KEY_CSTICK_RIGHT", "KEY_CSTICK_LEFT", "KEY_CSTICK_UP", "KEY_CSTICK_DOWN",
"KEY_CPAD_RIGHT", "KEY_CPAD_LEFT", "KEY_CPAD_UP", "KEY_CPAD_DOWN"
};
u32 kDownOld = 0, kHeldOld = 0, kUpOld = 0;
printf("\x1b[1;1HPress Start to exit.");
printf("\x1b[2;1HCirclePad position:");
{
if (kDown != kDownOld || kHeld != kHeldOld || kUp != kUpOld)
{
printf("\x1b[1;1HPress Start to exit.");
printf("\x1b[2;1HCirclePad position:");
printf("\x1b[4;1H");
int i;
for (i = 0; i < 32; i++)
{
if (kDown &
BIT(i)) printf(
"%s down\n", keysNames[i]);
if (kHeld &
BIT(i)) printf(
"%s held\n", keysNames[i]);
if (kUp &
BIT(i)) printf(
"%s up\n", keysNames[i]);
}
}
kDownOld = kDown;
kHeldOld = kHeld;
kUpOld = kUp;
printf(
"\x1b[3;1H%04d; %04d", pos.
dx, pos.
dy);
}
return 0;
}
bool aptMainLoop(void)
Main function which handles sleep mode and HOME/power buttons - call this at the beginning of every f...
PrintConsole * consoleInit(gfxScreen_t screen, PrintConsole *console)
Initialise the console.
void consoleClear(void)
Clears the screen by using iprintf("\x1b[2J");.
void gfxSwapBuffers(void)
Updates the configuration of both screens.
void gfxInitDefault(void)
Initializes the LCD framebuffers with default parameters This is equivalent to calling:
@ GFX_TOP
Top screen.
Definition: gfx.h:26
void gfxExit(void)
Deinitializes and frees the LCD framebuffers.
void gfxFlushBuffers(void)
Flushes the data cache for the current framebuffers.
#define gspWaitForVBlank()
Waits for VBlank.
Definition: gspgpu.h:151
@ KEY_START
Start.
Definition: hid.h:15
void hidCircleRead(circlePosition *pos)
Reads the current circle pad position.
u32 hidKeysHeld(void)
Returns a bitmask of held buttons.
u32 hidKeysDown(void)
Returns a bitmask of newly pressed buttons, this frame.
void hidScanInput(void)
Scans HID for input data.
u32 hidKeysUp(void)
Returns a bitmask of newly released buttons, this frame.
Circle Pad position.
Definition: hid.h:52
s16 dx
Pad X.
Definition: hid.h:53
s16 dy
Pad Y.
Definition: hid.h:54
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:47
uint32_t u32
32-bit unsigned integer
Definition: types.h:23