Only render entities on screen

This commit is contained in:
Riyyi
2015-03-23 23:00:22 +01:00
parent cbf33e2ffa
commit 52361bc8e0
13 changed files with 131 additions and 71 deletions
+8 -2
View File
@@ -37,15 +37,21 @@ void MainGame::Update(sf::RenderWindow* window) {
this->map->CheckCollision(this->player);
this->camera->Update(window, this->map, sf::Vector2f(this->player->getPosition().x, this->player->getPosition().y));
if(inputManager.IsPressed(InputManager::LoadMap)) {
// Reloading of the map
if(inputManager.IsPressed(InputManager::LoadMap)
&& inputManager.IsKeyBoardPressed(sf::Keyboard::LControl)) {
std::cout << "Loading Map..." << std::endl;
MapLoad(this->map, "data/map/level1.json", 0);
}
else if(inputManager.IsPressed(InputManager::LoadMap)) {
std::cout << "Updating Map..." << std::endl;
MapLoad(this->map, "data/map/level1.json", 1);
}
}
void MainGame::Render(sf::RenderWindow* window) {
this->map->RenderGround(window);
this->entityManager->Render(window);
this->entityManager->Render(window, this->camera);
this->map->RenderAbove(window);
}