diff --git a/templates/application/source/main.c b/templates/application/source/main.c index 5009532..bbf4035 100644 --- a/templates/application/source/main.c +++ b/templates/application/source/main.c @@ -16,20 +16,27 @@ int main(int argc, char* argv[]) // take a look at the graphics/opengl set of examples, which uses EGL instead. consoleInit(NULL); + // Configure our supported input layout: a single player with standard controller styles + padConfigureInput(1, HidNpadStyleSet_NpadStandard); + + // Initialize the default gamepad (which reads handheld mode inputs as well as the first connected controller) + PadState pad; + padInitializeDefault(&pad); + // Other initialization goes here. As a demonstration, we print hello world. printf("Hello World!\n"); // Main loop while (appletMainLoop()) { - // Scan all the inputs. This should be done once for each frame - hidScanInput(); + // Scan the gamepad. This should be done once for each frame + padUpdate(&pad); - // hidKeysDown returns information about which buttons have been - // just pressed in this frame compared to the previous one - u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO); + // padGetButtonsDown returns the set of buttons that have been + // newly pressed in this frame compared to the previous one + u64 kDown = padGetButtonsDown(&pad); - if (kDown & KEY_PLUS) + if (kDown & HidNpadButton_Plus) break; // break in order to return to hbmenu // Your code goes here