Archived

This topic is now archived and is closed to further replies.

Zackie62

Direct Draw Windowed

Recommended Posts

Hello everybody, I am currently working on a small level-editor. So I want to use direct draw to draw my map. The level-editor should be in a 640x480 window. I use the winapi to create the window(WS_OVERLAPPED). Now I initialized ddraw correctly, but when I want to blit the surface with my bitmap on it to an offscreen surface my app crashes. The debugger says that something is wrong with this line: //////////////////// lpddsbackbuffer->Blt(&rcBitmap,lpddsbitmap,NULL,DDBLT_WAIT,NULL ); //////////////////// lpddsbackbuffer is my "backbuffer" and rcBitmap the destination rect(0,0,200,50). After this line I write the following line: /////////////////// lpddsprimary->Blt(&rcScreen,lpddsbackbuffer,NULL, DDBLT_WAIT, NULL ); ////////////////// Perhaps someone now how to solve my problem! :-) Thanks in advance! Bye, Zackie62

Share this post


Link to post
Share on other sites
Could you post some of the rest of your code involving the surface creation? That would probably help.

------------------------------
Omnipotent_Q
"Natural Gas! It gives you... ideas!"

Share this post


Link to post
Share on other sites

Here is the complete sourcecode
including the executable,the bitmap and the workspace.
You have to rename the file in mapededitor-source.rar.

Here is the link:

http://home.t-online.de/home/Udo_Bartsch/mapeditor-source.rar.jpg

Thanks in advance!

Bye,
Maxim

Share this post


Link to post
Share on other sites
Your problem may be that since you have a back buffer, you''re trying to flip() the surface to the front. You can''t do this when you use windowed mode. My screen name on Instant Messenger (or AOL) is ImmigrantMarbles. EMail is VChelaru@hotmail.com. I just wrote a similar program and may be able to help.

--Vic--

Share this post


Link to post
Share on other sites
The link isn''t working right... the page loads but there is no picture. I saved the file to my hard drive, but still no luck loading it. Could you please post the source as a text file or something?

Anyway, if you are using flip(), Pee Wee is right, that does cause problems in windowed mode. But I thought you were just doing a massive blt() from the backbuffer, in which case there should be no problem.

------------------------------
Omnipotent_Q
"Natural Gas! It gives you... ideas!"

Share this post


Link to post
Share on other sites
I just quickly glanced at your source code but i believe u did not initialize your rcScreen in your init function. nor did you return the values. try making the program in one file before u try to separate it out. Again i could be wrong.
And why different window sizes?
Create_Window(main_hwnd,hInstance,640,480);
ddraw_init(main_hwnd,1024,740);
the program seems to be over simplifed right now... make it work then make it simple. Bad coding practice in general but in this case i think it is essential.

Share this post


Link to post
Share on other sites