Adding debug key to print the position.

This commit is contained in:
Faerbit 2015-03-15 18:06:24 +01:00
parent 7b80f34f4f
commit e06eea7c5d
3 changed files with 9 additions and 0 deletions

View File

@ -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);
}

View File

@ -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<Object*> objects;

View File

@ -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
}