Wiki

Clone wiki

Core / Accessing Codea Runtime's GLView

To do this add a file called "RuntimeViewController.h" in the same directory as "CodeaViewController.h". Change "CodeaViewController.h" to this:

#import <UIKit/UIKit.h>
#import "RuntimeViewController.h"

@protocol CodeaAddon;

@class RuntimeViewController;

typedef enum CodeaViewMode
{
    CodeaViewModeStandard,
    CodeaViewModeFullscreen,
    CodeaViewModeFullscreenNoButtons,
} CodeaViewMode;

@interface CodeaViewController : UIViewController

@property (nonatomic, readonly) RuntimeViewController *runtime;
@property (nonatomic, assign) CodeaViewMode viewMode;
@property (nonatomic, assign) BOOL paused;

- (void) setViewMode:(CodeaViewMode)viewMode animated:(BOOL)animated;

- (void) loadProjectAtPath:(NSString*)path;

- (void) registerAddon:(id<CodeaAddon>)addon;

@end

Now change "RuntimeViewController.h" to this:

#import <GLKit/GLKit.h>

@interface RuntimeViewController : GLKViewController

@property (nonatomic, strong) EAGLContext *context;
@property (nonatomic, readonly) GLKView *glView;

@end

Now you can access the GLView like this in an add on:

self.codeaViewController.runtime.glView

Updated