[iOS, Solved] Not receiving touches from the whole screen
-
- Goblin
- Posts: 257
- Joined: Tue Sep 02, 2008 9:41 pm
- x 1
[iOS, Solved] Not receiving touches from the whole screen
I'm using OIS::MultiTouch and noticed something weird, I only receive calls to touchPressed() when evt.state.y < 768. I only support landscape orientations so this means about the left (or right depending which way) quarter of the screen does not respond to touches. If I touch with y<768 and drag to y>768, the touchMoved() & touchReleased() methods DO still get called when y>768.
768 seems like too much of a coincidence when the screen is 1024x768! I am building with XCode 4.5 for iOS6 SDK, targeting iOS4.3 and above. I do NOT remember this problem when I was building with XCode 3.2.6 and iOS4 SDK a month or so back (though I cannot be 100% certain).
Any ideas anyone?
edit:see end of thread
768 seems like too much of a coincidence when the screen is 1024x768! I am building with XCode 4.5 for iOS6 SDK, targeting iOS4.3 and above. I do NOT remember this problem when I was building with XCode 3.2.6 and iOS4 SDK a month or so back (though I cannot be 100% certain).
Any ideas anyone?
edit:see end of thread
Last edited by d000hg on Tue Jan 08, 2013 6:22 pm, edited 1 time in total.
-
- Goblin
- Posts: 257
- Joined: Tue Sep 02, 2008 9:41 pm
- x 1
Re: [iOS] Not receiving touch presses from the whole screen
I still can't figure this out and it's pretty awkward for testing... Can anyone offer any advice or let me know if they can reproduce it?
-
- Gnoblar
- Posts: 3
- Joined: Wed Sep 05, 2012 1:53 pm
Re: [iOS] Not receiving touch presses from the whole screen
Having the same problem here 
I'm using this code:

I'm using this code:
Code: Select all
int w = 1366;
int h = 768;
int absX = state.X.abs;
int absY = state.Y.abs;
int relX = state.X.rel;
int relY = state.Y.rel;
UIInterfaceOrientation interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation;
switch (interfaceOrientation)
{
case UIInterfaceOrientationPortrait:
break;
case UIInterfaceOrientationLandscapeLeft:
state.X.abs = w - absY;
state.Y.abs = absX;
state.X.rel = -relY;
state.Y.rel = relX;
break;
case UIInterfaceOrientationPortraitUpsideDown:
state.X.abs = w - absX;
state.Y.abs = h - absY;
state.X.rel = -relX;
state.Y.rel = -relY;
break;
case UIInterfaceOrientationLandscapeRight:
state.X.abs = absY;
state.Y.abs = h - absX;
state.X.rel = relY;
state.Y.rel = -relX;
break;
}
-
- Goblin
- Posts: 257
- Joined: Tue Sep 02, 2008 9:41 pm
- x 1
Re: [iOS] Not receiving touch presses from the whole screen
I assumed it was because I was in landscape mode, but in portrait mode the same area is not responding to touch... now it's the bottom of the screen rather than the right end.
-
- Gnoblar
- Posts: 3
- Joined: Wed Sep 05, 2012 1:53 pm
Re: [iOS] Not receiving touch presses from the whole screen
Still having the problem... Any help?
-
- Goblin
- Posts: 257
- Joined: Tue Sep 02, 2008 9:41 pm
- x 1
Re: [iOS] Not receiving touch presses from the whole screen
Do you see it in the sample apps - I don't have them built on my system and don't really want to do a full rebuild?
-
- Goblin
- Posts: 257
- Joined: Tue Sep 02, 2008 9:41 pm
- x 1
Re: [iOS] Not receiving touch presses from the whole screen
I'd been guessing this might be a bug in the OIS iOS (!) code, but looking at the source for iPhoneMultiTouch.mm and iPhoneInputManager.mm I can't see anything that would be causing this. For some reason touchPressed events are not being raised for the whole screen (specifically something about being limited to a 768x768 square). I also double-checked and it is the same on my real iPad as on the simulator.
-
- Goblin
- Posts: 257
- Joined: Tue Sep 02, 2008 9:41 pm
- x 1
Re: [iOS] Not receiving touch presses from the whole screen
Still not got any further on this, I am planning to learn some iOS/OBJ-C coding in 2013 so where in the Ogre source can I look at what's going on?
And where can I get the primary view, the one Ogre has created, to check its dimensions and other things using C++ code?
And where can I get the primary view, the one Ogre has created, to check its dimensions and other things using C++ code?
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: [iOS] Not receiving touch presses from the whole screen
OIS is not a part of Ogre, it is a separate library. I'd recommend doing input on iOS yourself using a NSView as a touch delegate. There are several threads on the forums on how to do that.
-
- Goblin
- Posts: 257
- Joined: Tue Sep 02, 2008 9:41 pm
- x 1
Re: [iOS] Not receiving touch presses from the whole screen
I realise OIS isn't a part of Ogre, but the IOS code looks OK to me... my current question is whether Ogre creates the top view itself... I assume it must? OIS seems to be doing exactly what every sample code I see suggest, the issue seems to be with the view it is adding handlers to not the handlers themselves.
I'll probably try what you suggest and see if the issue goes away, but I'm still interested where/what the Ogre iOS init code looks like.
I'll probably try what you suggest and see if the issue goes away, but I'm still interested where/what the Ogre iOS init code looks like.
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: [iOS] Not receiving touch presses from the whole screen
Ogre doesn't create a second view, it just passes the render window down into OIS which then creates the top view itself.
-
- Goblin
- Posts: 257
- Joined: Tue Sep 02, 2008 9:41 pm
- x 1
Re: [iOS] Not receiving touch presses from the whole screen
With my app in the initial portrait mode, I ran this through the debugger:This seems to be showing that the top window has a child EAGL2View (created by Ogre) and an input delegate which I am guessing is what OIS created.
When I rotate the iPad to landscape and run the same debug command, I get the same result. I don't know if this is good or bad, but I was suspicious that the UIWindow is 1024x768 while the view is 768x1024 in portrait mode, and I was also suspicious that neither of them changed when I changed orientation. Can anyone shed any light on this debug output and if it's providing a clue?
Code: Select all
lldb) po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]
(id) $1 = 0x0b8b35a0 <UIWindow: 0xb834de0; frame = (0 0; 1024 768); layer = <UIWindowLayer: 0xb834eb0>>
| EAGL2View frame dimensions x: 0 y: 0 w: 768 h: 1024
| <InputDelegate: 0xb8406f0; frame = (0 0; 768 1024); layer = <CALayer: 0xb8407a0>>
When I rotate the iPad to landscape and run the same debug command, I get the same result. I don't know if this is good or bad, but I was suspicious that the UIWindow is 1024x768 while the view is 768x1024 in portrait mode, and I was also suspicious that neither of them changed when I changed orientation. Can anyone shed any light on this debug output and if it's providing a clue?
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: [iOS] Not receiving touch presses from the whole screen
Yes, with a UIViewController, the windows and views don't change size, only their content and coordinate systems are rotated. It is odd that the dimensions don't match. I haven't checked lately but have you asked the debugger for the same info from the sample browser?
-
- Goblin
- Posts: 257
- Joined: Tue Sep 02, 2008 9:41 pm
- x 1
Re: [iOS] Not receiving touch presses from the whole screen
Tipped off by that weirdness, I got thinking about the CFG file and found that I set the video mode to 1024x768 there, which appears to have been screwing things up. I removed that setting altogether now so it gets autodetected and things appear to be working, except that Ogre is still saving a copy of the CFG which does have that setting... if I close the app, rotate the iPad and re-start the app it breaks again. I probably just want to stop Ogre saving/using the updated CFG?
-
- Gnoblar
- Posts: 8
- Joined: Thu Jan 31, 2013 5:01 am
Re: [iOS, Solved] Not receiving touches from the whole scree
find the UIView (EAGLView.mm? perhaps name this)
then you write these function on that class
touchesbegin
touchesEnded
...
...
this is IOS SDK for UIView , you can also see the cocos2d-x (www.cocos2d-x.org) , it's same ,then you can write a virtual base class , Inherit from base class by your own project , and put these input message where you want...
then you write these function on that class
touchesbegin
touchesEnded
...
...
this is IOS SDK for UIView , you can also see the cocos2d-x (www.cocos2d-x.org) , it's same ,then you can write a virtual base class , Inherit from base class by your own project , and put these input message where you want...