Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

c++, how would I be able to update objects so that they will move in the applica

ID: 3726304 • Letter: C

Question

c++, how would I be able to update objects so that they will move in the application.

full code for reference: https://github.com/partyhat1/balls/tree/master/BouncyShapes

void Scene::insertGameObject(std::unique_ptr& object)

{

_gameObjects.push_back(std::move(object));

}

void Scene::Update(double deltaTime)

{

// TODO: update objects in the scene

}

void Scene::Draw(ID2D1HwndRenderTarget & target)

{

for (auto& object : _gameObjects)

{

const auto& renderer = object->getRenderer();

renderer.Render(target, object->getLocation());

}

}

Explanation / Answer

/*If you have any question do statement in the comment section else like the answer*/

For this generous of situation wherever object is not approved as argument, use this pointer, syntax "this->variablenameof class=variable passedasparameter(in this situation it is deltaTime and I am assuming your variable name of call as deltaTime also)"

void Scene::Update(double deltaTime)

{.

this->deltaTime=deltaTime;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote