From e06eea7c5d8acb68e478f78322ab3be7aa7008b6 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Sun, 15 Mar 2015 18:06:24 +0100 Subject: [PATCH] Adding debug key to print the position. --- game/level.cc | 5 +++++ game/level.hh | 1 + game/main.cc | 3 +++ 3 files changed, 9 insertions(+) diff --git a/game/level.cc b/game/level.cc index d512e68..4de6fc8 100644 --- a/game/level.cc +++ b/game/level.cc @@ -344,3 +344,8 @@ void Level::setWaterPlane(Object* water) { void Level::setTerrain(Terrain terrain) { this->terrain = terrain; } + +void Level::printPosition() { + printf("Player position: %2.2f, %2.2f, %2.2f\n", cameraCenter->getPosition().x, + cameraCenter->getPosition().y, cameraCenter->getPosition().z); +} diff --git a/game/level.hh b/game/level.hh index f989b27..a4ce77b 100644 --- a/game/level.hh +++ b/game/level.hh @@ -74,6 +74,7 @@ class Level { void forceMove(float x, float y, float z, unsigned indice); void activateEndgame(); void setTerrain(Terrain terrain); + void printPosition(); private: lua_State* luaState=nullptr; std::vector objects; diff --git a/game/main.cc b/game/main.cc index 0075841..b432ba2 100644 --- a/game/main.cc +++ b/game/main.cc @@ -36,6 +36,9 @@ static void keyCallback(GLFWwindow* _window, int _key, int, int _action, int) if (_key == GLFW_KEY_F8 && _action == GLFW_PRESS) { app.getGraphics()->setRenderWorld(!app.getGraphics()->getRenderWorld()); } + if (_key == GLFW_KEY_F9 && _action == GLFW_PRESS) { + app.getLevel()->printPosition(); + } #endif }