Hey, I managed to get DDraw to initialize in a window, but when I blit to it, the stuff appears at the top left corner of my screen instead that on the app''s window, what am I doing wrong? Also, do I need to modify something to tell it it needs to be 16bit or does it display it in whatever resolution Im using?
As you can tell, I havent done much work on windowed mode DX and Ive found very little info on it, so all help is appreciated.
Thanks!
Luis Sempe visual@guate.net http://www.geocities.com/SiliconValley/6276
The reason stuff appears at the top left corner of your screen is because the blit coordinates you give it are relative to the screen, not the window. And as to 16 bit, u can''t change the resolution in windowed mode, so it''s at whatever the user has it at.
You have to use DirectDraw Clipper when you create Window Mode DirectDraw Application... It can help you to draw or blit correctly to the area of your application window...
If you want to run your application in 16-bit mode, why don''t you use Fullscreen mode...? However, you can change the display mode by Win32 API too... I forget its name, maybe EnumDisplayMode() or something like that...
So what you need to do is to store the coordinates of the client area of the window (the part you draw to) in a RECT structure, then use that as your first argument to Blt.
HWND window_hwnd; RECT client_area; GetClientRect(window_hwnd,&client_area); surface->Blt(&client_area,src,src_rect,DDBLT_WAIT,NULL);
You should also have a DIRECTDRAWCLIPPER attached to the window. That will prevent you from drawing on the desktop.