IMGUI use data from Gamestate, fix pointInRect bug

Wrong if logic causing point-in-rect to be valid if only x or y is
valid, where correct logic is both x and y need to be within the rect.
This commit is contained in:
2016-08-04 21:17:16 +10:00
parent 8eb9068093
commit eb1962e05e
6 changed files with 50 additions and 38 deletions
+3 -3
View File
@@ -51,9 +51,9 @@ INTERNAL void mouseCallback(GLFWwindow *window, double xPos, double yPos)
GameState *game = CAST(GameState *)(glfwGetWindowUserPointer(window));
// NOTE(doyle): x(0), y(0) of mouse starts from the top left of window
v2 windowSize = game->renderer.size;
f32 flipYPos = windowSize.h - CAST(f32) yPos;
game->input.mouse = V2(CAST(f32) xPos, flipYPos);
v2 windowSize = game->renderer.size;
f32 flipYPos = windowSize.h - CAST(f32) yPos;
game->input.mouseP = V2(CAST(f32) xPos, flipYPos);
}
INTERNAL void mouseButtonCallback(GLFWwindow *window, int button, int action,