Reporter: time-killer-games | Status: open | Last Modified: March 30, 2021, 10:02:05 am
if you type in "poop" for example, just like any other given string, and draw that keyboard string with draw_text it will show the correct string, however try comparing that value with what it actually equals, and oddly enough, keyboard_string will always != "poop" or whatever string you typed, even though draw text shows the strings should be equal.
l tested this and cannot reproduce it. Can you upload an example?
Added to the ticket. The issue was reproduced on Windows (although I'm not sure if that makes a difference here).
If you move the if (keyboard_string == "poop") show_message("fuck joo bitch !!!"); to step it will work. The issue is with you pressing the "enter" key, Does this work as you expect in GM?
Look at #2062 I think I had started to discover why SDL's text input is done the way that it is. The enter key is probably part of the text related window messages, and Win32 should be changed to do it like SDL as part of the keyboard_string cleanup. Feel free to finish my pull request, I'm working on other stuff.
Created an alternative reproducer that you can just copy and paste to the draw event. Once it's equal, pressing enter does in fact make it not equal again, which is not the case in GM8.1 or GMSv1.4. However, pressing backspace will make it equal again and that is also the case with GM if you type space or something other than enter. You can't reproduce this on SDL which seems to be like GM.
So apparently the behavior of `keyboard_string` underwent some changes between GM7 and GM8.1 and probably because that's when YoYoGames came into the picture. In GM7, `keyboard_lastchar` will never recognize the tab key and it's never added to `keyboard_string` at all. In GM8.1, tab key is recognized by `keyboard_lastchar` but still not recognized by `keyboard_string`. What's interesting is that in GM7 and GM8.1, enter is always recognized as 13 by `keyboard_lastchar` but never added to the keyboard string. So it looks like YoYoGames made tab more consistent with how enter is handled.
Hi @RobertBColton, I would like to work on this issue. Can you guide me?
Hello Saran, I can give a brief explanation that should help. Hopefully you've already installed ENIGMA, if not, feel free to drop into our Discord server. Long story short, ENIGMA is divided into major systems (`ENIGMAsystem/SHELL/`), one of them being platforms. Platforms handle all the window management and input handling. Since each system actually implements the same functions, some of the code is generalized in a `General/` folder than you'll find in each of the major systems.
The `keyboard_string` global is a built-in string variable we provide for accessing the keyboard input. It is declared generically in `Platforms/General/PFmain.h`:
The actual platforms, like Windows (aka Win32), manipulate this variable by processing the Win32 input messages sent to the window.