|
|
@@ -247,6 +247,8 @@ static void* m_device = NULL;
|
|
|
BX_UNUSED(touches);
|
|
|
UITouch *touch = [[event allTouches] anyObject];
|
|
|
CGPoint touchLocation = [touch locationInView:self];
|
|
|
+ touchLocation.x *= self.contentScaleFactor;
|
|
|
+ touchLocation.y *= self.contentScaleFactor;
|
|
|
|
|
|
s_ctx->m_eventQueue.postMouseEvent(s_defaultWindow, touchLocation.x, touchLocation.y, 0);
|
|
|
s_ctx->m_eventQueue.postMouseEvent(s_defaultWindow, touchLocation.x, touchLocation.y, 0, MouseButton::Left, true);
|
|
|
@@ -257,6 +259,9 @@ static void* m_device = NULL;
|
|
|
BX_UNUSED(touches);
|
|
|
UITouch *touch = [[event allTouches] anyObject];
|
|
|
CGPoint touchLocation = [touch locationInView:self];
|
|
|
+ touchLocation.x *= self.contentScaleFactor;
|
|
|
+ touchLocation.y *= self.contentScaleFactor;
|
|
|
+
|
|
|
s_ctx->m_eventQueue.postMouseEvent(s_defaultWindow, touchLocation.x, touchLocation.y, 0, MouseButton::Left, false);
|
|
|
}
|
|
|
|
|
|
@@ -265,6 +270,9 @@ static void* m_device = NULL;
|
|
|
BX_UNUSED(touches);
|
|
|
UITouch *touch = [[event allTouches] anyObject];
|
|
|
CGPoint touchLocation = [touch locationInView:self];
|
|
|
+ touchLocation.x *= self.contentScaleFactor;
|
|
|
+ touchLocation.y *= self.contentScaleFactor;
|
|
|
+
|
|
|
s_ctx->m_eventQueue.postMouseEvent(s_defaultWindow, touchLocation.x, touchLocation.y, 0);
|
|
|
}
|
|
|
|
|
|
@@ -273,6 +281,9 @@ static void* m_device = NULL;
|
|
|
BX_UNUSED(touches);
|
|
|
UITouch *touch = [[event allTouches] anyObject];
|
|
|
CGPoint touchLocation = [touch locationInView:self];
|
|
|
+ touchLocation.x *= self.contentScaleFactor;
|
|
|
+ touchLocation.y *= self.contentScaleFactor;
|
|
|
+
|
|
|
s_ctx->m_eventQueue.postMouseEvent(s_defaultWindow, touchLocation.x, touchLocation.y, 0, MouseButton::Left, false);
|
|
|
}
|
|
|
|
|
|
@@ -312,8 +323,7 @@ static void* m_device = NULL;
|
|
|
|
|
|
[m_window makeKeyAndVisible];
|
|
|
|
|
|
- //float scaleFactor = [[UIScreen mainScreen] scale]; // should use this, but needs to further pass the value to the `nvgBeginFrame()` call's `devicePixelRatio` parameter in `ExampleNanoVG` class' `update()` method so it can actually work properly.
|
|
|
- float scaleFactor = 1.0f;
|
|
|
+ float scaleFactor = [[UIScreen mainScreen] scale];
|
|
|
[m_view setContentScaleFactor: scaleFactor ];
|
|
|
|
|
|
s_ctx = new Context((uint32_t)(scaleFactor*rect.size.width), (uint32_t)(scaleFactor*rect.size.height));
|