开发者

How to custom init an EAGLView?

In my iOS project, glView ends up with height=0 and width=0 even though CGRect frame correctly gets the screen's dimensions in the previous line.

 - (void) applicationDidFinishLaunching:(UIApplication*)application {
        CGRect frame = [[UIScreen mainScreen] bounds];

        EAGLView *glView = [EAGLView viewWithFrame:frame
                                 pixelFormat:kEAGLColorFormatRGB565
                                 depthFormat:0 
                          preserveBackbuffer:NO 
                                  sharegroup:nil 
                               multiSampling:NO 
                             numberOfSamples:0
                      ];
      }开发者_开发技巧

Is there some other way I need to create my EAGLView *glView in order for it to be init'ed properly?


You will have to add the glView to a UIWindow. Check out the app delegate code in the Cocos2D project templates.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜