loading screens?

Started by
5 comments, last by chillypacman 16 years, 1 month ago
What would be a good way to do loading screens in directx? I think it should be fairly simple, just calling a specific function which renders the loading screen from the function that does the loading itself but that feels a bit tacky. Is there another way or is my idea acceptable?
Advertisement
It depends on how fancy you want the screen. It's not DirectX, but I've used a modeless dialog and update a progress bar or just display percents.

If you want it to be DX, you can also setup a 2D scene with a full-view textured quad and draw over that with textured quads or a nice font.

Set up a Render() function for the loading screen separate from your app's normal render routine. Let it display loading parameters (percents, etc.) and put it on a timer.

I'm not sure if Sleep() is the right way to do it, but you might try adding a few Sleep() calls to your loading function to allow the screen to render. Or call the loading function from the load screen routine itself and load portions at a time.

When the loading's done, set a flag to start calling the normal render routine rather than the startup screen each frame or just go into another (normal) rendering loop.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

One good way to tackle this is to think of your startup / boot routines as being divided into 2 or more stages, then just divide them up in a logical order like stage 1 could be loading engine critical stuff like initialising the graphics api and creating the system font, stage 2 could be loading the splash data files for display, stage 3 could loading everything else.

If you want animation then you need to put your splash into a separate thread with its own render loop. Be prepared for the fact that you will only have access to stage 1 & 2 data, and also not to let it overlap with your rendering loop which will run on your main thread once booting is finished.

Hope that helps, and good luck!
I like to use a separate thread to handle the loading screen. It's definitely the most work out of all the methods proposed (since you have to get into Win32 thread functions, and you have to use synchronization methods to ensure both your threads aren't messing with the device a the same time), but is also the most robust. Personally I'm of the opinion that an app should never stop pumping messages and processing user input, and I apply this to games as well.
i agree with the seperate thread, you could have the loading thread periodicly change a variable to let the loading image know how much has been loaded, allowing you to accuratly display the amount
--------------------------------------Not All Martyrs See Divinity, But At Least You Tried
It depends on how complicated you want to get. Threads are the best solution, but they are a pain to use. I would actually recommend against using threads unless you really know what you're doing.
NextWar: The Quest for Earth available now for Windows Phone 7.
Well I don't really want to over complicate the matter, especially with threads since I don't have much experience using threads (actually I have none).

I've decided I'm just going to create a simple function that takes a string and then displays it with a menu background. Since I only have five functionw which load things I can simply call it from there (for instance loadingScreen.display("Loading: " + object.name)). Since the directx device is already initialized immediate and doesn't atke long to do so I can use it. The loading screen actually uses sprites rather than tex quads so hopefully it won't effect the performance too much.

Like I said, I don't want to make it too complex for my own good, I'm not that good a programmer to begin with.

This topic is closed to new replies.

Advertisement