It looks like you're new here. If you want to get involved, click one of these buttons!
--- plugins/Display/iPhone/orxDisplay.m
+++ plugins/Display/iPhone/orxDisplay.m
@@ -292,8 +292,8 @@
[NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
/* Sets scale factor */
- self.contentScaleFactor = (([UIScreen respondsToSelector:@selector(scale)] != NO)
- && ([UIScreen mainScreen].scale == 2.0f))
+ self.contentScaleFactor = (([none[UIScreen mainScreen] respondsToSelector:@selector(scale)] != NO)
+ && ( [UIScreen mainScreen].scale == 2.0f))
? 2.0f
: 1.0f;
so UIScreen will never respond to the selector scale and therefore the high resolution will never be used. [UIScreen mainScreen] should be checked for that selector instead.--- plugins/Display/iPhone/orxDisplay.m
+++ plugins/Display/iPhone/orxDisplay.m
/* Inits event's payload */
orxMemory_Zero(&stPayload, sizeof(orxSYSTEM_EVENT_PAYLOAD));
- stPayload.poUIEvent = _poEvent;
- stPayload.poTouchList = _poTouchList;
+ stPayload.poUIEvent = _poEvent;
+ stPayload.poTouchList = _poTouchList;
+ stPayload.fContentScaleFactor = self.contentScaleFactor;
/* Sends it */
orxEVENT_SEND(orxEVENT_TYPE_SYSTEM, orxSYSTEM_EVENT_TOUCH_BEGIN, self, orxNULL, &stPayload);
/* Inits event's payload */
orxMemory_Zero(&stPayload, sizeof(orxSYSTEM_EVENT_PAYLOAD));
- stPayload.poUIEvent = _poEvent;
- stPayload.poTouchList = _poTouchList;
+ stPayload.poUIEvent = _poEvent;
+ stPayload.poTouchList = _poTouchList;
+ stPayload.fContentScaleFactor = self.contentScaleFactor;
/* Sends it */
orxEVENT_SEND(orxEVENT_TYPE_SYSTEM, orxSYSTEM_EVENT_TOUCH_MOVE, self, orxNULL, &stPayload);
/* Inits event's payload */
orxMemory_Zero(&stPayload, sizeof(orxSYSTEM_EVENT_PAYLOAD));
- stPayload.poUIEvent = _poEvent;
- stPayload.poTouchList = _poTouchList;
+ stPayload.poUIEvent = _poEvent;
+ stPayload.poTouchList = _poTouchList;
+ stPayload.fContentScaleFactor = self.contentScaleFactor;
/* Sends it */
orxEVENT_SEND(orxEVENT_TYPE_SYSTEM, orxSYSTEM_EVENT_TOUCH_END, self, orxNULL, &stPayload);
/* Inits event's payload */
orxMemory_Zero(&stPayload, sizeof(orxSYSTEM_EVENT_PAYLOAD));
- stPayload.poUIEvent = _poEvent;
- stPayload.poTouchList = _poTouchList;
+ stPayload.poUIEvent = _poEvent;
+ stPayload.poTouchList = _poTouchList;
+ stPayload.fContentScaleFactor = self.contentScaleFactor;
/* Sends end event */
orxEVENT_SEND(orxEVENT_TYPE_SYSTEM, orxSYSTEM_EVENT_TOUCH_END, self, orxNULL, &stPayload);
--- include/core/orxSystem.h
+++ include/core/orxSystem.h
@@ -102,6 +102,8 @@
/* Motion event */
UIEventSubtype eMotion;
};
+
+ orxFLOAT fContentScaleFactor;
};
/* Accelerate event */
--- plugins/Mouse/iPhone/orxMouse.m
+++ plugins/Mouse/iPhone/orxMouse.m
@@ -98,9 +98,12 @@
/* Gets its position inside view */
vViewPosition = [poTouch locationInView:(orxView *)_pstEvent->hSender];
-
+
/* Gets new position */
- orxVector_Set(&vNewPosition, orx2F(vViewPosition.x), orx2F(vViewPosition.y), orxFLOAT_0);
+ orxVector_Set(&vNewPosition,
+ orx2F(vViewPosition.x * pstPayload->fContentScaleFactor),
+ orx2F(pstPayload->fContentScaleFactor * vViewPosition.y),
+ orxFLOAT_0);
/* Updates mouse move */
orxVector_Sub(&(sstMouse.vMouseMove), &(sstMouse.vMouseMove), &(sstMouse.vMousePosition));
Comments
By a little outdated you probably mean more than 2 months as I fixed the retina display in August with a similar fix.
However the touch coordinates eluded me (I was probably just looking at how ugly orx's profiler looked on retina display and was happy when it got fixed and stopped there), so I'll apply your patch for that tonight.
Thanks!