Push input rejette touches non valides.

This commit is contained in:
mduval76 2023-12-08 22:34:17 -05:00
parent 850f5a59d8
commit 06cd890506
2 changed files with 9 additions and 6 deletions

View File

@ -1877,9 +1877,6 @@ char Engine::SimulateKeyboard(unsigned char key) {
if (!m_keyShift) { m_inputChar = '9'; }
else { m_inputChar = ')'; }
break;
case 36: // SPACE
m_inputChar = ' ';
break;
case 38: // SHIFT
m_keyShift = true;
break;
@ -1890,15 +1887,20 @@ char Engine::SimulateKeyboard(unsigned char key) {
if (!m_keyShift) { m_inputChar = '-'; }
else { m_inputChar = '_'; }
break;
case 57: // SPACE
m_inputChar = ' ';
break;
default:
m_invalidChar = true;
break;
}
if ((int)key != 38) {
if ((int)key != 38 && !m_invalidChar) {
m_charChanged = true;
std::cout << "Key pressed: " << (int)key << " (" << m_inputChar << ")" << std::endl;
}
m_charChanged = true;
m_invalidChar = false;
return m_inputChar;
}

View File

@ -203,8 +203,9 @@ private:
bool m_selectedOptions = false;
bool m_selectedQuit = false;
char m_inputChar = 0;
std::string m_currentInputString;
char m_inputChar = 0;
bool m_invalidChar = false;
bool m_charChanged = false;
bool m_key1 = false;