Add Map and MapLoad

This commit is contained in:
Riyyi
2015-03-18 00:01:47 +01:00
parent 4a7d2644a8
commit 46b4baf0d6
10 changed files with 232 additions and 11 deletions
+8 -2
View File
@@ -5,13 +5,19 @@ void UpdateCollisions(Entity* entityA, Entity* entityB) {
}
void MainGame::Initialize(sf::RenderWindow* window) {
entityManager = new EntityManager();
entityManager->SetCollisionMethod(UpdateCollisions);
this->entityManager = new EntityManager();
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->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");
}
void MainGame::Update(sf::RenderWindow* window) {
+2
View File
@@ -6,6 +6,7 @@
#include "gamestate.h"
#include "entitymanager.h"
#include "inputmanager.h"
#include "mapload.h"
class MainGame : public GameState
{
@@ -17,6 +18,7 @@ public:
private:
EntityManager* entityManager;
Map* map;
};
#endif // MAINGAME_H