Page 1 of 1

what does love.event.pump do?

Posted: Sat Aug 23, 2014 3:53 pm
by BozoDel
What does [wiki]love.event.pump[/wiki] do? My programming knowledge is rather thin, and I can't really grasp what it does. Can someone explain it to me "for dummies" style? It's for translating the wiki.

Re: what does love.event.pump do?

Posted: Sat Aug 23, 2014 4:38 pm
by bartbes
Basically, love has a queue for events, and so does your OS. When love.event.pump is called, love asks the OS for any events that have happened since last time, and moves them to its own queue, where it can be handled by love.run, or whatever wants to. As the wiki page also notes, some OSes (mostly windows, as far as I know) use this data to determine when an application is "not responding", which just means they haven't dealt with events in a while.

Re: what does love.event.pump do?

Posted: Sat Aug 23, 2014 4:50 pm
by slime
Also note that the default [wiki]love.run[/wiki] calls it every frame for you.

Re: what does love.event.pump do?

Posted: Sun Aug 24, 2014 4:31 pm
by Jasoco
It's one of those functions that the end user programmer doesn't really need to worry about because as was mentioned, it is already handled for you providing you use the built-in love.run() function. It's only accessible for people who decide to dirty their hands and code their own run() function instead. Most people won't need to know it exists or how it works.

Re: what does love.event.pump do?

Posted: Mon Aug 25, 2014 9:03 pm
by BozoDel
Ok, lemme see if I get this straight. The OS keeps track of events, for example, keypresses. Every frame, LÖVE checks with the OS to see if there are new events since the last frame. So love.event.pump pumps those events from the OS into the LÖVE event queue. Is that correct?

@Jasoco: I know, it's unlikely that anyone will read it, but it's still part of the main documentation body, it would be weird to ignore it.

Re: what does love.event.pump do?

Posted: Mon Aug 25, 2014 9:23 pm
by bartbes
Every frame love.run does that, but yes.

Re: what does love.event.pump do?

Posted: Tue Aug 26, 2014 3:16 pm
by BozoDel
Got it! Thanks!

Re: what does love.event.pump do?

Posted: Tue Aug 26, 2014 8:33 pm
by jjmafiae
Is it possible to make a better love.run than the default one?

Re: what does love.event.pump do?

Posted: Tue Aug 26, 2014 8:39 pm
by Jasoco
jjmafiae wrote:Is it possible to make a better love.run than the default one?
Really the most you can do is optimize it by removing some ifs and stuff you know you don't need. But not really worth it in most cases.

Maybe other people can answer better.

Re: what does love.event.pump do?

Posted: Tue Aug 26, 2014 9:18 pm
by slime
jjmafiae wrote:Is it possible to make a better love.run than the default one?
The default one is good for most situations, but if you have some specialized need for the game loop then you might want to customize it.

If you don't know if you should or not, then you probably don't need to.