Page 1 of 1

[iOS, Solved] Not receiving touches from the whole screen

Posted: Sat Oct 20, 2012 8:04 pm
by d000hg
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

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Sun Nov 11, 2012 6:37 pm
by d000hg
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?

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Tue Nov 27, 2012 3:53 pm
by Outsider 87
Having the same problem here :(

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;
        }

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Tue Nov 27, 2012 4:16 pm
by d000hg
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.

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Mon Dec 03, 2012 3:55 pm
by Outsider 87
Still having the problem... Any help?

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Mon Dec 03, 2012 4:01 pm
by d000hg
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?

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Mon Dec 10, 2012 12:18 pm
by d000hg
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.

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Fri Dec 28, 2012 5:42 pm
by d000hg
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?

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Fri Dec 28, 2012 11:37 pm
by masterfalcon
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.

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Wed Jan 02, 2013 4:30 pm
by d000hg
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.

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Thu Jan 03, 2013 9:18 am
by masterfalcon
Ogre doesn't create a second view, it just passes the render window down into OIS which then creates the top view itself.

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Tue Jan 08, 2013 2:05 pm
by d000hg
With my app in the initial portrait mode, I ran this through the debugger:

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>>
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?

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Tue Jan 08, 2013 4:13 pm
by masterfalcon
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?

Re: [iOS] Not receiving touch presses from the whole screen

Posted: Tue Jan 08, 2013 4:29 pm
by d000hg
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?

Re: [iOS, Solved] Not receiving touches from the whole scree

Posted: Mon Feb 18, 2013 3:02 pm
by juckerpp
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...