Enable screenshots in touch test functions

This commit is contained in:
d0k3 2019-04-26 00:54:07 +02:00
parent 500333b011
commit 36c03e578c

View File

@ -36,12 +36,9 @@ bool ShowCalibrationDialog(void)
} }
} }
// wait until touchscreen released
while (HID_ReadState() & (BUTTON_B | BUTTON_TOUCH));
// wait for input, store calibration data // wait for input, store calibration data
while (1) { while (1) {
u32 pressed = HID_ReadState(); u32 pressed = InputWait(0);
if (pressed & BUTTON_B) { if (pressed & BUTTON_B) {
return false; return false;
} else if (pressed & BUTTON_TOUCH) { } else if (pressed & BUTTON_TOUCH) {
@ -58,21 +55,22 @@ void ShowTouchPlayground(void)
{ {
ClearScreen(BOT_SCREEN, COLOR_STD_BG); ClearScreen(BOT_SCREEN, COLOR_STD_BG);
while(1) { while (1) {
u16 tx, ty; DrawStringF(BOT_SCREEN, 16, 16, COLOR_STD_FONT, COLOR_STD_BG,
u32 pressed = HID_ReadState(); "Current touchscreen coordinates: 000, 000");
u32 pressed = InputWait(0);
if (pressed & BUTTON_B) return;
if (pressed & BUTTON_TOUCH) { while (pressed & BUTTON_TOUCH) {
u16 tx, ty;
HID_ReadTouchState(&tx, &ty); HID_ReadTouchState(&tx, &ty);
if (tx < 320 && ty < 240) if (tx < 320 && ty < 240)
DrawPixel(BOT_SCREEN, tx, ty, COLOR_BRIGHTYELLOW); DrawPixel(BOT_SCREEN, tx, ty, COLOR_BRIGHTYELLOW);
} else { DrawStringF(BOT_SCREEN, 16, 16, COLOR_STD_FONT, COLOR_STD_BG,
tx = ty = 0; "Current touchscreen coordinates: %3.3d, %3.3d", tx, ty);
pressed = HID_ReadState();
} }
DrawStringF(BOT_SCREEN, 16, 16, COLOR_STD_FONT, COLOR_STD_BG, "Current touchscreen coordinates: %3.3d, %3.3d", tx, ty);
if (pressed & BUTTON_B)
return;
} }
} }