Fix erratic camera movement when right clicking and minor cleanup.

simple_math_single_header
Martin Felis 2018-12-15 23:19:14 +01:00
parent ea7e3113f4
commit 6d7bd06c2c
2 changed files with 15 additions and 13 deletions

View File

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

View File

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