Search code examples
cocos2d-iphoneuikitkobold2d

kobold2d disable full screen on orientation change


I want to include cocos2d scene besides UIKit GUI elements in my app using kobold2d library, so it should take just part of the screen.

I alter cocos2d glview size like this when initializing the first layer:

UIView * glView = [[CCDirector sharedDirector]view];
    CGRect rct = CGRectMake(100, 100, 300, 400);

    [glView setFrame:rct];

The view is displayed properly until I change orientation, then glview again becomes fullscreen. Is there a way to disable this behaviour?

XCode 4.5.2, iOS 6, Kobold2D 2.04


Solution

  • Calling reshape after setting the frame might help:

    UIView * glView = [[CCDirector sharedDirector]view];
    CGRect rct = CGRectMake(100, 100, 300, 400);
    
    [glView setFrame:rct];
    [glView reshape];