42 lines
931 B
C++
42 lines
931 B
C++
#include <3ds.h>
|
|
#include <iostream>
|
|
|
|
#define ENDL "\e[0K"
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void showAll(void) {
|
|
|
|
touchPosition touch;
|
|
circlePosition circle;
|
|
hidScanInput();
|
|
hidTouchRead(&touch);
|
|
hidCircleRead(&circle);
|
|
cout
|
|
<< "\e[H"
|
|
<< "=========================" << endl
|
|
<< "KEYS: "; locateBits(hidKeysHeld()); cout << ENDL << endl
|
|
<< "TOUCH SCREEN: " << touch.px << "," << touch.py << ENDL << endl
|
|
<< "CIRCLE PAD: " << circle.dx << "," << circle.dy << ENDL << endl;
|
|
}
|
|
|
|
int main(void) {
|
|
gfxInitDefault();
|
|
consoleInit(GFX_TOP, NULL);
|
|
while (aptMainLoop()) {
|
|
showAll();
|
|
}
|
|
gfxExit();
|
|
}
|