How to close the window? [SOLVED]

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
Lolocks
Prole
Posts: 12
Joined: Tue Jul 15, 2014 3:06 pm

How to close the window? [SOLVED]

Post by Lolocks »

From my previous help posts, I think most of you know that I'm relatively new to love2d.

Anyways, I'm trying to make it so when you hit the >esc< button on your keyboard, the game will close. I've looked around the wiki and didn't find anything (or maybe i'm bad at looking for things).

Here's the code I want it to work it:

Code: Select all

if love.keyboard.isDown("escape") then
	--exit the game
end
Last edited by Lolocks on Sun Jul 20, 2014 5:07 pm, edited 1 time in total.
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: How to close the window?

Post by undef »

The function you're looking for is called love.event.quit.
It's always ok to ask for help, but I really recommend browsing through the entire wiki, then you know best what the framework is capable of.
twitter | steam | indieDB

Check out quadrant on Steam!
Highjhacker
Prole
Posts: 6
Joined: Mon May 19, 2014 5:21 pm

Re: How to close the window?

Post by Highjhacker »

Hey, in the function love.keypressed :

Code: Select all

function love.keypressed(key, unicode)
	if key == "escape" then
		love.event.quit()
	end
end
http://love2d.org/wiki/love.event.quit
Lolocks
Prole
Posts: 12
Joined: Tue Jul 15, 2014 3:06 pm

Re: How to close the window? [SOLVED]

Post by Lolocks »

Thanks!

Man, I can't believe I forgot to check the events. Lol.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests