diff --git a/src/main.cc b/src/main.cc index 71a51f2..e468db2 100644 --- a/src/main.cc +++ b/src/main.cc @@ -76,20 +76,26 @@ void handle_mouse () { return; } - if (glfwGetMouseButton(gWindow, 1)) { - glfwSetInputMode(gWindow, GLFW_CURSOR, GLFW_CURSOR_DISABLED); - } else { - glfwSetInputMode(gWindow, GLFW_CURSOR, GLFW_CURSOR_NORMAL); - } - double mouse_x, mouse_y; glfwGetCursorPos(gWindow, &mouse_x, &mouse_y); - gGuiInputState->mousedX = mouse_x - gGuiInputState->mouseX; - gGuiInputState->mousedY = mouse_y - gGuiInputState->mouseY; + + if (gGuiInputState->mouseButton) { + gGuiInputState->mousedX = mouse_x - gGuiInputState->mouseX; + gGuiInputState->mousedY = mouse_y - gGuiInputState->mouseY; + } else { + gGuiInputState->mousedX = 0; + gGuiInputState->mousedY = 0; + } gGuiInputState->mouseX = mouse_x; gGuiInputState->mouseY = mouse_y; gGuiInputState->mouseScroll = mouse_scroll_y; +// if (glfwGetMouseButton(gWindow, 1)) { +// glfwSetInputMode(gWindow, GLFW_CURSOR, GLFW_CURSOR_DISABLED); +// } else { +// glfwSetInputMode(gWindow, GLFW_CURSOR, GLFW_CURSOR_NORMAL); +// } + gGuiInputState->mouseButton = glfwGetMouseButton(gWindow, 0) + (glfwGetMouseButton(gWindow, 1) << 1) diff --git a/src/modules/RenderUtils.cc b/src/modules/RenderUtils.cc index 8193c55..dc03096 100644 --- a/src/modules/RenderUtils.cc +++ b/src/modules/RenderUtils.cc @@ -996,7 +996,6 @@ void AssetFile::DrawGui() { // // Debug Draw Stuff // - static void set_icosphere_point( VertexArray::VertexData* data, unsigned int index, @@ -1139,9 +1138,8 @@ void DebugDrawInitialize() { {-1.0f, -1.0f, 1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 255, 255, 255, 255 }, }; - sUnitCubeLines.SetData(unit_cube_lines_data, 4 * 6); - // TODO: + GLuint unit_cube_lines_index_data[] = { 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, @@ -1263,8 +1261,6 @@ void DebugDrawInitialize() { 15, 16, 17, 18, 19, 20, 21, 22, 23 -// 6, 7, 8, -// 9, 10, 11 }; sBoneBody.SetIndexData(bone_index_data, 24); }