I can't believe I fix the IPhone touch things!

I can't believe I fix the IPhone touch things without a document.
When I begin to use orxEVENT_TYPE_IPHONE macro in my cpp files,I always get compile errors......Compiler said it can't find it.

I see the macro defined in orx.h,after tried to defined macro __orxIPHONE__ and macro __orxOBJC__ myself and failed, I found the demo can use the orxEVENT_TYPE_IPHONE macro right.Oh my!It's must be a objc file to use it........

After I found the mouse input come from EVENT orxEVENT_TYPE_INPUT instead of orxEVENT_TYPE_MOUSE and just have a EVENT when the button uping, This is the biggest victory to in control of orx!

I think the orx for IPhone need a special tutorial......I read the old tutorials,but I get no help from the things I mentioned.....

Comments

  • edited May 2010
    As a simple expression, make a mm file to use the IPhone macros.Never try it in a cpp file,except that you want to torture yourself.
  • edited May 2010
    jtianling wrote:
    I can't believe I fix the IPhone touch things without a document.
    When I begin to use orxEVENT_TYPE_IPHONE macro in my cpp files,I always get compile errors......Compiler said it can't find it.

    I see the macro defined in orx.h,after tried to defined macro __orxIPHONE__ and macro __orxOBJC__ myself and failed, I found the demo can use the orxEVENT_TYPE_IPHONE macro right.Oh my!It's must be a objc file to use it........

    Yes, I totally forgot to point out that point, sorry! :/
    As the application stub is written in ObjC (there isn't any other option available anyway), your main file has to be an ObjC one.
    After I found the mouse input come from EVENT orxEVENT_TYPE_INPUT instead of orxEVENT_TYPE_MOUSE and just have a EVENT when the button uping, This is the biggest victory to in control of orx!

    Yes, all the inputs go through orxEVENT_TYPE_INPUT, the events orxEVENT_TYPE_MOUSE/JOYSTICK/KEYBOARD being only used internally. I should write something about this somewhere. =) Or even remove them from the public event list.
    I think the orx for IPhone need a special tutorial......I read the old tutorials,but I get no help from the things I mentioned.....

    You're totally right. If you have any suggestions about what should contain such a tutorial, please let me know. Maybe I should base it on the small iPhone demo that ships with orx?
  • edited May 2010
    I totally agree with you about removing the event from the public event list to a private one.The good interface should not puzzle it's user with unuseful things.

    In addition,I think orx could wrap touch event more without exposing any NS things to let user could handle touch event in a cpp file.In that way, one could more easily handle the differentiation in the Windows/Mac/Iphone with a simple macro.
    Now, Macros can't handle this, I need to put two event handle function in two files with the macros. But supporting the RAW IPhone Event is still needed.

    I look forward your new tutorials.
  • edited May 2010
    jtianling wrote:
    I totally agree with you about removing the event from the public event list to a private one.The good interface should not puzzle it's user with unuseful things.

    That will be done before the 1.2 release.
    In addition,I think orx could wrap touch event more without exposing any NS things to let user could handle touch event in a cpp file.In that way, one could more easily handle the differentiation in the Windows/Mac/Iphone with a simple macro.
    Now, Macros can't handle this, I need to put two event handle function in two files with the macros. But supporting the RAW IPhone Event is still needed.

    I guess I could add a wrapper there but I'm not sure which information I should wrap as everything could potentially be useful and NS classes for touches and accelerometer have a bunch of query methods.
    I look forward your new tutorials.

    I'll let you know when something's ready.
  • edited May 2010
    Except wrapping it all,Just simulate the single touch with full mouse events should be great too.touch begin = left button down,
    touch move = left button down and move, touch end/cancel = left button up.
    (I don't know if is it available now)
    But just with input event,I only can get the left button up event as the touch inside up.
  • edited May 2010
    You can already query the one-touch very easily through the mouse interface:

    orxMouse_IsButtonPressed will tell you if there's an active touch or not and orxMouse_GetPosition will then give you its position.

    You can also use the generic input system to monitor mouse left button click (both touch on *and* off) via events and I'll soon add the way to monitor mouse axes (x and y separately as the interface use single float values).

    I'll soon add
  • edited May 2010
    Thank you, that helps.
    But will I need divide code into two part,one in event callback, one in run/clock callback?(If I want to detect all the input inclued touch begin,touch move and touch end)
  • edited May 2010
    It's up to you, you don't have to use the event callbacks at all for handling inputs.
    You can query them with orxInput_IsActive() / orxInput_HasNewStatus().

    If you'd rather go for an event callback, I added support for mouse position in the generic input system tonight. It's only on the SVN so far but it'll be part of 1.2 release.

    Both ways allow you to fully handle single touch on iPhone. For handling multiple-touch, you'd have to use event callbacks as there are no handling in the generic input system yet.
  • edited May 2010
    OK,I knew that.Thank you.
Sign In or Register to comment.