Archived

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

JwayneT

DDraw Surface Member variable problem.

Recommended Posts

JwayneT    122
Hopefully I got the heading right,

Well, my problem is my program will quit out when I use the Lock method of my DDraw Surface variable in my entity class.
something like...
class entity{ protected: DIRECTDRAWSURFACE Image; DDRAWSURFACEDESC EntityDDSD; public: void fill(); //other variables and functions }; void entity::fill(){ //function variables for other things this function does Image->Lock(NULL,&EntityDDSD,0,NULL);//can''t remember exact //syntax, but you get the Idea //this part is where a data is read from the pointer to the //member surface Image->Unlock(NULL); }; When I run this code my program will quit out. I know it has to be the code I listed because everything worked untill then. Am I missing something real simple?

Snootchie Bootchies!

-=CF=-

Share this post


Link to post
Share on other sites
Sandman    2210
Actually the code you have posted shouldnt even compile. The surface is a COM object and so you should always access it through a pointer, but your Image member seems to be an actual instance of a directdraw object. Which is wrong.

Assuming it is a pointer and you just forgot the * when you posted it, my first guess is that you are trying to lock a surface that hasnt been created properly - are you checking all return values etc?

Share this post


Link to post
Share on other sites
Ridcully    122
of course i''ll try to help a fellow discworld inhabitant

assuming you just got the part with the declaration of your surface wrong when writing it on the board, i''d only have one idea: are you by any chance trying to debug the code withing the lock and unlock statement? anyways that is not possible with most GUI debuggers because lock holds some win32systemmutex thingy that causes the debugger to crash.
that at least drove me mad one time when i tried to figure out what was wrong with my lock code.

rid

Share this post


Link to post
Share on other sites
JwayneT    122
Yes,

I screwed up the post a bit, but when I tried to edit some things went wrong on my end. The code between the lock and unlock statements works fine. I forgot to add the DDRAWSUFACEDESD& argument to the fill method. The primary surface is created and initialized well before an instance of ''entity'' is even created. The DIRECTDRAWSURFACE variable is passed to the constructor. I tested all of this before I even added the lock and unlock methods to my fill method. Oh, Ridcully, be nice to the Librarian!

Snootchie Bootchies!

-=CF=-

Share this post


Link to post
Share on other sites