mirror of
https://github.com/celisej567/mcpe.git
synced 2025-12-31 17:49:17 +03:00
* Allow handling of WM_CHAR in the case of Windows.
This commit is contained in:
@@ -178,6 +178,17 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
break;
|
||||
}
|
||||
case WM_CHAR:
|
||||
{
|
||||
if (lParam & (1 << 31))
|
||||
break;
|
||||
|
||||
if (wParam >= '~' && wParam < ' ')
|
||||
break;
|
||||
|
||||
g_pApp->handleCharInput(char(wParam));
|
||||
break;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
|
||||
@@ -478,7 +478,6 @@ void Minecraft::tickInput()
|
||||
Mouse::_index = -1;
|
||||
}
|
||||
|
||||
#ifndef ORIGINAL_CODE
|
||||
void Minecraft::tickMouse()
|
||||
{
|
||||
if (!m_bGrabbedMouse)
|
||||
@@ -486,7 +485,12 @@ void Minecraft::tickMouse()
|
||||
|
||||
platform()->recenterMouse();
|
||||
}
|
||||
#endif
|
||||
|
||||
void Minecraft::handleCharInput(char chr)
|
||||
{
|
||||
if (field_D14)
|
||||
field_D14->charInput(chr);
|
||||
}
|
||||
|
||||
void Minecraft::_levelGenerated()
|
||||
{
|
||||
|
||||
@@ -52,10 +52,8 @@ public:
|
||||
void joinMultiplayer(const PingedCompatibleServer& serverInfo);
|
||||
void cancelLocateMultiplayer();
|
||||
void locateMultiplayer();
|
||||
|
||||
#ifndef ORIGINAL_CODE
|
||||
void tickMouse();
|
||||
#endif
|
||||
void handleCharInput(char chr);
|
||||
|
||||
virtual void onGraphicsReset();
|
||||
virtual void update() override;
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -761,7 +761,7 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>HANDLE_CHARS_SEPARATELY;_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
@@ -777,7 +777,7 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>HANDLE_CHARS_SEPARATELY;_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
@@ -795,7 +795,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>HANDLE_CHARS_SEPARATELY;_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
@@ -813,7 +813,7 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>HANDLE_CHARS_SEPARATELY;_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
@@ -829,7 +829,7 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>HANDLE_CHARS_SEPARATELY;_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
@@ -847,7 +847,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>HANDLE_CHARS_SEPARATELY;_USE_MATH_DEFINES;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FloatingPointModel>Precise</FloatingPointModel>
|
||||
|
||||
Reference in New Issue
Block a user