Advertisement

DDraw Surface Member variable problem.

Started by October 04, 2000 01:34 PM
2 comments, last by JwayneT 24 years, 3 months ago
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? a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Snootchie Bootchies!

-=CF=-
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Why is it called a hot water heater? Isn't it cold when it goes in the tank?

[email=jtaylor@gtemail.net" class="h]-=CF=-[/email]
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?
Advertisement
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
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!

a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Snootchie Bootchies!

-=CF=-
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};

Why is it called a hot water heater? Isn't it cold when it goes in the tank?

[email=jtaylor@gtemail.net" class="h]-=CF=-[/email]

This topic is closed to new replies.

Advertisement