Jump to content


File Information

  • Submitted: Feb 14 2012 12:30 PM
  • Last Updated: Feb 17 2012 06:40 PM
  • File Size: 100.19K
  • Views: 998
  • Downloads: 44

Download Splash Screen

* * * * * 2 Votes

I saw few people looking for such feature, so I just decided to put together small library what does exactly that, fading in/out corresponding splash screen. So how it works? Library require to be used with only 1 command and one state flag check:


set_splash_screen_state has three states. These states are :


Out of this three states, user should use SPLASH_STATE_FADE_IN and SPLASH_STATE_FADE_OUT, while SPLASH_STATE_IDLE should be left to system. Lets see how to go from initialization, up to use in main loop.

Create splash screen handler (if can store many splash screens as you want, if you need it for various levels)
SPLASH_SCREEN=TSplashScreen.Create(numberOfSplashScreens) 'default is 100

Now we need to add actual splash screen(s)
SPLASH_SCREEN.add(splashScreen:Int = -1, image_:String = Null, posX:Int = 0, posY:Int = 0, imageSizeX:Int = 1680, imageSizeY:Int = 1050,....)

Parameters are:
splashScreen - array index of specific splash screen of interest, in range between 0 - numberOfSplashScreens
image_ - DDS file, representing splash screen
posX , posY - position of given image used for splash screen
imageSizeX , ImageSizeY - dimensions of image used for splash screen

Other parameters leave as it is in provided example, if you need full screen splash screen.

Now, In main loop, just before Flip(), you always have to have:


Thats where all transition happening automatically. In order to see transitions, you need to trigger certain action you want. So if you want SPLASH_SCREEN to cover screen, you will do this once (no need to be called all time)

SPLASH_SCREEN.set_splash_screen_state(MY_FIRST_SPLASH_SCREEN, SPLASH_SCREEN.SPLASH_STATE_FADE_OUT)'Triggering Splash Screen to Appear

When you want your splash screen to fade away, you will do this:

SPLASH_SCREEN.set_splash_screen_state(MY_FIRST_SPLASH_SCREEN, SPLASH_SCREEN.SPLASH_STATE_FADE_IN)'Triggering Splash Screen to Disappear

In order to perform certain actions, such as freeing old level and loading new one, while splash screen is drawn, you need to be sure that splash screen library is finished switching in to corresponding state (SPLASH_STATE_FADE_OUT orSPLASH_STATE_FADE_IN), you will check in your code, by looking after boolean .completed:

If SPLASH_SCREEN.completed
   'SPLASH_SCREEN is finished transition to choosen state
   'SPLASH_SCREEN is not finished transition to choosen state
End if

Speed of splash screen fading in/out is done by:


Default value is 0.05, but i have changed it in to 0.01 in sample file because flushing out old level and loading new is rather fast (just cubes), so splash screen quickly goes on off..however in real game scenario you will have few seconds for same things to do, so default speed is fine. I slowed it down just to show that it works.

In order to free splash screen from memory, once created, do this:

I hope you found this useful and helpful..cheers guys and happy coding. Posted Image

Good work, NA, thanks for sharing :)
..you welcome ;) .. i hope people will find this lil thing useful..Im about to release Animation library, too, as im slowly departing from LE so i wanna share some lil things for people who may find it useful..

6 user(s) are online (in the past 60 minutes)

0 members, 6 guests, 0 anonymous users