Loading screens...
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Loading screens...
Since LUA runs in one "lane" I've been stumbling over some problems with drawing a loading screen at the same time that the game is loading new resources. Anyone have any ideas to get around this? Maybe threading?
Re: Loading screens...
How about putting something in the update callback like this:
And then in the draw callback have something like:
That way the game should get a chance to draw a loading message before it starts loading.
Code: Select all
if screen then
screen="load"
--load resources
else
screen="loading_screen"
end
Code: Select all
if screen="loading_screen" then
--draw loading message
end
Re: Loading screens...
Hmmyes, i catch your drift. Might just wanna stop the loading a little bit to make a breathing space for the draw function to run. Imma' try that!
Re: Loading screens...
Use coroutines, which are basically lightweight threads.
loader pseudocode:
love.update:
loader pseudocode:
Code: Select all
loader = coroutine.create(function()
for type, source in pairs(resources_to_load) do
load_resource(type, source)
coroutine.yield()
end
end)
Code: Select all
coroutine.resume(loader)
if coroutine.status(loader) == "dead" then
-- loading finished
end
Re: Loading screens...
I went for the coroutines, and it worked perfectly!
Until i noticed something strange! The bodies and shapes (physics) doesn't seem to be working properly (gives error) when colliding with props made outside of the coroutine.
The error is basically that it returns "attempt to call a number value" in the physics world update...
Gotta look into this more, if no one else got a theory on how to fix this of course
Until i noticed something strange! The bodies and shapes (physics) doesn't seem to be working properly (gives error) when colliding with props made outside of the coroutine.
The error is basically that it returns "attempt to call a number value" in the physics world update...
Gotta look into this more, if no one else got a theory on how to fix this of course
Re: Loading screens...
Full-fledged love.thread is coming in 0.7.0.
Re: Loading screens...
Funnu thing, I was just going to ask about this.
I can't wait!anjo wrote:Full-fledged love.thread is coming in 0.7.0.
Good bye.
Re: Loading screens...
And when is that if I may ask?anjo wrote:Full-fledged love.thread is coming in 0.7.0.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Loading screens...
Around the same time as the audio issues are solved.Chief wrote:And when is that if I may ask?anjo wrote:Full-fledged love.thread is coming in 0.7.0.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Loading screens...
With the difference that love.thread already exists.
Who is online
Users browsing this forum: No registered users and 4 guests