Sorry, this might not be the right place for it, but it's involving gapidraw, so why not?
(Wish there was a general programming forum here).
Pointers seem to always get the best of me. Everytime I think I get it, they suprise me or do soemthing unexpected.
I was able to get a sprite drawn and moving around the screen in gapidraw... which I felt was a good start.
So I intended to add some functionality to it... I would create a class for a "ball", and create a few instances of it.
With that in mind, each ball would in essence draw itself, and track it's own coordinates, etc... nothing too complex, I'd venture.
On my CGapiApplications ProcessNextFrame(), I placed the following code:
ball1 had been created, so no worries there. The basic ball code was as follows:
So there it is basically. It compiles, but does nothing.
the line that says:
ball1.move(&pBackbuffer;);
I changed around to try a number of things, since I felt more and more confused about the pointer system, the more it failed.
I tried:
ball1.move(pBackbuffer); // Assuming pBackbuffer contained the address of the buffer
and
ball1.move(&pBackbuffer;); // Assuming I needed to pass the address.
So can anyone help out w/ this? I'd appreciate it a lot! Sorry if this in the total wrong location, but I am trying to get a handle on using gapidraw
Pointers seem to always get the best of me. Everytime I think I get it, they suprise me or do soemthing unexpected.
I was able to get a sprite drawn and moving around the screen in gapidraw... which I felt was a good start.
So I intended to add some functionality to it... I would create a class for a "ball", and create a few instances of it.
With that in mind, each ball would in essence draw itself, and track it's own coordinates, etc... nothing too complex, I'd venture.
On my CGapiApplications ProcessNextFrame(), I placed the following code:
- Code:
pBackbuffer->FillRect(NULL, RGB(128, 128, 128), 0, NULL);
ball1.move(&pBackbuffer;);
return S_OK;
ball1 had been created, so no worries there. The basic ball code was as follows:
- Code:
class Ball
{
public:
int x;
int y;
int speed;
CGapiSurface graphic;
Ball()
{
x = 0;
y = 0;
speed = 1;
graphic.CreateSurface(GDSURFACE_SYSTEMMEMORY, TEXT("\\ballGraphic.bmp"));
}
int move(CGapiSurface* pBackbuffer)
{
x += speed;
y += speed;
pBackbuffer->BltFast(x, y, & graphic, NULL, 0, NULL);
}
~Ball()
{
graphic.FreeSurface();
}
}
So there it is basically. It compiles, but does nothing.
the line that says:
ball1.move(&pBackbuffer;);
I changed around to try a number of things, since I felt more and more confused about the pointer system, the more it failed.
I tried:
ball1.move(pBackbuffer); // Assuming pBackbuffer contained the address of the buffer
and
ball1.move(&pBackbuffer;); // Assuming I needed to pass the address.
So can anyone help out w/ this? I'd appreciate it a lot! Sorry if this in the total wrong location, but I am trying to get a handle on using gapidraw