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 <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;
|
||||
}
|
||||
// RESULTS
|
||||
// Top screen has 50 cols
|
||||
// Bottom screen has 40 cols
|
||||
// Bith screens have 29 lines
|
||||
|
||||
int main(void) {
|
||||
// gfxInitDefault();
|
||||
// consoleInit(GFX_TOP, NULL);
|
||||
// cout << "012345678901234567890123456789012345678901234567890123456789" << endl;
|
||||
// consoleInit(GFX_BOTTOM, NULL);
|
||||
// cout << "012345678901234567890123456789012345678901234567890123456789" << endl;
|
||||
// while (aptMainLoop()) {
|
||||
// gfxFlushBuffers();
|
||||
// }
|
||||
// gfxExit();
|
||||
gfxInitDefault();
|
||||
consoleInit(GFX_TOP, NULL);
|
||||
for (int i = 50; aptMainLoop(); i--) {
|
||||
cout << i << endl;
|
||||
while (aptMainLoop()) {
|
||||
showAll();
|
||||
hidScanInput();
|
||||
if (hidKeysDownRepeat() & KEY_A)
|
||||
break;
|
||||
gfxFlushBuffers();
|
||||
}
|
||||
gfxFlushBuffers();
|
||||
}
|
||||
while (aptMainLoop()) {
|
||||
gfxFlushBuffers();
|
||||
}
|
||||
gfxExit();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue