feat(nds): handle swipes

This commit is contained in:
2026-02-12 00:57:46 +01:00
parent 76473ec0ea
commit 88c1f183c9
5 changed files with 76 additions and 5 deletions

View File

@@ -252,7 +252,7 @@ onRender((ctx) => {
10,
2,
118,
false,
true,
);
drawButton(
ctx,
@@ -260,7 +260,7 @@ onRender((ctx) => {
138,
2,
108,
false,
true,
);
}, 110);
@@ -559,15 +559,19 @@ useKeyDown(({ key }) => {
];
break;
case "NDS_UP":
case "NDS_SWIPE_UP":
slide(-1, 0);
break;
case "NDS_DOWN":
case "NDS_SWIPE_DOWN":
slide(1, 0);
break;
case "NDS_LEFT":
case "NDS_SWIPE_LEFT":
slide(0, -1);
break;
case "NDS_RIGHT":
case "NDS_SWIPE_RIGHT":
slide(0, 1);
break;
}

View File

@@ -393,7 +393,7 @@ onRender((ctx) => {
10,
2,
88,
false,
true,
);
drawButton(
ctx,
@@ -401,7 +401,7 @@ onRender((ctx) => {
108,
2,
88,
false,
true,
);
drawButton(
ctx,
@@ -409,7 +409,7 @@ onRender((ctx) => {
206,
2,
40,
false,
true,
);
}, 110);

View File

@@ -309,15 +309,19 @@ useKeyDown(({ key }) => {
const newDirection = direction.clone();
switch (key) {
case "NDS_UP":
case "NDS_SWIPE_UP":
newDirection.set(0, -1);
break;
case "NDS_RIGHT":
case "NDS_SWIPE_RIGHT":
newDirection.set(1, 0);
break;
case "NDS_DOWN":
case "NDS_SWIPE_DOWN":
newDirection.set(0, 1);
break;
case "NDS_LEFT":
case "NDS_SWIPE_LEFT":
newDirection.set(-1, 0);
break;
}