* Allow handling of WM_CHAR in the case of Windows.

This commit is contained in:
iProgramInCpp
2023-08-05 16:13:11 +03:00
parent 386fac3ff6
commit 0ceef907c0
7 changed files with 47 additions and 13 deletions

View File

@@ -98,12 +98,16 @@ void Screen::keyPressed(int key)
#endif
}
#ifndef ORIGINAL_CODE
for (auto textInput : m_textInputs)
{
textInput->keyPressed(m_pMinecraft, key);
}
#endif
}
void Screen::charInput(char chr)
{
for (auto textInput : m_textInputs)
textInput->charPressed(chr);
}
void Screen::mouseClicked(int xPos, int yPos, int d) // d = clicked?

View File

@@ -44,6 +44,7 @@ public:
virtual void mouseClicked(int, int, int);
virtual void mouseReleased(int, int, int);
virtual void keyPressed(int);
virtual void charInput(char);
public:
int m_width = 1;

View File

@@ -53,6 +53,7 @@ void TextInputBox::keyPressed(Minecraft* minecraft, int key)
bool bShiftPressed = minecraft->platform()->shiftPressed();
#ifndef HANDLE_CHARS_SEPARATELY
char chr = '\0';
if (key >= AKEYCODE_A && key <= AKEYCODE_Z)
{
@@ -114,6 +115,21 @@ void TextInputBox::keyPressed(Minecraft* minecraft, int key)
chr = bShiftPressed ? '}' : ']';
break;
}
#else
char chr = '\0';
switch (key)
{
case AKEYCODE_FORWARD_DEL:
chr = '\001';
break;
case AKEYCODE_ARROW_LEFT:
chr = '\002';
break;
case AKEYCODE_ARROW_RIGHT:
chr = '\003';
break;
}
#endif
if (chr)
charPressed(chr);