Archived

This topic is now archived and is closed to further replies.

a dumb question

This topic is 5777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
// 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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
I made a new thread on this problem, and it got a lot more responses.



MSVC++ 6.0 intro
DX 8.0a DX SDK 6.1
win98
#define WIN32_LEAN_AND_MEAN
the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.

Share this post


Link to post
Share on other sites