Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

Navigating to an OpenGL window

I have an app that uses a navigation controller to navigate through screens allowing the user to choose from a list of games. When the user taps a game, I'd like it to open an OpenGL window and launch the game. I have an app with the navigation controller working correctly. And I have a separate app with a single OpenGL window working correctly. But I can't seem to combine the two together. Can someone point me in the right direction?

Replies

  • tetrisleetetrislee Posts: 21New Users
    #import "CocosController.h"
    #import "SomeScene.h"
    #import "cocos2d.h"

    @implementation CocosController

    @synthesize window;

    // Implement loadView to create a view hierarchy programmatically, without using a nib.
    - (void)loadView {
    // Initialization code
    CC_DIRECTOR_INIT();
    CCDirector *director = [CCDirector sharedDirector];

    //landscape
    [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
    [director setDisplayFPS:true];

    //turn on multi-touch
    EAGLView *cocosView = [director openGLView];
    [cocosView setMultipleTouchEnabled:true];

    self.view = cocosView;

    //default texture formats...
    [CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];

    [[CCDirector sharedDirector] runWithScene:[SomeScene scene]];
    }

    - (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [[CCDirector sharedDirector] purgeCachedData];
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
    }

    - (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    }


    - (void)dealloc {
    [[CCDirector sharedDirector] release];
    [window release];
    [super dealloc];
    }


    @end

    Thanks!!!
Sign In or Register to comment.