diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/player.cpp | 12 | ||||
-rw-r--r-- | src/world.cpp | 10 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/player.cpp b/src/player.cpp index f40a1d1..1f950df 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -71,6 +71,12 @@ void PlayerSystem::receive(const KeyDownEvent& kue) el.tryListener("JumpKeyPressed", e.component<Scripted>()->caller); }); + } else if (kue.sym == SDLK_LSHIFT) { + entities.each<EventListener>( + [](entityx::Entity e, EventListener& el) { + el.tryListener("CrouchKeyPressed", + e.component<Scripted>()->caller); + }); } } } @@ -96,6 +102,12 @@ void PlayerSystem::receive(const KeyUpEvent& kue) el.tryListener("JumpKeyReleased", e.component<Scripted>()->caller); }); + } else if (kue.sym == SDLK_LSHIFT) { + entities.each<EventListener>( + [](entityx::Entity e, EventListener& el) { + el.tryListener("CrouchKeyReleased", + e.component<Scripted>()->caller); + }); } } } diff --git a/src/world.cpp b/src/world.cpp index 48e54e3..517c88e 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -69,7 +69,7 @@ World::getSize() void World::generateMesh() { for (auto &l : drawLayers) { - + // Preallocate size of vertexes float Z = l->drawLayer; @@ -89,9 +89,9 @@ void World::generateMesh() 0 , 0+h, Z, to.x , to.y , tr}; glBindBuffer(GL_ARRAY_BUFFER, l->layerVBO); - glBufferData(GL_ARRAY_BUFFER, - 36 * sizeof(GLfloat), - mesh, + glBufferData(GL_ARRAY_BUFFER, + 36 * sizeof(GLfloat), + mesh, GL_STATIC_DRAW); meshAdd.push_back(WorldMeshUpdateEvent(l->layerVBO, @@ -192,7 +192,7 @@ glm::vec3 World::collide(glm::vec3 &start, glm::vec3 &end, Physics &phys) if (i == 0.0f) { std::cout << inter.size() << std::endl; if (inter.size()) { - p.standing = true; + // p.standing = true; } } |