a dumb question
assuming I made some direct draw surfaces with the same surface description how would I get a pointer to a certen direct draw surface?
the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.
Er... CreateSurface takes a pointer-pointer (called a handle) to a IDirectDrawSurface interface - the pointer to the surface is returned there.
You need to squirrel it away in order to 1) use the surface pointer to do something useful, 2) call ->Release() on it so you don''t leak.
How/where you squirrel it depends a great deal on what it''s used for.
You need to squirrel it away in order to 1) use the surface pointer to do something useful, 2) call ->Release() on it so you don''t leak.
How/where you squirrel it depends a great deal on what it''s used for.
// get video pointer to a surfce UCHAR for 8 bit USHORT for 16 bit
USHORT *pddsurface = (USHORT *)ddsd.lpSurface;
// process each line and copy it into the primary buffer
for (int index_y = 0; index_y < SCREENHEIGHT; index_y++)
{
for (int index_x = 0; index_x < SCREENWIDTH; index_x++)
{
// get BGR values, note the scaling down of the channels, so that they
// fit into the 5.6.5 format
UCHAR blue = (bitmap.buffer[index_y*SCREENWIDTH*3 + index_x*3 + 0]) >> 3,
green = (bitmap.buffer[index_y*SCREENWIDTH*3 + index_x*3 + 1]) >> 3,
red = (bitmap.buffer[index_y*SCREENWIDTH*3 + index_x*3 + 2]) >> 3;
// this builds a 16 bit color value in 5.6.5 format (green dominant mode)
USHORT pixel = _RGB16BIT565(red,green,blue);
// write the pixel
pddsurface[index_x + (index_y*ddsd.lPitch >> 1)] = pixel;
} // end for index_x
} // end for index_y
the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.
USHORT *pddsurface = (USHORT *)ddsd.lpSurface;
// process each line and copy it into the primary buffer
for (int index_y = 0; index_y < SCREENHEIGHT; index_y++)
{
for (int index_x = 0; index_x < SCREENWIDTH; index_x++)
{
// get BGR values, note the scaling down of the channels, so that they
// fit into the 5.6.5 format
UCHAR blue = (bitmap.buffer[index_y*SCREENWIDTH*3 + index_x*3 + 0]) >> 3,
green = (bitmap.buffer[index_y*SCREENWIDTH*3 + index_x*3 + 1]) >> 3,
red = (bitmap.buffer[index_y*SCREENWIDTH*3 + index_x*3 + 2]) >> 3;
// this builds a 16 bit color value in 5.6.5 format (green dominant mode)
USHORT pixel = _RGB16BIT565(red,green,blue);
// write the pixel
pddsurface[index_x + (index_y*ddsd.lPitch >> 1)] = pixel;
} // end for index_x
} // end for index_y
the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.
this worked in Game_Main() but it won''t work now that its in a function of it''s own?
(585) : error C2228: left of ''.buffer'' must have class/struct/union type
586) : error C2228: left of ''.buffer'' must have class/struct/union type
(587) : error C2228: left of ''.buffer'' must have class/struct/union type
HELP!
the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.
(585) : error C2228: left of ''.buffer'' must have class/struct/union type
586) : error C2228: left of ''.buffer'' must have class/struct/union type
(587) : error C2228: left of ''.buffer'' must have class/struct/union type
HELP!
the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.
Either ''buffer'' is a pointer, or buffer isn''t visible in that function.
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement