Advertisement

Splash Screens

Started by July 16, 2001 10:52 AM
3 comments, last by BLZBub 23 years, 7 months ago
Hi there! How do I make a splash screen to display before I switch to fullscreen OpenGL mode? I''ve found that creating a window and rc takes long enough to warrant a splash screen on my computer. Thanks in advance!
Basically you''ll want to create a window that displays a single bitmap as soon as the program loads, then do all your application-specific initialization (loading models/textures and what have you), and when that is done destroy the splashscreen-window.
A short while ago I made a simple splashscreen for windows, which I just put on my former company''s server, and can be found at http://gothix.trans4media.com/docs/splashscreen.zip

It''s pretty simple to use. Simply call
bool CreateSplashScreen (HINSTANCE hInstance, const char* bitmap)
at the start of WinMain, and then DestroySplashScreen() when you are done with initialization of your own app. (You should make sure that your own WindowClass is created without the WS_VISIBLE flag to get the best result).

Feel free to do just about whatever you want with the source-code, although if you release anything based on it I would appreciate a mention somewhere (not necessary though)).

-Neophyte

- Death awaits you all with nasty, big, pointy teeth. -
Advertisement
Thanks Neophyte! Your code is excellent!

Where exactly do you recommend I call DestroySplashScreen()?

At the moment I''m doing this:


RegisterClass(...);
CreateWindow(...);
GetDC(...);
ChoosePixelFormat(...);
SetPixelFormat(...);
wglCreateContext(...);
DestroySplashScreen();
ChangeScreenResolution(...);
ShowWindow(...);
UpdateWindow(...);
SetFocus(...);
wglMakeCurrent(...);


But the transition between windows and fullscreen isn''t particularly smooth. Can you recomend anything?

Thanks again for the spashscreen code - everyone should have that code!!!
Glad to hear it was helpful.
Actually, one of the reasons that the transition is particularily smooth is that the Splashscreen is single-threaded. I played around with a multi-threaded version (the splashscreen in its own thread), which worked fine, but when I formatted my harddisk a while back I forgot to back that part up, and I haven''t been bothered to do it again.

Anyway, destroying the splashscreen just before changing the screen-resolution is probably the best idea. At least it should be called before you change the resolution, as the position of the splashscreen doesn''t change with the resolution (it is set once when the splashscreen is created).
I haven''t used it much with fullscreen apps myself, but I''ll experiment a little with it and send you a mail if I find something useful.

-Neophyte


- Death awaits you all with nasty, big, pointy teeth. -
Great! thanks. I''ll have another play around with it myself....

This topic is closed to new replies.

Advertisement