Im just starting out with irrlicht (and c++) for 2d development and I followed the 2d tutorial, so I am able to draw a 2d texture on the screen (With draw2DImage) this seems to work fine.
So I made a seperate class where I draw a ship and also change it's position in the Update function, but here I run into a problem. The ship is drawn twice when I change it's position.
void Ship::Draw(irr::video::IVideoDriver * driver, irr::video::ITexture* texture) {
driver->draw2DImage((texture), this->position);
}
void Ship::Update(float gameTime) {
this->position.set(this->position.X += 1, this->position.X += 1);
}
The ship is drawn once on its original place (I guess 0,0) but it seems asif the ship is being copied and then that copy is.
in my main.cpp I have this:
ship1->Update(1);
ship1->Draw(driver, shipTexture);
(Also, the ship's texture is cut off after a while(as seen in the screenshot)).
And also, when I don't 'move' the ship (so I just change it's position once at startup (i.e. this->position.X = 100 this->position.Y = 100) then it behaves normally, so maybe there is something wrong with the way I set up everything?