Inherits from UIViewController
Declared in MainViewController.h

Overview

The main application view controller.

An instance of this controller is instantiated in the main app Storyboard. This controller loads and manages different Cocos3D scenes, through user interaction with standard UI controls. This controller supports user selection of several separate 3D scenes, and coordinates the transition between them. When the user selects a different 3D scene, the new 3D scene is created and loaded, an animated transition is run from the old 3D scene to the new, and the old scene is released and deallocated.

Since the user interface allows the same 3D scene to be repeatedly loaded and removed, background resource loading cannot be used, because GL objects must be deleted using the same GL context on which they were loaded. To ensure we don’t run into trouble when 3D scenes are removed, this controller turns background loading off so that each 3D scene is loaded in the foreground.

Properties

cc3FrameView

This generic UIView is used as a container for the CCGLView view that displays the Cocos3D (and Cocos2D) scene. Since the CCGLView is created programmatically, this view is used within the Storyboard to define the size and position of the CCGLView. Once created programmatically, the CCGLView is added as a subview of this view, and made the same size as this view.

@property (strong, nonatomic) IBOutlet UIView *cc3FrameView

Declared In

MainViewController.h

progressView

A standard activity progress view, displayed during the transition between 3D scenes, while a 3D scene is loading, or being removed.

@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *progressView

Declared In

MainViewController.h

sceneSelectorControl

The UI control for selecting the 3D scene to display.

@property (strong, nonatomic) IBOutlet UISegmentedControl *sceneSelectorControl

Declared In

MainViewController.h

Instance Methods

requestChange3DSceneFromSegmentControl:

Received from the specified segmented control to indicate that the user has selected a new 3D scene for display.

- (IBAction)requestChange3DSceneFromSegmentControl:(UISegmentedControl *)sender

Declared In

MainViewController.h