iOS - TouchInput.ID

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

iOS - TouchInput.ID

Post by LunaRebirth »

Hi,

In my EventReceiver class in Android, I am using event.TouchInput.ID in order to work with multi-touch features.
This works fine.

During my port to iPhone, I am a receiving a crash. The debugger shows that event.TouchInput.ID is a large junk number.

Code: Select all

bool MyEventReceiver::OnEvent(const SEvent& event)
{
    if (event.EventType == EET_TOUCH_INPUT_EVENT)
    {
        Game::log(event.TouchInput.ID); // prints some large, random, junk, number in iOS. prints correctly in Android.
    }
}
Is there some other method I should be using to get the Touch ID for iOS?

Thanks

EDIT:
I also needed to modify the CIrrDevicesiOS.mm file to remove the "Scale" variable, otherwise the TouchInput.X and TouchInput.Y values are way off.
I'm unsure whether this is a bug or a feature for something I'm missing.
Arclamp
Posts: 71
Joined: Thu Oct 10, 2013 7:45 pm

Re: iOS - TouchInput.ID

Post by Arclamp »

Since its been here a few days... I've not ported to IPhone yet, but on Android I use the following to gather all events for later use. I was wondering if you're getting an errant signal and if checking the touchinput event may filter the issue (maybe not since in IEventReceiver.h there are no more types except count)

Code: Select all

 
#ifdef _IRR_ANDROID_PLATFORM_
    if (event.EventType == EET_TOUCH_INPUT_EVENT)
    {
        switch (event.TouchInput.Event)
        {
            case ETIE_PRESSED_DOWN:
            {
                touch_list.push_back(new NUBMultiTouchEvent(event.TouchInput.X, event.TouchInput.Y, event.TouchInput.ID, TOUCH_STATE_DOWN));
                break;
            }
            case ETIE_MOVED:
            {
                touch_list.push_back(new NUBMultiTouchEvent(event.TouchInput.X, event.TouchInput.Y, event.TouchInput.ID, TOUCH_STATE_MOVED));
                break;
            }
            case ETIE_LEFT_UP:
            {
                touch_list.push_back(new NUBMultiTouchEvent(event.TouchInput.X, event.TouchInput.Y, event.TouchInput.ID, TOUCH_STATE_UP));
                break;
            }
            default:
                break;
        }
    }
#else
 
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: iOS - TouchInput.ID

Post by LunaRebirth »

Arclamp wrote:Since its been here a few days... I've not ported to IPhone yet, but on Android I use the following to gather all events for later use. I was wondering if you're getting an errant signal and if checking the touchinput event may filter the issue (maybe not since in IEventReceiver.h there are no more types except count)

Code: Select all

 
#ifdef _IRR_ANDROID_PLATFORM_
    if (event.EventType == EET_TOUCH_INPUT_EVENT)
    {
        switch (event.TouchInput.Event)
        {
            case ETIE_PRESSED_DOWN:
            {
                touch_list.push_back(new NUBMultiTouchEvent(event.TouchInput.X, event.TouchInput.Y, event.TouchInput.ID, TOUCH_STATE_DOWN));
                break;
            }
            case ETIE_MOVED:
            {
                touch_list.push_back(new NUBMultiTouchEvent(event.TouchInput.X, event.TouchInput.Y, event.TouchInput.ID, TOUCH_STATE_MOVED));
                break;
            }
            case ETIE_LEFT_UP:
            {
                touch_list.push_back(new NUBMultiTouchEvent(event.TouchInput.X, event.TouchInput.Y, event.TouchInput.ID, TOUCH_STATE_UP));
                break;
            }
            default:
                break;
        }
    }
#else
 
Hmm, nope, that isn't the issue.
I notice a lot of these things for iOS, such as when accessing the keyboard, the double-quote and single-quote keys crash the program, having Event.KeyInput.Key equal to -30, and Event.KeyInput.SystemKeyCode being a large junk number.
Looks like Irrlicht isn't very much ready for iPhone use yet.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: iOS - TouchInput.ID

Post by CuteAlien »

Yeah, missing maintainers for that currently :-(
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: iOS - TouchInput.ID

Post by LunaRebirth »

I'll piece together some tutorials and examples for setting up iOS this week.

The OGL ES example doesn't include touch or keyboard events, they took me longer than I intended to set them up on my own.
I'll see if I contribute to the iOS development.
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: iOS - TouchInput.ID

Post by LunaRebirth »

Quick question,

Do either of you (or anyone) know how to get the window context in iOS? Basically the equivalent of Android's JNI environment.

I believe it is externalView in CIrrDeviceiOS.mm in the ogl es source, but I'm not sure that I'm right.

I'm trying to set up Admob for iOS.
The function for Android is

Code: Select all

banner->Initialize(androidApp->activity->clazz, bannerUnit, bannerSize);
but I can't figure out the equivalent of androidApp->activity->clazz to use.
Post Reply