Hello,
I have a Sprite class with a Vector2 pointer (member) that is used for a sprite's position. It's a pointer because I'm forward declaring it's class so it has to be a pointer.
So I want to take in a Vector2 (parameter) and then have the pointer point to the Vector taken in without creating a new object every frame and still have it be efficient. (Or is this the way to do it?). . But I'm unsure how to do it. All I can think of is:
void Sprite::SetPos(const Vector2 _position)
{
delete m_Position;
m_Position = new Vector2(_position);
}
But I'm pretty sure it doesn't work (or does it?)
Please tell me if that doesn't make sense.
Thanks