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

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm

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

Post by d000hg » Sat Oct 20, 2012 8:04 pm

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
Last edited by d000hg on Tue Jan 08, 2013 6:22 pm, edited 1 time in total.
0 x

d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm

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

Post by d000hg » Sun Nov 11, 2012 6:37 pm

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

Outsider 87
Gnoblar
Posts: 3
Joined: Wed Sep 05, 2012 1:53 pm

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

Post by Outsider 87 » Tue Nov 27, 2012 3:53 pm

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

d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm

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

Post by d000hg » Tue Nov 27, 2012 4:16 pm

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.
0 x

Outsider 87
Gnoblar
Posts: 3
Joined: Wed Sep 05, 2012 1:53 pm

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

Post by Outsider 87 » Mon Dec 03, 2012 3:55 pm

Still having the problem... Any help?
0 x

d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm

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

Post by d000hg » Mon Dec 03, 2012 4:01 pm

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

d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm

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

Post by d000hg » Mon Dec 10, 2012 12:18 pm

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.
0 x

d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm

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

Post by d000hg » Fri Dec 28, 2012 5:42 pm

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

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

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

Post by masterfalcon » Fri Dec 28, 2012 11:37 pm

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.
0 x

d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm

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

Post by d000hg » Wed Jan 02, 2013 4:30 pm

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.
0 x

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

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

Post by masterfalcon » Thu Jan 03, 2013 9:18 am

Ogre doesn't create a second view, it just passes the render window down into OIS which then creates the top view itself.
0 x

d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm

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

Post by d000hg » Tue Jan 08, 2013 2:05 pm

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

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

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

Post by masterfalcon » Tue Jan 08, 2013 4:13 pm

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

d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm

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

Post by d000hg » Tue Jan 08, 2013 4:29 pm

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

juckerpp
Gnoblar
Posts: 8
Joined: Thu Jan 31, 2013 5:01 am

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

Post by juckerpp » Mon Feb 18, 2013 3:02 pm

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...
0 x

Post Reply