Skip to content

Commit

Permalink
Fix picking on Mac Retina displays
Browse files Browse the repository at this point in the history
  • Loading branch information
jvanverth committed Aug 12, 2015
1 parent 6374261 commit 1e9afe8
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/common/IvEngine/OGL/IvMainOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ visibilityCallback(GLFWwindow* window, int vis)
static void
reshapeCallback(GLFWwindow* window, int w, int h)
{
IvRenderer::mRenderer->Resize( w, h );
int width;
int height;
glfwGetFramebufferSize(window, &width, &height);
IvRenderer::mRenderer->Resize( width, height );
}

static void
Expand Down Expand Up @@ -220,7 +223,19 @@ mouseCallback(GLFWwindow* window, int button, int action, int mods)
{
double x, y;
glfwGetCursorPos(window, &x, &y);
IvGame::mGame->mEventHandler->OnMouseDown( (int)x, (int)y );

int width;
int height;
glfwGetFramebufferSize(window, &width, &height);

int windowWidth;
int windowHeight;
glfwGetWindowSize(window, &windowWidth, &windowHeight);

double scaleX = width/(float)windowWidth;
double scaleY = height/(float)windowHeight;

IvGame::mGame->mEventHandler->OnMouseDown( (int)scaleX*x, (int)scaleY*y );
}
else
{
Expand Down

0 comments on commit 1e9afe8

Please sign in to comment.