Entities can now be created dynamically
This commit is contained in:
1 parent
aa58238162
commit
43c3d3930f
7 files changed
+15
-18
No files matched your search
@@ -61,9 +61,6 @@ void MainState::update(float deltaTime) {
|
||||
camera->moveLeft(speed * deltaTime);
|
||||
}
|
||||
|
||||
//test.setPosition(nf::Vec3(std::sin(circle) * 10.0, 5.0, std::cos(circle) * 10.0));
|
||||
circle += 1.5f * deltaTime;
|
||||
|
||||
text.setText("FPS: " + std::to_string(app->getFPS()));
|
||||
|
||||
if (button.isClicked() || app->isKeyPressed(NFI_R))
|
||||
@@ -79,6 +76,12 @@ void MainState::update(float deltaTime) {
|
||||
sound2.stop();
|
||||
}
|
||||
|
||||
if (app->isKeyPressed(NFI_K)) {
|
||||
entities.push_back(new nf::Entity);
|
||||
entities.back()->create(ap["2mats.obj"], nf::Entity::Type::DYNAMIC);
|
||||
entities.back()->setPosition(camera->getPosition());
|
||||
}
|
||||
|
||||
if (app->isKeyPressed(NFI_ESCAPE))
|
||||
app->quit();
|
||||
}
|
||||
@@ -102,6 +105,5 @@ void MainState::render(nf::Renderer& renderer) {
|
||||
void MainState::onExit() {
|
||||
Log("MainState onExit!");
|
||||
|
||||
circle = 0.0f;
|
||||
entities.clear();
|
||||
}
|
||||
@@ -27,7 +27,5 @@ private:
|
||||
nf::Sound sound;
|
||||
nf::Sound sound2;
|
||||
|
||||
float circle;
|
||||
|
||||
std::vector<nf::Entity*> entities;
|
||||
};
|
||||
Reference in new issue
Block a user