[iOS] poWindow

edited October 2011 in Help request
Hi,

I'm trying to add a custom view to overlay the Orx's view . Interestingly, [none[none[UIApplication] sharedApplication] keyWindow] doesn't seem to retrieve the actual window if called from within the actual game loop. However, if called from within an Input event such as a touch, the call is successful.

I noticed that Orx stores the main window in the variable poWindow in the orxAppDelegate (orxiPhone.m). Is there an easy way to get at it?

Cheers,
Eugene

Comments

  • edited October 2011
    Hi Eugene,

    I suspect you can't access the keyWindow as orx runs in a separate thread? I don't see why not actually but that's the only remotely plausible reason I can see.
    I wasn't expecting any Cocoa/iOS calls to not work so I didn't bake any easy access for the window itself.

    Is the issue only with keyWindow or also with the application delegate itself?
    If not, you can access it with:
    (orxAppDelegate *)[none[UIApplication sharedApplication] delegate]]
    

    and gets the window from it.

    Let me know if you found a way to make it work.

    Cheers!
  • edited October 2011
    Hmm... interesting pickle this turned out to be. More iOS's fault than orx. The sharedApplication is exactly the same, regardless of thread, however, it seems we can only mess with the UIViews from the main thread. In the end, we ended up doing so via performSelectorOnMainThread and it "just worked".
  • edited October 2011
    Thanks for the details, I'm sure it'll be helpful to others (including myself).

    That reminds me of similar issues I encountered when switching to iOS 4.2 and orx kept crashing. Turned out that what was a perfectly valid way of setting up the OGL contexts and the framebuffer on different threads wasn't working anymore.
    I had to find some work around by modifying the initialization sequence for the contexts and by using two separate framebuffer for on-screen and off-screen rendering.

    I sure hope that switching to iOS 5 won't bring the same kind of surprises.
Sign In or Register to comment.