I'm trying to create a textbox. Try using some guides from previous forums but I think they are too old and outdated, download the SUIT .zip file from this place "https://suit.readthedocs.io/en/latest/index. html # suit-up "
since I saw that I had several additional tools in addition to the textbox but I have not been able to use or implement it, could you help me and learn how it works? or if there is simply a better way to create a textbox, thank you very much for your attention: 3
I can't create a text box
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: I can't create a text box
When you say textbox, do you mean the text you print onscreen for the player? Or are you talking about collecting text from the player?
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Re: I can't create a text box
I guess it's better to implement your own text box, because this library kinda bad
Here, simple example of how you can make your own textbox:
Here, simple example of how you can make your own textbox:
Code: Select all
local string = "Hello, World!"
local font = love.graphics.getFont()
local strw = font:getWidth(string)
local strh = font:getHeight(string)
function love.draw()
local mx, my = love.mouse.getPosition()
love.graphics.setColor(1, 1, 1, 0.2)
love.graphics.rectangle("fill", mx, my, strw * 2, strh * 2)
love.graphics.setColor(1, 1, 1, 1)
love.graphics.print(string, mx + strw / 2, my + strh / 2)
end
Re: I can't create a text box
This has me thinking now - I've no idea how to collect a string of text via keyboard.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
pen and paper gridiron. Build a team then watch simulated matches: https://togfox.itch.io/pad-and-pencil-gridiron
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
pen and paper gridiron. Build a team then watch simulated matches: https://togfox.itch.io/pad-and-pencil-gridiron
- Gunroar:Cannon()
- Party member
- Posts: 1150
- Joined: Thu Dec 10, 2020 1:57 am
Re: I can't create a text box
You could use love.keypressed(key,scancode,isrepeat) then collect the key which is the string character the user typed, or you could use love.textinput https://love2d.org/wiki/love.textinput
Re: I can't create a text box
Oh - I see some examples in that link. So many lines of code to emulate a text box.
Some days I really love love 2d and then some days ... Blah.
It's not enough to stop me though!
Some days I really love love 2d and then some days ... Blah.
It's not enough to stop me though!
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
pen and paper gridiron. Build a team then watch simulated matches: https://togfox.itch.io/pad-and-pencil-gridiron
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
pen and paper gridiron. Build a team then watch simulated matches: https://togfox.itch.io/pad-and-pencil-gridiron
Re: I can't create a text box
There's always love.window.showMessageBox though it's not suited for all uses.
Re: I can't create a text box
GVovkiv wrote: ↑Mon Mar 08, 2021 7:16 pm I guess it's better to implement your own text box, because this library kinda bad
Here, simple example of how you can make your own textbox:Code: Select all
local string = "Hello, World!" local font = love.graphics.getFont() local strw = font:getWidth(string) local strh = font:getHeight(string) function love.draw() local mx, my = love.mouse.getPosition() love.graphics.setColor(1, 1, 1, 0.2) love.graphics.rectangle("fill", mx, my, strw * 2, strh * 2) love.graphics.setColor(1, 1, 1, 1) love.graphics.print(string, mx + strw / 2, my + strh / 2) end
Thank you very much, what I was trying was with an empty text box, capture the player's text and then show it in the same ucadro or in another thanks to a button and I think that with the example you showed me and with the text, imput that I let myself down "Gunroar: Cannon ()" I think I am dead to achieve it: 3, on the other hand I ask if love has ways to achieve the other functions that that suit library had such as putting a large text only in a certain box and putting a bar displacement
Re: I can't create a text box
Gunroar:Cannon() wrote: ↑Tue Mar 09, 2021 12:59 pmYou could use love.keypressed(key,scancode,isrepeat) then collect the key which is the string character the user typed, or you could use love.textinput https://love2d.org/wiki/love.textinput
Thank you very much, I was able to combine the "love.textinput" that you told me with the code fragment that "GVovkiv" had given me above but I have a problem with the "love.text input" I capture and print very well but in the case of That the player makes a mistake when putting a "letter" key cannot erase or correct it, how can I correct this? or how do I correct an already written string
Re: I can't create a text box
How about this one?
viewtopic.php?t=3056
viewtopic.php?t=3056
Who is online
Users browsing this forum: Amazon [Bot], Google [Bot] and 6 guests