Commits

twistedjoe  committed ec8728f

Moved the ios AppDelegate, EAGLView, And ViewController to RedBox, also changed the bundle id from net.anhero... to com.yourcompany....

  • Participants
  • Parent commits d61282c

Comments (0)

Files changed (8)

File ide/ios/RedBoxApp.xcodeproj/project.pbxproj

 		511276D812FF02FE008EAB02 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 511276D712FF02FE008EAB02 /* QuartzCore.framework */; };
 		511276DA12FF02FE008EAB02 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 511276D912FF02FE008EAB02 /* OpenGLES.framework */; };
 		512AD25113C62F54009D9324 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512AD25013C62F54009D9324 /* main.cpp */; };
-		514E76DE13C654B20024ADAB /* EAGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 514E76D813C654B20024ADAB /* EAGLView.h */; };
-		514E76DF13C654B20024ADAB /* EAGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 514E76D913C654B20024ADAB /* EAGLView.m */; };
-		514E76E013C654B20024ADAB /* RedBoxAppAppDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 514E76DA13C654B20024ADAB /* RedBoxAppAppDelegate.h */; };
-		514E76E113C654B20024ADAB /* RedBoxAppAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 514E76DB13C654B20024ADAB /* RedBoxAppAppDelegate.m */; };
-		514E76E213C654B20024ADAB /* RedBoxAppViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 514E76DC13C654B20024ADAB /* RedBoxAppViewController.h */; };
-		514E76E313C654B20024ADAB /* RedBoxAppViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 514E76DD13C654B20024ADAB /* RedBoxAppViewController.m */; };
 		51578C821301BEAB009862CE /* libRedBox.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 515EB55412FF3C12004FB469 /* libRedBox.a */; };
+		51C1F0DB13C66ACB00C2269A /* RedBoxApp-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 51C1F0DA13C66ACB00C2269A /* RedBoxApp-Info.plist */; };
 		51C96A59132D459000A9B088 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51C96A58132D459000A9B088 /* OpenAL.framework */; };
-		51DA4B9613C6522500EE1031 /* RedBoxApp-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 51DA4B9513C6522500EE1031 /* RedBoxApp-Info.plist */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
 		511276D912FF02FE008EAB02 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
 		5112773A12FF2011008EAB02 /* RedBox.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RedBox.xcodeproj; path = redbox/ide/Xcode/RedBox.xcodeproj; sourceTree = "<group>"; };
 		512AD25013C62F54009D9324 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
-		514E76D813C654B20024ADAB /* EAGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EAGLView.h; sourceTree = "<group>"; };
-		514E76D913C654B20024ADAB /* EAGLView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EAGLView.m; sourceTree = "<group>"; };
-		514E76DA13C654B20024ADAB /* RedBoxAppAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RedBoxAppAppDelegate.h; sourceTree = "<group>"; };
-		514E76DB13C654B20024ADAB /* RedBoxAppAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RedBoxAppAppDelegate.m; sourceTree = "<group>"; };
-		514E76DC13C654B20024ADAB /* RedBoxAppViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RedBoxAppViewController.h; sourceTree = "<group>"; };
-		514E76DD13C654B20024ADAB /* RedBoxAppViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RedBoxAppViewController.m; sourceTree = "<group>"; };
+		51C1F0DA13C66ACB00C2269A /* RedBoxApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "RedBoxApp-Info.plist"; sourceTree = "<group>"; };
 		51C96A56132D457100A9B088 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
 		51C96A58132D459000A9B088 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
-		51DA4B9513C6522500EE1031 /* RedBoxApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "RedBoxApp-Info.plist"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
 		51DA4B9413C6522500EE1031 /* ios */ = {
 			isa = PBXGroup;
 			children = (
-				514E76D813C654B20024ADAB /* EAGLView.h */,
-				514E76D913C654B20024ADAB /* EAGLView.m */,
-				514E76DA13C654B20024ADAB /* RedBoxAppAppDelegate.h */,
-				514E76DB13C654B20024ADAB /* RedBoxAppAppDelegate.m */,
-				514E76DC13C654B20024ADAB /* RedBoxAppViewController.h */,
-				514E76DD13C654B20024ADAB /* RedBoxAppViewController.m */,
-				51DA4B9513C6522500EE1031 /* RedBoxApp-Info.plist */,
+				51C1F0DA13C66ACB00C2269A /* RedBoxApp-Info.plist */,
 			);
 			path = ios;
 			sourceTree = "<group>";
 			isa = PBXHeadersBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				514E76DE13C654B20024ADAB /* EAGLView.h in Headers */,
-				514E76E013C654B20024ADAB /* RedBoxAppAppDelegate.h in Headers */,
-				514E76E213C654B20024ADAB /* RedBoxAppViewController.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				51DA4B9613C6522500EE1031 /* RedBoxApp-Info.plist in Resources */,
+				51C1F0DB13C66ACB00C2269A /* RedBoxApp-Info.plist in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 			buildActionMask = 2147483647;
 			files = (
 				512AD25113C62F54009D9324 /* main.cpp in Sources */,
-				514E76DF13C654B20024ADAB /* EAGLView.m in Sources */,
-				514E76E113C654B20024ADAB /* RedBoxAppAppDelegate.m in Sources */,
-				514E76E313C654B20024ADAB /* RedBoxAppViewController.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

File platform/ios/EAGLView.h

-#import <UIKit/UIKit.h>
-
-#import <OpenGLES/ES1/gl.h>
-#import <OpenGLES/ES1/glext.h>
-#import <OpenGLES/ES2/gl.h>
-#import <OpenGLES/ES2/glext.h>
-
-@class EAGLContext;
-
-// This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
-// The view content is basically an EAGL surface you render your OpenGL scene into.
-// Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
-@interface EAGLView : UIView {
-@private
-    // The pixel dimensions of the CAEAGLLayer.
-    GLint framebufferWidth;
-    GLint framebufferHeight;
-    
-    // The OpenGL ES names for the framebuffer and renderbuffer used to render to this view.
-    GLuint defaultFramebuffer, colorRenderbuffer;
-}
-
-@property (nonatomic, retain) EAGLContext *context;
-
-- (void)setFramebuffer;
-- (BOOL)presentFramebuffer;
-
-@end

File platform/ios/EAGLView.m

-#import <QuartzCore/QuartzCore.h>
-
-#import "EAGLView.h"
-
-#include <RedBox/IOSPointer.h>
-
-@interface EAGLView (PrivateMethods)
-- (void)createFramebuffer;
-- (void)deleteFramebuffer;
-@end
-
-@implementation EAGLView
-
-@synthesize context;
-
-// You must implement this method
-+ (Class)layerClass
-{
-    return [CAEAGLLayer class];
-}
-
-//The EAGL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:.
-- (id)initWithFrame:(CGRect)frame
-{
-    self = [super initWithFrame:frame];
-	if (self) {
-        CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
-        
-        eaglLayer.opaque = TRUE;
-        eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
-                                        [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking,
-                                        kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat,
-                                        nil];
-    }
-    
-    return self;
-}
-
-- (void)dealloc
-{
-    [self deleteFramebuffer];    
-    [context release];
-    
-    [super dealloc];
-}
-
-- (void)setContext:(EAGLContext *)newContext
-{
-    if (context != newContext) {
-        [self deleteFramebuffer];
-        
-        [context release];
-        context = [newContext retain];
-        
-        [EAGLContext setCurrentContext:nil];
-    }
-}
-
-- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
-	RedBox::IOSPointer::touchBegin.shoot(touches, event);
-} 
-
-- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
-	RedBox::IOSPointer::touchEnd.shoot(touches, event);
-}
-
-- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
-	RedBox::IOSPointer::touchMove.shoot(touches, event);
-}
-
-- (void)createFramebuffer
-{
-    if (context && !defaultFramebuffer) {
-        [EAGLContext setCurrentContext:context];
-        
-        // Create default framebuffer object.
-        glGenFramebuffers(1, &defaultFramebuffer);
-        glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
-        
-        // Create color render buffer and allocate backing store.
-        glGenRenderbuffers(1, &colorRenderbuffer);
-        glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
-        [context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer *)self.layer];
-        glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &framebufferWidth);
-        glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &framebufferHeight);
-        
-        glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer);
-        
-        if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
-            NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));
-    }
-}
-
-- (void)deleteFramebuffer
-{
-    if (context) {
-        [EAGLContext setCurrentContext:context];
-        
-        if (defaultFramebuffer) {
-            glDeleteFramebuffers(1, &defaultFramebuffer);
-            defaultFramebuffer = 0;
-        }
-        
-        if (colorRenderbuffer) {
-            glDeleteRenderbuffers(1, &colorRenderbuffer);
-            colorRenderbuffer = 0;
-        }
-    }
-}
-
-- (void)setFramebuffer
-{
-    if (context) {
-        [EAGLContext setCurrentContext:context];
-        
-        if (!defaultFramebuffer)
-            [self createFramebuffer];
-        
-        glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
-        
-        glViewport(0, 0, framebufferWidth, framebufferHeight);
-    }
-}
-
-- (BOOL)presentFramebuffer
-{
-    BOOL success = FALSE;
-    
-    if (context) {
-        [EAGLContext setCurrentContext:context];
-        
-        glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
-        
-        success = [context presentRenderbuffer:GL_RENDERBUFFER];
-    }
-    
-    return success;
-}
-
-- (void)layoutSubviews
-{
-    // The framebuffer will be re-created at the beginning of the next setFramebuffer method call.
-    [self deleteFramebuffer];
-}
-
-@end

File platform/ios/RedBoxApp-Info.plist

 	<key>CFBundleIconFile</key>
 	<string></string>
 	<key>CFBundleIdentifier</key>
-	<string>net.anhero.${PRODUCT_NAME:rfc1034identifier}</string>
+	<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleName</key>

File platform/ios/RedBoxAppAppDelegate.h

-#import <UIKit/UIKit.h>
-
-@class RedBoxAppViewController;
-
-@interface RedBoxAppAppDelegate : NSObject <UIApplicationDelegate> {
-@private
-
-}
-
-@property (nonatomic, retain) IBOutlet UIWindow *window;
-
-@property (nonatomic, retain) IBOutlet RedBoxAppViewController *viewController;
-
-@end

File platform/ios/RedBoxAppAppDelegate.m

-#import "RedBoxAppAppDelegate.h"
-
-#import "EAGLView.h"
-
-#import "RedBoxAppViewController.h"
-#include <RedBox.h>
-#include <RedBox/GraphicDriver.h>
-@implementation RedBoxAppAppDelegate
-
-
-@synthesize window;
-
-@synthesize viewController;
-
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
-{
-	CGRect screenBounds = [[UIScreen mainScreen] bounds];
-    self.window = [[[UIWindow alloc] initWithFrame: screenBounds] autorelease];
-    
-    self.viewController = [[[RedBoxAppViewController alloc] initWithFrame:screenBounds] autorelease];
-    self.window.rootViewController = self.viewController;
-    [window addSubview:viewController.view];
-    [window makeKeyAndVisible];
-    RedBox::GraphicDriver::initializeGraphicDriver(RedBox::Engine::getScreenWidth(), RedBox::Engine::getScreenHeight());
-    return YES;
-}
-
-- (void)applicationWillResignActive:(UIApplication *)application
-{
-	/*
-	 Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
-	 Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
-	 */
-	[self.viewController stopAnimation];
-}
-
-- (void)applicationWillTerminate:(UIApplication *)application
-{
-	// Save data if appropriate.
-	[self.viewController stopAnimation];
-}
-
-- (void)dealloc {
-
-	[window release];
-	[viewController release];
-    [super dealloc];
-}
-
-- (void)applicationDidBecomeActive:(UIApplication *)application
-{
-	[self.viewController startAnimation];
-}
-
-@end

File platform/ios/RedBoxAppViewController.h

-#import <UIKit/UIKit.h>
-
-#import <OpenGLES/EAGL.h>
-
-#import <OpenGLES/ES1/gl.h>
-#import <OpenGLES/ES1/glext.h>
-#import <OpenGLES/ES2/gl.h>
-#import <OpenGLES/ES2/glext.h>
-
-@interface RedBoxAppViewController : UIViewController {
-@private
-    EAGLContext *context;
-    GLuint program;
-    
-    BOOL animating;
-    NSInteger animationFrameInterval;
-    CADisplayLink *displayLink;
-}
-
-@property (readonly, nonatomic, getter=isAnimating) BOOL animating;
-@property (nonatomic) NSInteger animationFrameInterval;
-
-- (void)startAnimation;
-- (void)stopAnimation;
-
-@end

File platform/ios/RedBoxAppViewController.m

-#import <QuartzCore/QuartzCore.h>
-
-#import "RedBoxAppViewController.h"
-#import "EAGLView.h"
-#include <RedBox.h>
-
-
-@interface RedBoxAppViewController ()
-@property (nonatomic, retain) EAGLContext *context;
-@property (nonatomic, assign) CADisplayLink *displayLink;
-@end
-
-@implementation RedBoxAppViewController
-
-@synthesize animating, context, displayLink;
-
-- (id)initWithFrame:(CGRect)frame
-{
-    self.view = [[[EAGLView alloc] initWithFrame:frame] autorelease];
-    //self.view.clipsToBounds = YES;
-    
-    EAGLContext *aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
-    
-   
-    if (!aContext)
-        NSLog(@"Failed to create ES context");
-    else if (![EAGLContext setCurrentContext:aContext])
-        NSLog(@"Failed to set ES context current");
-    
-	self.context = aContext;
-	[aContext release];
-	
-    [(EAGLView *)self.view setContext:context];
-    [(EAGLView *)self.view setFramebuffer];
- 
-    animating = FALSE;
-    animationFrameInterval = 1;
-    self.displayLink = nil;
-    return self;
-}
-
-- (void)dealloc
-{
-	// Tear down context.
-    if ([EAGLContext currentContext] == context)
-        [EAGLContext setCurrentContext:nil];
-    
-    [context release];
-    
-    [super dealloc];
-}
-
-- (void)didReceiveMemoryWarning
-{
-    // Releases the view if it doesn't have a superview.
-    [super didReceiveMemoryWarning];
-    
-    // Release any cached data, images, etc. that aren't in use.
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
-    [self startAnimation];
-    
-    [super viewWillAppear:animated];
-}
-
-- (void)viewWillDisappear:(BOOL)animated
-{
-    [self stopAnimation];
-    
-    [super viewWillDisappear:animated];
-}
-
-- (void)viewDidUnload
-{
-	[super viewDidUnload];
-	
-    // Tear down context.
-    if ([EAGLContext currentContext] == context)
-        [EAGLContext setCurrentContext:nil];
-	self.context = nil;	
-}
-
-- (NSInteger)animationFrameInterval
-{
-    return animationFrameInterval;
-}
-
-- (void)setAnimationFrameInterval:(NSInteger)frameInterval
-{
-    /*
-	 Frame interval defines how many display frames must pass between each time the display link fires.
-	 The display link will only fire 30 times a second when the frame internal is two on a display that refreshes 60 times a second. The default frame interval setting of one will fire 60 times a second when the display refreshes at 60 times a second. A frame interval setting of less than one results in undefined behavior.
-	 */
-    if (frameInterval >= 1) {
-        animationFrameInterval = frameInterval;
-        
-        if (animating) {
-            [self stopAnimation];
-            [self startAnimation];
-        }
-    }
-}
-
-- (void)startAnimation
-{
-    if (!animating) {
-        CADisplayLink *aDisplayLink = [[UIScreen mainScreen] displayLinkWithTarget:self selector:@selector(drawFrame)];
-        [aDisplayLink setFrameInterval:animationFrameInterval];
-        [aDisplayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
-        self.displayLink = aDisplayLink;
-        
-        animating = TRUE;
-    }
-}
-
-- (void)stopAnimation
-{
-    if (animating) {
-        [self.displayLink invalidate];
-        self.displayLink = nil;
-        animating = FALSE;
-    }
-}
-
-- (void)drawFrame
-{
-    [(EAGLView *)self.view setFramebuffer];
-	RedBox::Engine::pulse();
-    [(EAGLView *)self.view presentFramebuffer];
-}
-
-@end