Original Post
Hey,
Say I have code like this:
if (bpp == 16)
{
USHORT *pBuffer = (USHORT)ddsd.lpSurface;
// Draw on buffer...
}
else if (bpp == 32)
{
UINT *pBuffer = (UINT)ddsd.lpSurface;
// Draw on buffer...
}
Could I created a single pointer called pBuffer, assign an unsigned short or unsigned int to it depending on bpp, and still be able to increment the pointer on the correct boundaries?
For example,
void *pBuffer;
if (bpp == 16)
pBuffer = (USHORT)ddsd.lpSurface;
else if (bpp == 32)
pBuffer = (UINT)ddsd.lpSurface;
// Increment pBuffer so that it points to the next ushort or uint
pBuffer++;
Naturally, my code wouldn''t work as you can''t cast something to ushort or uint and assign to a void, but is there someway I can do this without using a bunch of if''s everywhere?
Thanks a million!