templates/application: Update for hid-refactor API

This commit is contained in:
fincs 2020-12-01 21:36:02 +01:00
parent f252e65ebd
commit 11fa984774
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60

View File

@ -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