Reputation: 19655
I have downloaded this source from here: https://github.com/ericjohnson/canabalt-ios It is the source code of the Canabalt game for iOS
The game is built on the Flixel engine.
I wanted to achieve a simple thing. I want to add a UIView to one of the in-game screens. How can I achieve that?
I have tried doing stuff like:
UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 120)];
[myView setBackgroundColor:[UIColor redColor]];
[self add:myView];
This, of course, throws an error saying that: Incompatible pointer types sending 'UIView \*' to parameter of type 'FlxObject \*'
I cannot find any way to "convert" a UIView
to FlxObject
. It feels like a simple requirement, but the solution has eluded me so far. I have tried reading through this Flixel library to figure out some way to do this, but found nothing.
Any help guys?
Upvotes: 1
Views: 318
Reputation: 1321
You could try to add your view directly to the top window
[[[UIApplication sharedApplication] keyWindow] addSubview:myView];
Upvotes: 2