Hi all,
I'm busy finishing up my latest iphone game. 8) The app loads some stuff into memory at startup, not much but enough to keep the user waiting shortly. I already added a "Default.png" image, the iOS shows this before loading the app, but while it is loading the screen is black. So when my app starts, the user sees this: the Default.png image (1 sec.), black screen (1 sec.), title screen (start of program).
I wanted to create a seamless transition between the app start and the title screen. So I thought I'd reuse the "Default.png" image and show a loading bar on it. However, when I do a LOADBMP "Default.png" the app just freezes (is there another way to use Default.png file or is it just off limits?). When I do a LOADBMP "Media/titlescreen.png" it does work, but there is still a short black screen in between.
Here's my code:
// initialise app
MyLoadingBar(0) // init progress bar
LoadSounds()
MyLoadingBar(25)
LoadGraphics()
MyLoadingBar(50)
LoadLevels()
MyLoadingBar(75)
//etc.
// -------------------------------------
// my progress bar at program startup
// iProgress = 0..100
// -------------------------------------
FUNCTION MyLoadingBar%: iProgress%
// initialise background
IF (iProgress = 0)
// LOADBMP "Default.png" // app crashes when using this file?
LOADBMP "Media//titlescreen.png"
//btw this also doesn't work, app freezes
//LOADSPRITE "Default.png", 0
//DRAWSPRITE 0, 0, 0
//USEASBMP
ENDIF
// draw progress bar background
DRAWRECT 60, 360, 200, 40, RGB(0, 192, 0)
// draw progress bar
DRAWRECT 60, 360, iProgress*2, 40, RGB(0, 255, 0)
// display progress bar
SHOWSCREEN
ENDFUNCTION
Is there a way to make this more seamless, so without the black screen showing shortly. I saw that iRace3D (also a glbasic app) had a pretty quick startup time, with a loading screen presumably written using glbasic.
Can you not load the loading screen as a sprite - LOADSPRITE immediately at the start of your code, use DRAWSPRITE then SHOWSCREEN, then load everything else as normal?
No LOADSPRITE/DRAWSPRITE with Default.png also doesn't work, I mentioned it in my example code.
btw I think I know how iRace3D did it. It doens't use a Default.png at all, and simply does LOADBMP as the very first thing and then load everything and draw a progress bar.
There still is a black screen shortly when you start the app, but without displaying the Default.png first you don't notice the black screen as much (as opposed to Default.png, black screen, in app load screen). I think I'll go with that method as well. :)
you can also add a Default.png and then start your program fading from back to the image. That way the black pause looks as if on purpose.
Bdr kittys idea would be nice. But if you don't want to do that avoid using Default.png. You will always get the black screen till your app loads. Just load any .png you want at program start, then load the rest, setup etc. You won't get a black screen this way.
I remember spending hours trying the Default.png way but you won't get what you really want.
Regards