fixed camera inputs

This commit is contained in:
Anselme 2016-12-07 18:36:01 +01:00
parent ef7d2ff0a2
commit adda0d477b
2 changed files with 10 additions and 8 deletions

View File

@ -13,8 +13,8 @@ void CameraNode::update()
{ {
if(action == m_action_move) if(action == m_action_move)
moveCamera(diff.x, diff.y); moveCamera(diff.x, diff.y);
else if(action == m_action_move) else if(action == m_action_rotate)
rotateCamera(diff.x, diff.y); rotateCamera(diff.x, diff.y);
} }
zoom(m_input->getDeltaVerticalScroll()); zoom(m_input->getDeltaVerticalScroll()*120.f);
} }

View File

@ -46,6 +46,11 @@ public:
b.key = sf::Keyboard::KeyCount + sf::Mouse::Right; b.key = sf::Keyboard::KeyCount + sf::Mouse::Right;
keys.push_back(b); keys.push_back(b);
} }
static std::vector<int> getMap()
{
return {ROTATE_CAMERA, MOVE_CAMERA, TOGGLE_CONSOLE};
}
}; };
class TestGen : public TerrainGenerator class TestGen : public TerrainGenerator
@ -109,7 +114,7 @@ void generateTerrain(SceneTree *scene)
chunk->mesh->setMaterial(mat); chunk->mesh->setMaterial(mat);
chunk->mesh->initGL(); chunk->mesh->initGL();
MeshNode *node = new MeshNode(chunk->mesh); MeshNode *node = new MeshNode(chunk->mesh);
node->setTransform(glm::translate(glm::mat4(), pos)); node->setTransform(glm::translate(glm::mat4(), pos*8.f));
scene->addObject(terrainContainer, node); scene->addObject(terrainContainer, node);
} }
} }
@ -206,12 +211,9 @@ int main(){
Input* input = engine.getInput(); Input* input = engine.getInput();
std::vector<int> v = {myKeysMap::TOGGLE_CONSOLE};
input->addContext(Context("default",v));
IKeysMap km = myKeysMap(); input->setKeysMap(myKeysMap());
input->addContext(Context("default", myKeysMap::getMap()));
input->setKeysMap(km);
input->setCurrentContext("default"); input->setCurrentContext("default");
input->updateKeyBindings(); input->updateKeyBindings();
engine.start(); engine.start();