diff --git a/include/Cubed/gameplay/player.hpp b/include/Cubed/gameplay/player.hpp index 3818de1..a4e6e65 100644 --- a/include/Cubed/gameplay/player.hpp +++ b/include/Cubed/gameplay/player.hpp @@ -36,7 +36,7 @@ private: public: Player(const World& world, const std::string& name); - + ~Player(); const glm::vec3& get_front() const; const glm::vec3& get_player_pos() const; const MoveState& get_move_state() const; diff --git a/src/gameplay/chunk.cpp b/src/gameplay/chunk.cpp index a6c02fd..4b2657b 100644 --- a/src/gameplay/chunk.cpp +++ b/src/gameplay/chunk.cpp @@ -8,7 +8,7 @@ Chunk::Chunk(World& world, ChunkPos chunk_pos) : } Chunk::~Chunk() { - + glDeleteBuffers(1, &m_vbo); } const std::vector& Chunk::get_chunk_blocks() const{ diff --git a/src/gameplay/player.cpp b/src/gameplay/player.cpp index 144566c..00e9f63 100644 --- a/src/gameplay/player.cpp +++ b/src/gameplay/player.cpp @@ -8,7 +8,9 @@ Player::Player(const World& world, const std::string& name) : { } +Player::~Player() { +} const glm::vec3& Player::get_front() const { return m_front; } diff --git a/src/main.cpp b/src/main.cpp index 330f6f0..6f9005f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,9 +18,6 @@ #include constexpr int NUM_VAO = 1; -constexpr int NUM_VBO = 1; - - GLuint rendering_program; GLuint vao[NUM_VAO]; @@ -39,15 +36,9 @@ World world; void setup_vertices(void) { - - // every block - - - glGenVertexArrays(NUM_VAO, vao); glBindVertexArray(vao[0]); - glBindVertexArray(0); } @@ -93,7 +84,8 @@ GLuint create_shader_program() { LOG::error("linking failed"); Shader::print_program_info(vf_program); } - + glDeleteShader(v_shader); + glDeleteShader(f_shader); return vf_program; } @@ -169,7 +161,7 @@ void display(GLFWwindow* window, double current_time) { void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { switch(key) { - case GLFW_KEY_ESCAPE: + case GLFW_KEY_Q: if (action == GLFW_PRESS) { if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED) { @@ -179,6 +171,10 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod } } break; + case GLFW_KEY_ESCAPE: + if (action == GLFW_PRESS) { + glfwSetWindowShouldClose(window, GLFW_TRUE); + } } @@ -221,7 +217,10 @@ int main() { glfwSwapBuffers(window); glfwPollEvents(); } - + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindVertexArray(0); + glDeleteVertexArrays(NUM_VAO, vao); + glDeleteProgram(rendering_program); glfwDestroyWindow(window); glfwTerminate(); exit(EXIT_SUCCESS);