Keyboard input in 0.8.0

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Periwasmarkedasspam
Prole
Posts: 9
Joined: Sun Feb 08, 2015 5:30 am

Keyboard input in 0.8.0

Post by Periwasmarkedasspam »

Im trying to get input from keyboard, but I need to do this in 0.8.0 (I have to do a game for my School and the Laptops are Debian which are stuck on the 0.8.0 version)

Im supossed to get to the "recordscore" and then, enable input for typing 3 chars (Like some old arcades), and what i have is this

Code: Select all

	function love.keypressed(key)
		...
		elseif state == "recordscore" then
			if key == "backspace" then
				recordName = ""
			else
				recordName = recordName .. key 
			end
		...
	end
if you need more bits of code / the file just ask... I need this Asap :D
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Keyboard input in 0.8.0

Post by Jeeper »

What do you mean "stuck on the 0.8"? I am not a Linux guy, but I am quite sure that 0.9.2 runs without issues on Linux.
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: Keyboard input in 0.8.0

Post by veethree »

I'm pretty sure your current code should kinda work. The proper way in 0.8.0 would be something like this:

Code: Select all

function love.keypressed(key, unicode)
	...
	elseif state == "recordscore" then
		if unicode > 31 and unicode < 127 then
			recordName = recordName..string.char(unicode)
		end
	end
	...
end
User avatar
arampl
Party member
Posts: 248
Joined: Mon Oct 20, 2014 3:26 pm

Re: Keyboard input in 0.8.0

Post by arampl »

Jeeper wrote:What do you mean "stuck on the 0.8"? I am not a Linux guy, but I am quite sure that 0.9.2 runs without issues on Linux.
Maybe he is allowed to use only installed packages or packages from "official" repositories which have only 0.8.0 version.
User avatar
Periwasmarkedasspam
Prole
Posts: 9
Joined: Sun Feb 08, 2015 5:30 am

Re: Keyboard input in 0.8.0

Post by Periwasmarkedasspam »

Thanks for the help! Now it works
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Cartread and 3 guests