mirror of
https://github.com/switchbrew/switch-examples.git
synced 2025-06-21 13:22:40 +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.
|
// take a look at the graphics/opengl set of examples, which uses EGL instead.
|
||||||
consoleInit(NULL);
|
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.
|
// Other initialization goes here. As a demonstration, we print hello world.
|
||||||
printf("Hello World!\n");
|
printf("Hello World!\n");
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
while (appletMainLoop())
|
while (appletMainLoop())
|
||||||
{
|
{
|
||||||
// Scan all the inputs. This should be done once for each frame
|
// Scan the gamepad. This should be done once for each frame
|
||||||
hidScanInput();
|
padUpdate(&pad);
|
||||||
|
|
||||||
// hidKeysDown returns information about which buttons have been
|
// padGetButtonsDown returns the set of buttons that have been
|
||||||
// just pressed in this frame compared to the previous one
|
// newly pressed in this frame compared to the previous one
|
||||||
u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);
|
u64 kDown = padGetButtonsDown(&pad);
|
||||||
|
|
||||||
if (kDown & KEY_PLUS)
|
if (kDown & HidNpadButton_Plus)
|
||||||
break; // break in order to return to hbmenu
|
break; // break in order to return to hbmenu
|
||||||
|
|
||||||
// Your code goes here
|
// Your code goes here
|
||||||
|
Loading…
Reference in New Issue
Block a user