Hello,
I've integrated Garfinkle's template app into my applicaton, but am having an issue trying to pop the view statck once Irrlicht is initialized. Irrlicht does not seem to want to relinquish control of the window, even if I call device->drop().
Here's my setup:
1) AppDelegate: has the main window, which is the window I am using for Irrlicht.
2) A custom UIViewController main menu as the root controller of a NavigationController
3) Another custom UIViewController that contains a difficulty seletion screen. This gets pushed by the main menu controller (i.e. self.navigationController pushViewController:controller animated:NO]
4) A custom UIViewController that is the game itself. This controller creates my custom UIView class.
5) A custom UIView class where I initialize Irrlicht.
My issue is when I try to pop the UIViewController pushed in step 3, Irrlicht remains visible. I've tried calling driver->drop() just before the pop, but it has no effect.
Anybody else have any insight into this one
Thanks!
Popping Irrlicht and getting it to release window on iPhone
-
- Posts: 4
- Joined: Tue Sep 14, 2010 5:40 pm
- Location: New York, NY
- Contact:
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
try deviceClose and device->run before device->drop. At least for Windows, this helps. Since device close and release is a pretty complex thing, and the OSX support is always way behind the other systems, it might even be that this was never properly tested and implemented at all. In case you find out some things just post them here, we'll happily integrate them into the engine.
-
- Posts: 4
- Joined: Tue Sep 14, 2010 5:40 pm
- Location: New York, NY
- Contact:
Thanks for the prompt reply, hybrid. calling closeDevice() causes the device to hang. It looks like the culprit is the following code, which never returns, since it seems to assume that Irrlicht is running in its own thread:
I'm presently using the template provided by Garfinkle. Is there an XCode project that anyone has created for iPhone compilation that would allow me to compile the source and attempt to fix this?
Code: Select all
191 //! notifies the device that it should close itself
192 void CIrrDeviceIPhone::closeDevice()
193 {
194 WindowActive = false;
195 Close = true;
196 CFRunLoopStop(CFRunLoopGetMain());
197 while (!Closed) yield();
198 }
-
- Posts: 4
- Joined: Tue Sep 14, 2010 5:40 pm
- Location: New York, NY
- Contact:
I looked at the way the iPhone integration was coded, and found a workaround to the issue I was having. Its a bit of a hack. I had to essentially remove Irrlicht from the UIWindow, and add it into my view hierarchy at a more appropriate place:
Not sure what the best way to implement it given the current Irrlicht API, but it seems like it would be friendlier on the iPhone for Irrlicht to assume it was a subview of another view instead of a direct subview of the main UIWindow...
Code: Select all
bool IrrlichtApplication::InitApplication(UIView *parentView)
{
// ... Create the Irrlicht device, etc, then ... //
UIView *irrIPhoneView = (UIView *)[appDelegate.window.subviews objectAtIndex:1];
[parentView addSubview:irrIPhoneView];
// ...