Darkstar2
|
|
Posted on: February 10, 2014, 12:45:49 am |
|
|
Joined: Jan 2014
Posts: 1238
|
I am looking to add interaction in my game, where the user inputs data, however I do not want the pop-up dialog box to appear but only the flashing cursor would appear at an x,y position and allow a user to input text. In short, it is the get_string without the dialog box.
Something like
get_string(x,y,len,def)
(x,y position to set input cursor, maximum length of str, default value)
Please advise.
Thanks.
|
|
|
Logged
|
|
|
|
|
Goombert
|
|
Reply #2 Posted on: February 10, 2014, 09:19:10 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
get_string is implemented, along with get_color and all that Jazz. Darkstar2 if you have the latest version there is the Asynch extension you can enable and use get_string_async which is from Studio and allows the game to continue updating while the user inputs the string, then the Asynchronous Dialog event is triggered when they've entered their response. I can also make you an example that just uses script_thread. However, I think you may be looking to custom render the input, if that is the case, use keyboard_string, I have written you an example for this. Hit tab to open the input box, enter a string and then hit enter. This is a simple way of accepting input from a user for a while in GM. https://www.dropbox.com/s/c0mnfzw10dsffvg/keyboardstring.gm81There is currently a bug with keyboard_string though where backspace does not clear your last character but adds a new capital 'H' this little piece of code will resolve that until it is fixed, just add it at the very top of the step event. if (keyboard_check_pressed(vk_backspace)) { keyboard_string = string_copy(keyboard_string, 0, string_length(keyboard_string) - 2); }
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
TheExDeus
|
|
Reply #3 Posted on: February 10, 2014, 09:24:50 am |
|
|
Joined: Apr 2008
Posts: 1860
|
I also made textbox for GM a while ago and did a conversion to ENIGMA, but there was still some bugs I didn't fix so it's not entirely functional and pretty looking. Maybe you guys can check the code and fix that. https://www.dropbox.com/s/2jv1k4emsh2zxaq/textbox_v5.gmkIt also has things like selecting parts of the text with mouse, inserting, deleting, copy/paste and so on. I would want to fix it, but I don't have the time right now. Another example I made just for ENIGMA is here: https://www.dropbox.com/s/njetsb4ocl54k27/cool_effect.gmkIt's a lot prettier, but a lot simpler (you can only type, nothing more, not even deletion works there, but it's not hard to make). http://i.imgur.com/4zUYNXG.pngHow can you resize images on this board? Classic BBCode ain't working.
|
|
« Last Edit: February 10, 2014, 09:46:22 am by TheExDeus »
|
Logged
|
|
|
|
Darkstar2
|
|
Reply #4 Posted on: February 10, 2014, 03:47:15 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
Thanks, but what I actually need is a direct text entry with cursor, no boxes whatsoever and no dialog boxes. I would like to handle my own text input area and just have the text input start at whatever area of the room that I point it to. EXAMPLE, I have a sprite shape on my screen and want the text entry to be done on top of that (superposed), so it's simple, no dialog boxes, no boxes, just the getting keyboard entries input directly from a coordinate, with the flashing cursor. get_string is implemented, along with get_color and all that Jazz. Darkstar2 if you have the latest version there is the Asynch extension you can enable and use get_string_async which is from Studio and allows the game to continue updating while the user inputs the string, then the Asynchronous Dialog event is triggered when they've entered their response. I can also make you an example that just uses script_thread.
However, I think you may be looking to custom render the input, if that is the case, use keyboard_string, I have written you an example for this.
Hit tab to open the input box, enter a string and then hit enter. This is a simple way of accepting input from a user for a while in GM. https://www.dropbox.com/s/c0mnfzw10dsffvg/keyboardstring.gm81
There is currently a bug with keyboard_string though where backspace does not clear your last character but adds a new capital 'H' this little piece of code will resolve that until it is fixed, just add it at the very top of the step event.
if (keyboard_check_pressed(vk_backspace)) { keyboard_string = string_copy(keyboard_string, 0, string_length(keyboard_string) - 2); }
|
|
|
Logged
|
|
|
|
|
|
Goombert
|
|
Reply #7 Posted on: February 10, 2014, 04:00:24 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Not strange at all the letter 'H' maps to the backspace key. http://www.physics.udel.edu/~watson/scen103/ascii.htmlIt's a bug in ENIGMA, ENIGMA is supposed to interpret it ofc as backspace and remove it from keyboard_string global variable like the code I gave you, I'm just extremely busy with LGM development to do it atm.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|
|
|
Josh @ Dreamland
|
|
Reply #11 Posted on: February 15, 2014, 08:24:37 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
There are some hundred good reasons to implement a custom-rendered widgets library. Ideally, one that uses ENIGMA's own functions, so it's portable. It'd have a lot of strange dependencies, but as long as it listed them in the ey file, it'd be okay. It'd solve your problem, as well as the same problem on consoles and embedded systems.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
Goombert
|
|
Reply #12 Posted on: February 17, 2014, 10:52:31 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Back on topic, the backspace issue has been fixed with keyboard_string now. It performs almost exactly the same as GameMaker. https://github.com/enigma-dev/enigma-dev/pull/644These are the remaining anomalies. https://github.com/enigma-dev/enigma-dev/issues/647Also Josh, not every GUI is a widget library, widgets sounds way too software, there is only an interest in textureable GUI controls like Unity3D, OGRE, or Irrlicht have built in. http://docs.unity3d.com/Documentation/Components/gui-Basics.htmlhttp://www.ogre3d.org/tikiwiki/tiki-index.php?page=Comparison+of+GUIs
|
|
« Last Edit: February 17, 2014, 11:07:23 am by Robert B Colton »
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|
Goombert
|
|
Reply #14 Posted on: February 22, 2014, 02:22:43 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
I meant in comparison to GameMaker, anything is better than draw_button()
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|