Hello,
I started tinkering with a class to use for a sprite manger, and I'm almost certain I'm doing it wrong. The class loads an image which I think should be a pointer so I may assign the same texture to multiple sprites without using more video memory. The problem is no matter how I set it up with pointers, I would get errors. Then again, I don't use pointers very often at all either. I think my code is copying the image as opposed to referencing it.
class Sprite
{
private:
int x, y, width, height;
public:
TTexture texture;
Sprite()
{
Position(0,0);
Size(-1,-1);
};
void SetTexture(TTexture tex)
{
texture = tex;
};
void Draw()
{
DrawImage(texture, x, y, width, height);
};
void Position(int xpos, int ypos)
{
x = xpos;
y = ypos;
};
void Size(int w, int h)
{
width = w;
height = h;
}
protected:
};
Thanks in advance on any advice.
Coldfire