mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 20:06:41 +00:00
[Server] Handle backspace in the server window
This commit is contained in:
parent
4e6bcf02d2
commit
59693abc74
1 changed files with 5 additions and 2 deletions
|
@ -5,10 +5,10 @@ namespace mwmp_input {
|
||||||
string windowInputBuffer;
|
string windowInputBuffer;
|
||||||
void handler() {
|
void handler() {
|
||||||
char c;
|
char c;
|
||||||
#ifndef WIN32 // on WIndows conio.h getch() and kbhit() are deprecated, use _getch() and _kbhit() instead
|
#ifndef WIN32
|
||||||
while (kbhit()) {
|
while (kbhit()) {
|
||||||
c = getch();
|
c = getch();
|
||||||
#else
|
#else // on Windows conio.h getch() and kbhit() are deprecated, use _getch() and _kbhit() instead
|
||||||
while (_kbhit()) {
|
while (_kbhit()) {
|
||||||
c = _getch();
|
c = _getch();
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,6 +18,9 @@ namespace mwmp_input {
|
||||||
Script::Call<Script::CallbackIdentity("OnServerWindowInput")>(windowInputBuffer.c_str());
|
Script::Call<Script::CallbackIdentity("OnServerWindowInput")>(windowInputBuffer.c_str());
|
||||||
windowInputBuffer.assign("");
|
windowInputBuffer.assign("");
|
||||||
}
|
}
|
||||||
|
else if (c == '\b') {
|
||||||
|
windowInputBuffer.erase(windowInputBuffer.size() - 1);
|
||||||
|
}
|
||||||
else windowInputBuffer += c;
|
else windowInputBuffer += c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue