diff --git a/application.cc b/application.cc
index f23bf8e..6bb127b 100644
--- a/application.cc
+++ b/application.cc
@@ -5,7 +5,7 @@ using namespace tinyxml2;
Application::Application() {
//load the config.xml
loadConfig();
- graphics = Graphics(glm::uvec2(1024, 786), 0.1f, 150.0f);
+ graphics = Graphics(glm::uvec2(windowWidth, windowHeight), 0.1f, farPlane);
}
void Application::init()
@@ -13,24 +13,26 @@ void Application::init()
// init random generator
std::srand(std::time(NULL));
// choose Level TODO: Choose this in a menu
- this->level = Level("1");
+ std::string heightmapFilePath = heightmapPath + "heightmapLvl1.png";
+ this->level = Level(heightmapFilePath);
+ level.getPhysics()->init(geometryPath);
// Don't change this!
ignoredMouseUpdates = 0;
cameraLock = true;
// set Skybox size
level.setSkydomeSize((graphics.getFarPlane())-31.0f);
-
+
// define where shaders and textures can be found:
ACGL::Base::Settings::the()->setResourcePath("../");
- ACGL::Base::Settings::the()->setShaderPath("Shader/");
- ACGL::Base::Settings::the()->setTexturePath("Levels/Textures/");
- ACGL::Base::Settings::the()->setGeometryPath("Levels/Geometry/");
+ ACGL::Base::Settings::the()->setShaderPath(shaderPath);
+ ACGL::Base::Settings::the()->setTexturePath(texturePath);
+ ACGL::Base::Settings::the()->setGeometryPath(geometryPath);
// load Level
level.load();
Loader loader = Loader();
- loader.load("Level1.xml", &level);
-
+ std::string levelXmlFilePath = levelXmlPath + "Level1.xml";
+ loader.load(levelXmlFilePath, &level, compositionsPath, scriptPath);
graphics.init(&level);
// just in case: check for errors
diff --git a/data/config.xml b/data/config.xml
index a972248..c8e3185 100644
--- a/data/config.xml
+++ b/data/config.xml
@@ -5,7 +5,7 @@
150.0
-Levels/ObjectSetups/
+../Levels/ObjectSetups/Compositions.xml
Shader/
@@ -13,8 +13,8 @@
Levels/Textures/
-Levels/scripts/
+../Levels/scripts/
-Levels/
+../Levels/
-Levels/ObjectSetups/
+../Levels/ObjectSetups/
diff --git a/level.cc b/level.cc
index 0f9ef84..e2c81b1 100644
--- a/level.cc
+++ b/level.cc
@@ -1,11 +1,11 @@
#include "level.hh"
#include
-Level::Level(std::string levelNum){
- this->levelNum = levelNum;
- this->terrain = Terrain(levelNum);
+Level::Level(std::string heightmapFilePath){
+ this->terrain = Terrain(heightmapFilePath);
// default value
skydomeSize = 50.0f;
+ physics = Physics();
}
Level::Level() {
@@ -40,11 +40,7 @@ void Level::load() {
//Push the level to Lua as a global variable
luabridge::push(luaState, this);
lua_setglobal(luaState, "level");
-
-
- this->physics = Physics();
- this->physics.init();
-
+
this->camera = Camera(glm::vec2(-0.8f, 0.0f), 3.0f);
}
diff --git a/level.hh b/level.hh
index 384fa6e..69b3412 100644
--- a/level.hh
+++ b/level.hh
@@ -20,7 +20,7 @@ extern "C" {
class Level {
public:
- Level(std::string levelNum);
+ Level(std::string heightmapFilePath);
Level();
~Level();
void load();
@@ -57,7 +57,6 @@ class Level {
Terrain* getTerrain();
private:
lua_State* luaState=nullptr;
- std::string levelNum;
std::vector