what does love.event.pump do?
what does love.event.pump do?
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.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: what does love.event.pump do?
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.
- slime
- Solid Snayke
- Posts: 3171
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: what does love.event.pump do?
Also note that the default [wiki]love.run[/wiki] calls it every frame for you.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: what does love.event.pump do?
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?
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.
@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.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: what does love.event.pump do?
Every frame love.run does that, but yes.
Re: what does love.event.pump do?
Got it! Thanks!
Re: what does love.event.pump do?
Is it possible to make a better love.run than the default one?
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: what does love.event.pump do?
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.jjmafiae wrote:Is it possible to make a better love.run than the default one?
Maybe other people can answer better.
- slime
- Solid Snayke
- Posts: 3171
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: what does love.event.pump do?
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.jjmafiae wrote:Is it possible to make a better love.run than the default one?
If you don't know if you should or not, then you probably don't need to.
Who is online
Users browsing this forum: No registered users and 16 guests