3ds_tests/source/main.cpp
2024-09-25 01:06:17 +02:00

41 lines
972 B
C++

#include <3ds.h>
#include <iostream>
using namespace std;
static void locateBits(u32 bits) {
bool first = true;
for (int i = 0; i < 32; i++) {
if ((bits >> i) & 1) {
if (!first)
cout << ",";
first = false;
cout << i;
}
}
cout << endl;
}
static void showAll(void) {
consoleClear();
touchPosition touch;
circlePosition circle;
hidScanInput();
hidTouchRead(&touch);
hidCircleRead(&circle);
cout << "=========================" << endl;
cout << "KEYS: "; locateBits(hidKeysHeld()); cout << endl;
cout << "TOUCH SCREEN: " << touch.px << "," << touch.py << endl;
cout << "CIRCLE PAD: " << circle.dx << "," << circle.dy << endl;
}
int main(void) {
gfxInitDefault();
consoleInit(GFX_TOP, NULL);
while (aptMainLoop()) {
gspWaitForVBlank();
showAll();
}
gfxExit();
}