mirror of
https://github.com/switchbrew/switch-examples.git
synced 2025-06-20 21:12:38 +02:00
templates/application: Update for hid-refactor API
This commit is contained in:
parent
f252e65ebd
commit
11fa984774
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user