From 3112db466d4a20c07f545946e9e9f74d372ca497 Mon Sep 17 00:00:00 2001 From: Zy Date: Wed, 25 Sep 2024 22:39:07 +0200 Subject: [PATCH] fix display --- source/main.cpp | 83 +++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/source/main.cpp b/source/main.cpp index 67a53c3..9d7f99a 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,41 +1,42 @@ -#include <3ds.h> -#include - -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(); -} +#include <3ds.h> +#include + +#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(); +}