Textbox in game
Moderator: Moderators
Textbox in game
Hey!
Does anyone know if it is possible to create a textbox function in the game?
Thanks!
Does anyone know if it is possible to create a textbox function in the game?
Thanks!
Re: Textbox in game
I believe he is referring to his own game.
Short answer "Probably, Lua can do pretty much anything."
Short answer "Probably, Lua can do pretty much anything."
Re: Textbox in game
Ah well 4 choices, in order of my belief best to worst.
Chili, redui, iceui, raw lua. The ones prior to raw lua are ui frameworks designed to make such elements easier.
Chili, redui, iceui, raw lua. The ones prior to raw lua are ui frameworks designed to make such elements easier.
Re: Textbox in game
easiest is to use the chat, see Argh's post in that thread: http://springrts.com/phpbb/viewtopic.php?f=23&t=24431
there are numerous threads on "Custom GUI?" where you can read up on which framework is best and find some help to set them up* It is a tradition that at least one superlong post of infolog errors must be posted.
*haha you did not really believe that did you?
http://answers.springlobby.info/questio ... -developed
there are numerous threads on "Custom GUI?" where you can read up on which framework is best and find some help to set them up* It is a tradition that at least one superlong post of infolog errors must be posted.
*haha you did not really believe that did you?
http://answers.springlobby.info/questio ... -developed
Re: Textbox in game
Doing experimentation in my own game.
I tried the chat method.
I manage to shift the infromation in the chat console to a new moveable menu.
Does anyone know how I could shift the line: '' Say: .." as well?
Thanks.
I tried the chat method.
I manage to shift the infromation in the chat console to a new moveable menu.
Does anyone know how I could shift the line: '' Say: .." as well?
Thanks.
Re: Textbox in game
dont think it is possible.Does anyone know how I could shift the line: '' Say: .." as well?
if your plan is to move the say: line over some textfield graphic then thats a bad idea imo.
Not checking for text length for one thing.
Here is some thread about making your own text inputbox from another game:
http://love2d.org/forums/viewtopic.php?f=5&t=1820
Something similiar would work in spring too.
Basically
Code: Select all
widget:KeyPressed(key)
input = input .. key
end
Re: Textbox in game
I did a small testing on this.
Basically if I key cltr the spring.echo will be display.
I should draw the box and use glText to write the message?
I would need an array to story the specific alphabelt as well?
What about things like backspace and enter?
Am using a game to study on decision making and learning.
Majority parts to game are from Spring 1944 and it also includes other free licence scripts and stuff from other games.
Basically if I key cltr the spring.echo will be display.
Hence if am thinking of display in a specific box?include("keysym.h.lua")
function widget:KeyPress(key,mods,isRepeat,label,unicode)
if key == KEYSYMS.LCTRL then
Spring.Echo(" Left Clrt")
end
end
I should draw the box and use glText to write the message?
I would need an array to story the specific alphabelt as well?
What about things like backspace and enter?
Am using a game to study on decision making and learning.
Majority parts to game are from Spring 1944 and it also includes other free licence scripts and stuff from other games.
Re: Textbox in game
thats what i would do. chili probally has something more "finished"I should draw the box and use glText to write the message?
you need some way to convert the keycode numbers to letters. Array would work.I would need an array to story the specific alphabelt as well?
Not sure what spring/lua has to offer for that, might be an easier way.
see the l├Âve thread, it has some stuff on how to delete last letter on backspace etc.What about things like backspace and enter?
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Textbox in game
I am sure this can be done, Zero-K does it.Von66341 wrote:Does anyone know how I could shift the line: '' Say: .." as well?
Re: Textbox in game
I just played zero k.
The line 'Say: ..' is not shifted.
The line 'Say: ..' is not shifted.
Re: Textbox in game
I manage to get a testing text box to work.
Code as following:
Is there a way to clear the screen?
For e.g. i got a gl.Rect(x1,y1,x2,y2)
then if the timer reaches a certain timing, I want to replace the previous drawn rectangle to gl.Rect(a1,b1,a2,b2). Will this be possible?
Code as following:
But when key keys like H, I and Enter the default shortcut key will run, is there a way to disable this shortcut key when the player is keying inside the textbox?function widget:KeyPress(key,mods,isRepeat,label,unicode)
if key == KEYSYMS.BACKSPACE then
input = string.sub(input,1,-2)
else if key == KEYSYMS.SPACE then
input = input .. " "
else if key then
input = input = input .. label
end
Is there a way to clear the screen?
For e.g. i got a gl.Rect(x1,y1,x2,y2)
then if the timer reaches a certain timing, I want to replace the previous drawn rectangle to gl.Rect(a1,b1,a2,b2). Will this be possible?
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Textbox in game
I would just move the existing text input, see chilichat.