我正在尝试使用 Cocos2d 构建 iPhone 应用程序。但是我使用了四种类型的类
就像下面这样-
@interface MenuScene : Scene {}
@end
@interface FlipView : UIImageView
{
CGPoint startTouchPosition;
NSString *dirString;
UIImageView *firstPieceView;
UIImageView *secondPieceView;
}
@end
@interface HelloController : UIViewController
@end
@interface MenuLayer: Layer{
Todo *todo;
Menu * menu;
sqlite3 *database;
NSMutableArray *todos;
NSString *dirString;
CGPoint startTouchPosition;
}
@property (nonatomic, retain) NSMutableArray *todos;
-(void) button1: (id)sender;
-(void) button2: (id)sender;
-(void) black_jack: (id)sender;
@end
但我如何通过 MenuLayer 类显示 FlipView 和 HelloController 类。
如果您询问如何将 UIKit 视图等附加到 cocos2d-iphone 项目,您只需这样做:
[[[Director sharedDirector] window] addSubview:myView];
更新到 cocos 0.7 现在是:
[[[Director sharedDirector] openGLView] addSubview:myView];
而在 Cocos 0.99 中:
[[[CCDirector sharedDirector] openGLView] addSubview:myView];
而在 Cocos 2.0 中
[[[CCDirector sharedDirector] view] addSubview:myView];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)