Add Map rendering
This commit is contained in:
+10
-3
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user