I've got code that executes but I can't seem to make it draw to the screen
this is my main code
CDisplay my_dx;
struct sprite
{
CSurface *lpCD;
LPDIRECTDRAWSURFACE7 lpDDS;
int width;
int height;
int x;
int y;
RECT blit;
};
sprite my_sprite;
LPDIRECTDRAWPALETTE my_palette;
my_sprite.width = 32;
my_sprite.height = 32;
my_sprite.x = 0;
my_sprite.y = 0;
my_sprite.blit.left = 0;
my_sprite.blit.right = 32;
my_sprite.blit.top = 0;
my_sprite.blit.bottom = 32;
if(my_dx.CreateSurfaceFromBitmap(&my_sprite.lpCD, "test.bmp", my_sprite.width, my_sprite.height) == S_OK)
{
my_sprite.lpDDS = my_sprite.lpCD->GetDDrawSurface();
};
//if(my_dx.CreatePaletteFromBitmap(&my_palette, "test.bmp") == DD_OK)
//{
// if(my_dx.SetPalette(my_palette) == DD_OK)
// MessageBox(hwnd, "Success", "Success", MB_OK);
//};
while (1)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
break;
// Get any accelerator keys
TranslateMessage(&msg);
// Do what the message was
DispatchMessage(&msg);
} else {
if(my_dx.Blt(0, 0, my_sprite.lpCD, &my_sprite.blit) != S_OK)
MessageBox(hwnd, "Error", "Error", MB_OK);
};
} // end while
};
I'm using ddutil
right now i'm just trying to figure out to get it on the screen, so don't worry about colorkey's just yet. I'll worry about that after I figure out why it won't draw anyways.
[Edited by - Coder on January 3, 2005 8:02:54 AM]