Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Help with implementing a loading screen  (Read 6690 times)

0 Members and 3 Guests are viewing this topic.

rojan_neo

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • http://makeagame.tumblr.com
Help with implementing a loading screen
« on: August 16, 2011, 01:36:05 pm »
I noticed that when I run my game ( if can call it one right now) there is a delay of 4-5 seconds where only blank white screen is displayed.. I figured that my resources are being loaded (my level is quite large)... I would like to show a loading screen during this time (or show anything on screen except the blank screen) but I have no idea how I would implement one....

Can any one can help me get an idea how a loading screen is implemented??

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Help with implementing a loading screen
« Reply #1 on: August 16, 2011, 01:48:51 pm »
A loading screen must be continuously updated with the loading progress. Everytime a resource is loaded, your resource loader calls a function with the new progress as argument, this function draws the updated screen.

An alternative would be multithreading, but I think here it brings more complexity without real advantages. You cannot update the loading progress while a SFML resource loading function is being executed anyway (except if you estimate the progress).
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

rojan_neo

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • http://makeagame.tumblr.com
Help with implementing a loading screen
« Reply #2 on: August 16, 2011, 02:48:16 pm »
ok... then how can i draw a static image ( no loading bar) saying that the game is loading.. instead of the white screen that is shown

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Help with implementing a loading screen
« Reply #3 on: August 16, 2011, 03:03:50 pm »
Create a window, draw the image, and begin to load your other resources afterwards.

Your window does not respond during the loading, but you could update it by calling Display() from the resource-loading routine, or even use a separate thread, if user interaction is important.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

rojan_neo

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • http://makeagame.tumblr.com
Help with implementing a loading screen
« Reply #4 on: August 16, 2011, 03:06:47 pm »
Thank you, that will do for now