test_console_dimensions
This commit is contained in:
parent
3112db466d
commit
38b8fa6c79
1 changed files with 24 additions and 29 deletions
|
@ -1,42 +1,37 @@
|
||||||
#include <3ds.h>
|
#include <3ds.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#define ENDL "\e[0K"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static void locateBits(u32 bits) {
|
// RESULTS
|
||||||
bool first = true;
|
// Top screen has 50 cols
|
||||||
for (int i = 0; i < 32; i++) {
|
// Bottom screen has 40 cols
|
||||||
if ((bits >> i) & 1) {
|
// Bith screens have 29 lines
|
||||||
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) {
|
int main(void) {
|
||||||
|
// gfxInitDefault();
|
||||||
|
// consoleInit(GFX_TOP, NULL);
|
||||||
|
// cout << "012345678901234567890123456789012345678901234567890123456789" << endl;
|
||||||
|
// consoleInit(GFX_BOTTOM, NULL);
|
||||||
|
// cout << "012345678901234567890123456789012345678901234567890123456789" << endl;
|
||||||
|
// while (aptMainLoop()) {
|
||||||
|
// gfxFlushBuffers();
|
||||||
|
// }
|
||||||
|
// gfxExit();
|
||||||
gfxInitDefault();
|
gfxInitDefault();
|
||||||
consoleInit(GFX_TOP, NULL);
|
consoleInit(GFX_TOP, NULL);
|
||||||
|
for (int i = 50; aptMainLoop(); i--) {
|
||||||
|
cout << i << endl;
|
||||||
while (aptMainLoop()) {
|
while (aptMainLoop()) {
|
||||||
showAll();
|
hidScanInput();
|
||||||
|
if (hidKeysDownRepeat() & KEY_A)
|
||||||
|
break;
|
||||||
|
gfxFlushBuffers();
|
||||||
|
}
|
||||||
|
gfxFlushBuffers();
|
||||||
|
}
|
||||||
|
while (aptMainLoop()) {
|
||||||
|
gfxFlushBuffers();
|
||||||
}
|
}
|
||||||
gfxExit();
|
gfxExit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue