aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Windows64/KeyboardMouseInput.cpp
diff options
context:
space:
mode:
authorqwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com>2026-03-05 17:17:45 -0600
committerGitHub <noreply@github.com>2026-03-05 17:17:45 -0600
commit0666959d312dc74903f55d1071488a90239330f1 (patch)
tree5c6886f7ec65a7828bc6e34a469514e418bcf78b /Minecraft.Client/Windows64/KeyboardMouseInput.cpp
parent9370cbc7d878df1615d8ce76bc459e8b414d0f19 (diff)
parenteed770b121aa4ce38f002db042d0137c24c6d344 (diff)
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.Client/Windows64/KeyboardMouseInput.cpp')
-rw-r--r--Minecraft.Client/Windows64/KeyboardMouseInput.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp
index 6206db87..fe3c3919 100644
--- a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp
+++ b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp
@@ -55,6 +55,8 @@ void KeyboardMouseInput::Init()
m_hasInput = false;
m_kbmActive = true;
m_screenWantsCursorHidden = false;
+ m_charBufferHead = 0;
+ m_charBufferTail = 0;
RAWINPUTDEVICE rid;
rid.usUsagePage = 0x01; // HID_USAGE_PAGE_GENERIC
@@ -381,4 +383,29 @@ float KeyboardMouseInput::GetLookY(float sensitivity) const
return (float)(-m_mouseDeltaY) * sensitivity;
}
+void KeyboardMouseInput::OnChar(wchar_t c)
+{
+ int next = (m_charBufferHead + 1) % CHAR_BUFFER_SIZE;
+ if (next != m_charBufferTail)
+ {
+ m_charBuffer[m_charBufferHead] = c;
+ m_charBufferHead = next;
+ }
+}
+
+bool KeyboardMouseInput::ConsumeChar(wchar_t &outChar)
+{
+ if (m_charBufferTail == m_charBufferHead)
+ return false;
+ outChar = m_charBuffer[m_charBufferTail];
+ m_charBufferTail = (m_charBufferTail + 1) % CHAR_BUFFER_SIZE;
+ return true;
+}
+
+void KeyboardMouseInput::ClearCharBuffer()
+{
+ m_charBufferHead = 0;
+ m_charBufferTail = 0;
+}
+
#endif // _WINDOWS64