1

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?

genpfault
  • 51,148
  • 11
  • 85
  • 139
wiseindy
  • 19,434
  • 5
  • 27
  • 38

1 Answers1

2

You could try to add your view directly to the top window

[[[UIApplication sharedApplication] keyWindow] addSubview:myView];
kamidude
  • 1,301
  • 8
  • 13