Original Post
Hi, I have used code based on the Game Programming Genesis articles on gamedev found here : http://www.gamedev.net/reference/programming/features/gpgenesis4/ to do some DirectDraw 2d graphics.
Whith this tutorial I was able to plot pixels in 16bits fullscreen and everything works a.ok. but when I try to do 32bits it doesn''t work... Actually I see a pixel on the screen, it seems to be of the right color, but it is not at the good place on the screen. If I plot a pixel on the middle of the screen at 16 bits it is on the middle, but at 32 bits it is not for the same resolution ? I have tried several different coordinates and got the same results everytime.
here is my code which is currently in a class:
if (fullscreen == true)
{
if (scr_bpp == 32)
{
UINT *video_buffer;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
lpddsback->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
video_buffer = (UINT *)ddsd.lpSurface;
video_buffer[x + (y*ddsd.lPitch >> 1)] = (UINT)RGB_32BIT(red, green, blue);
lpddsback->Unlock(ddsd.lpSurface);
}
if (scr_bpp == 16)
{
USHORT *video_buffer;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
lpddsback->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
video_buffer = (USHORT *)ddsd.lpSurface;
if (nPixelFormat == 16)
video_buffer[y * (ddsd.lPitch>>1) + x] = (USHORT)RGB_16BIT565(red, green, blue);
else
video_buffer[y * (ddsd.lPitch>>1) + x] = (USHORT)RGB_16BIT555(red, green, blue);
lpddsback->Unlock(ddsd.lpSurface);
}
}
I have also noticed that when you use this code in the windowed mode, the pixel display but the location on the screen isn''t right.
Can anyone help me out with this ?
Thanks in advance for any help you could give me.
WHO DO THEY
THINK THEY''RE
FOOLING : YOU ?