Add Map rendering

This commit is contained in:
Riyyi
2015-03-18 19:59:41 +01:00
parent 46b4baf0d6
commit 996dd153a8
9 changed files with 84 additions and 33 deletions
+10 -3
View File
@@ -9,15 +9,15 @@ void MainGame::Initialize(sf::RenderWindow* window) {
this->entityManager->SetCollisionMethod(UpdateCollisions);
// Add entities
this->entityManager->AddEntity("test", new Entity("data\\gfx\\test.png"));
this->entityManager->AddEntity("test", new Entity("data\\gfx\\test.png"));
this->entityManager->AddEntity("test", new Entity("data/gfx/test.png"));
this->entityManager->AddEntity("test", new Entity("data/gfx/test.png"));
this->entityManager->Get("test0")->velocity.x = 0.5;
this->entityManager->Get("test")->setPosition(sf::Vector2f(50, 50));
// Load map
this->map = new Map();
MapLoad mapLoad;
mapLoad.Load(this->map, "data\\map\\level1.json");
mapLoad.Load(this->map, "data/map/level1.json");
}
void MainGame::Update(sf::RenderWindow* window) {
@@ -49,9 +49,16 @@ void MainGame::Update(sf::RenderWindow* window) {
}
this->entityManager->Update();
if(inputManager.IsPressed(InputManager::LoadMap)) {
std::cout << "Loading Map..." << std::endl;
MapLoad mapLoad;
mapLoad.Load(this->map, "data/map/level1.json");
}
}
void MainGame::Render(sf::RenderWindow* window) {
this->map->Render(window);
this->entityManager->Render(window);
}