J
JoeC
I have been trying to get this copy constructor to work. I don't know
why it crashes.
graphic::graphic(const graphic& gr){
ud = lr = 16;
gdata = gr.gdata; <-- This line crashes
BITMAP bitmap = {0,ud,lr,2,1,1};
bitmap.bmBits = &gdata[0];
hbitmap = CreateBitmapIndirect(&bitmap);
}
I am using the function like this:
if(play){
cgr = new graphic(play->gOut());
return *cgr;
}
class player{
string name;
graphic gr;
void create();
public:
player();
graphic gOut(){return gr;}
void dummy(){MessageBox(NULL, "Dummy" , "Notice", MB_OK); }
};
why it crashes.
graphic::graphic(const graphic& gr){
ud = lr = 16;
gdata = gr.gdata; <-- This line crashes
BITMAP bitmap = {0,ud,lr,2,1,1};
bitmap.bmBits = &gdata[0];
hbitmap = CreateBitmapIndirect(&bitmap);
}
I am using the function like this:
if(play){
cgr = new graphic(play->gOut());
return *cgr;
}
class player{
string name;
graphic gr;
void create();
public:
player();
graphic gOut(){return gr;}
void dummy(){MessageBox(NULL, "Dummy" , "Notice", MB_OK); }
};