a dumb question

Started by
4 comments, last by PPCThug 22 years, 1 month ago
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.
Bloodshed Dev-C++ 4.9.8.0 Mingw DX 9.0a DX SDK 6.1win2k#define WIN32_LEAN_AND_MEANthe Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.mechwarrior 2 mercenaries, 4 particle projection cannons, thug chassis
Advertisement
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.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
// 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.
Bloodshed Dev-C++ 4.9.8.0 Mingw DX 9.0a DX SDK 6.1win2k#define WIN32_LEAN_AND_MEANthe Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.mechwarrior 2 mercenaries, 4 particle projection cannons, thug chassis
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.
Bloodshed Dev-C++ 4.9.8.0 Mingw DX 9.0a DX SDK 6.1win2k#define WIN32_LEAN_AND_MEANthe Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.mechwarrior 2 mercenaries, 4 particle projection cannons, thug chassis
Either ''buffer'' is a pointer, or buffer isn''t visible in that function.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
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.
Bloodshed Dev-C++ 4.9.8.0 Mingw DX 9.0a DX SDK 6.1win2k#define WIN32_LEAN_AND_MEANthe Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.mechwarrior 2 mercenaries, 4 particle projection cannons, thug chassis

This topic is closed to new replies.

Advertisement