Improve the touchscreen test screen with some numbers.

Getting closer to finding out what's wrong on the MOQI I7S when
using the system fullscreen button...
This commit is contained in:
Henrik Rydgård 2019-10-03 18:31:20 +02:00
parent b79f421b97
commit 349e64fe31
2 changed files with 33 additions and 5 deletions

View File

@ -21,6 +21,7 @@
#include "base/colorutil.h"
#include "base/logging.h"
#include "base/display.h"
#include "i18n/i18n.h"
#include "input/keycodes.h"
#include "input/input_state.h"
@ -637,13 +638,40 @@ void TouchTestScreen::CreateViews() {
void TouchTestScreen::render() {
UIDialogScreenWithBackground::render();
screenManager()->getUIContext()->BeginNoTex();
UIContext *ui_context = screenManager()->getUIContext();
ui_context->BeginNoTex();
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
if (touches_[i].id != -1) {
screenManager()->getUIContext()->Draw()->Circle(touches_[i].x, touches_[i].y, 100.0, 3.0, 80, 0.0f, 0xFFFFFFFF, 1.0);
ui_context->Draw()->Circle(touches_[i].x, touches_[i].y, 100.0, 3.0, 80, 0.0f, 0xFFFFFFFF, 1.0);
}
}
screenManager()->getUIContext()->Flush();
ui_context->Flush();
ui_context->Begin();
char buffer[1024];
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
if (touches_[i].id != -1) {
ui_context->Draw()->Circle(touches_[i].x, touches_[i].y, 100.0, 3.0, 80, 0.0f, 0xFFFFFFFF, 1.0);
snprintf(buffer, sizeof(buffer), "%0.1fx%0.1f", touches_[i].x, touches_[i].y);
ui_context->DrawText(buffer, touches_[i].x, touches_[i].y + (touches_[i].y > dp_yres - 100.0f ? -135.0f : 95.0f), 0xFFFFFFFF, ALIGN_HCENTER | FLAG_DYNAMIC_ASCII);
}
}
snprintf(buffer, sizeof(buffer),
"dp_res: %dx%d\n"
"pixel_res: %dx%d\n"
"g_dpi: %f\n"
"g_dpi_scale: %0.3fx%0.3f\n"
"g_dpi_scale_real: %0.3fx%0.3f\n",
dp_xres, dp_yres,
pixel_xres, pixel_yres,
g_dpi,
g_dpi_scale_x, g_dpi_scale_y,
g_dpi_scale_real_x, g_dpi_scale_real_y);
ui_context->DrawTextShadow(buffer, 20.0f, dp_yres / 2.0f, 0xFFFFFFFF, ALIGN_VCENTER | FLAG_DYNAMIC_ASCII);
ui_context->Flush();
}
void RecreateActivity();

View File

@ -123,8 +123,8 @@ public:
protected:
struct TrackedTouch {
int id;
int x;
int y;
float x;
float y;
};
enum {
MAX_TOUCH_POINTS = 10,