I'm thinking about "preloader screen" in projects.
So what i'm need for that?
- I need to draw something BEFORE loading everything else (especially "high weight"), like "Loading...";
- Will be nice to get some value of progress, like 3/5Kb loaded, or 0.1 complete (as 10%) etc.
Search for forum & examples - not found a thing pointing me to find solution...
Maybe someone do such a thing?
About (1) part: currently i'm try 2 ways:
- Drawtext on init before everything else
- same thing, but in ondraw
But putting "big" sprites (much of them, specially to check this moment) getting black screen currently for a few sec and only then text...
To point 1:
One can reassign the draw and update loops.
That allows to create multiple screens where each has its own 'main' loop.
Keeps everything nicely structured and they don't interfere with each other. Many ways to do that, here one example:
To point 2:
By what I am aware off the loading info is not available, maybe worth a feature request?
When I had a lot to load I took a 'guess' and delayed accordingly.
Will be experimenting with this.
Looks promising :)
@TinkerSmith, maybee i misunderstand something, but can't make it works in this way...
A simple preloader project:
The main goal is:
- at least draw/print something on-screen before loading pictures/sounds/music
- if possible draw some progress bar (searching for such suggestion, if there are not - write one)
On the phone atm, so can't do much.
But if you'd like to show the text for some time before that game starts you could get away by adding a sleep command between it and the game init.
In that case you wouldn't even need the extra _update and _draw redirect and could put it all in the main.
The way I split it was because I wanted some animation on my title screen. What in your case could be the loading screen with some homemade loading animation instead.
Hope it makes sense :)
Put this into your 'init' loop, is this what you imagine?
init = function()
// fake loading screen
for count=0 to 100 by 1
sleep 50 milliseconds // delay
Live Long and Tinker
TinkerSmith, not really...
Fake loading not interested, because some users can have "slow" internet and this should be too long or work incorrectly...
Maybe there will be such value in future updates, will be wait.
And all content (pictures, sounds etc) loaded first as i can see, so i see "loading" only after blacksreen (in which loading resources processing)
Already older thread, but...
Not sure if this is what you are looking for, but sprites and maps have a "ready" state.
init = function()
/// VERY simplified for demonstration purposes - probably want to loop through all your sprites and maps.
while not mysprite.ready // ready == 1 when the sprite is fully loaded, 0 otherwise.
Can't seem to find the equivalent for SOUND and MUSIC, tho...