Skip to main content
GameDev.net gamedev.net
🔒 Locked

Splash screen

Started by KalvinB Jul 21, 2002 at 11:31 PM 4 replies 300+ views
Original Post
KalvinB
KalvinB
Right after the CreateWindow call which places an empty 320x240 window in the center of the screen I''m attempting to load a bitmap on to that window with BeginPaint and the HDC to create a splash screen that displays while all the DirectX components load up. At hDC = BeginPaint(m_hWnd, &ps), a second area of 320x240 is created in the top left corner of the screen and the bitmap shows up both where it''s supposed to and in that top left corner.
  
//load bitmap to initial window

HBITMAP splash;
PAINTSTRUCT	ps;
HDC		hDC;

splash= (HBITMAP)LoadImage(NULL, "graphics/loadlogo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
hDC = BeginPaint(m_hWnd, &ps);
DrawState(hDC, NULL, NULL, (LPARAM)splash, 0, 0, 0, 320, 240, DST_BITMAP | DSS_NORMAL);
EndPaint(m_hWnd, &ps);
delete(splash);
  
Besides having two copies of the bitmap it''s working as it''s supposed to. I''d just like to know what''s causing the second window to show up. Ben IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Dot Com ]
remi
remi
What does DrawState() do?
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
rotos
rotos
Your code looks right to me, so I don''t know whats causing your problem.
But maybe you should try a different drawing method. GetWindowDC + BitBlt might work better.
KalvinB
KalvinB
DrawState actually puts the bitmap to the screen. Even if I take that out there are still two empty white windows on the screen.

I tried using TextOut as well and the text showed up in both windows also.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Dot Com ]
Greven
Greven
quote:
Original post by remi
What does DrawState() do?


Per MSDN:

DrawState
The DrawState function displays an image and applies a visual
effect to indicate a state, such as a disabled or default state.


BOOL DrawState(
HDC hdc, // handle to device context
HBRUSH hbr, // handle to brush
DRAWSTATEPROC lpOutputFunc, // callback function
LPARAM lData, // image information
WPARAM wData, // more image information
int x, // horizontal location
int y, // vertical location
int cx, // image width
int cy, // image height
UINT fuFlags // image type and state
);


I don't quite understand what you mean here...
quote:

At hDC = BeginPaint(m_hWnd, &ps), a second area of 320x240 is created in the top left corner of the screen...


how can you have a second area of 320x240 when the window is only 320x240? Is this going to end up being full screen? Or is a windowed app? Are you initializing DX while this is being displayed? Are you sure it is only drawing the the window created for a splash and not your DX window?

Always remember, you''re unique. Just like everyone else.

Edit: Minor visual edit...

[edited by - Greven on July 22, 2002 1:32:52 AM]
Always remember, you''re unique. Just like everyone else.Greven
KalvinB
KalvinB
Fixed it. The call to go to full screen was being made before it was really ready. I thought it was taking care of more than it was before that point.

Ben



IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Dot Com ]


[edited by - KalvinB on July 22, 2002 1:59:49 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.