# HG changeset patch # User John Tsiombikas # Date 1340763350 -10800 # Node ID b3374e30361cc3529654b8a92a2d364f5492d6e3 # Parent af9d2e895594b796f607898d099ed7e8a9eb11fc xcode project for uikit version, untested diff -r af9d2e895594 -r b3374e30361c .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Wed Jun 27 05:15:50 2012 +0300 @@ -0,0 +1,9 @@ +\.swp$ +\.o$ +\.d$ +config\.h$ +config\.log$ +modules\.c$ +\.a$ +\.so$ +\.dylib$ diff -r af9d2e895594 -r b3374e30361c sgl.xcodeproj/project.pbxproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sgl.xcodeproj/project.pbxproj Wed Jun 27 05:15:50 2012 +0300 @@ -0,0 +1,268 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 06C7522B159AA36B006C47C6 /* ios_init.h in Headers */ = {isa = PBXBuildFile; fileRef = 06C75229159AA36A006C47C6 /* ios_init.h */; }; + 06C7522C159AA36B006C47C6 /* ios_init.m in Sources */ = {isa = PBXBuildFile; fileRef = 06C7522A159AA36A006C47C6 /* ios_init.m */; }; + 06F9D62514F7332500246CD7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06F9D62414F7332500246CD7 /* Foundation.framework */; }; + 06F9D63514F7453B00246CD7 /* sgl.h in Headers */ = {isa = PBXBuildFile; fileRef = 06F9D63414F7453B00246CD7 /* sgl.h */; }; + 06F9D65714F7456100246CD7 /* cb.c in Sources */ = {isa = PBXBuildFile; fileRef = 06F9D63714F7456100246CD7 /* cb.c */; }; + 06F9D65A14F7456100246CD7 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 06F9D63A14F7456100246CD7 /* config.h */; }; + 06F9D65B14F7456100246CD7 /* log.c in Sources */ = {isa = PBXBuildFile; fileRef = 06F9D63B14F7456100246CD7 /* log.c */; }; + 06F9D65D14F7456100246CD7 /* log.h in Headers */ = {isa = PBXBuildFile; fileRef = 06F9D63D14F7456100246CD7 /* log.h */; }; + 06F9D66214F7456100246CD7 /* sgl.c in Sources */ = {isa = PBXBuildFile; fileRef = 06F9D64214F7456100246CD7 /* sgl.c */; }; + 06F9D66514F7456100246CD7 /* wsys.c in Sources */ = {isa = PBXBuildFile; fileRef = 06F9D64514F7456100246CD7 /* wsys.c */; }; + 06F9D66714F7456100246CD7 /* wsys.h in Headers */ = {isa = PBXBuildFile; fileRef = 06F9D64714F7456100246CD7 /* wsys.h */; }; + 06F9D67814F88B1300246CD7 /* wsys_ios.m in Sources */ = {isa = PBXBuildFile; fileRef = 06F9D67714F88B1300246CD7 /* wsys_ios.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 06C75229159AA36A006C47C6 /* ios_init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios_init.h; sourceTree = ""; }; + 06C7522A159AA36A006C47C6 /* ios_init.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ios_init.m; sourceTree = ""; }; + 06F9D62114F7332500246CD7 /* libsgl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libsgl.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 06F9D62414F7332500246CD7 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 06F9D63414F7453B00246CD7 /* sgl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sgl.h; sourceTree = ""; }; + 06F9D63714F7456100246CD7 /* cb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cb.c; sourceTree = ""; }; + 06F9D63A14F7456100246CD7 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; + 06F9D63B14F7456100246CD7 /* log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = log.c; sourceTree = ""; }; + 06F9D63D14F7456100246CD7 /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; }; + 06F9D64214F7456100246CD7 /* sgl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sgl.c; sourceTree = ""; }; + 06F9D64514F7456100246CD7 /* wsys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wsys.c; sourceTree = ""; }; + 06F9D64714F7456100246CD7 /* wsys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wsys.h; sourceTree = ""; }; + 06F9D67714F88B1300246CD7 /* wsys_ios.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = wsys_ios.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 06F9D61E14F7332500246CD7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 06F9D62514F7332500246CD7 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 06F9D61614F7332500246CD7 = { + isa = PBXGroup; + children = ( + 06F9D63614F7456100246CD7 /* src */, + 06F9D63314F7453B00246CD7 /* include */, + 06F9D62314F7332500246CD7 /* Frameworks */, + 06F9D62214F7332500246CD7 /* Products */, + ); + sourceTree = ""; + }; + 06F9D62214F7332500246CD7 /* Products */ = { + isa = PBXGroup; + children = ( + 06F9D62114F7332500246CD7 /* libsgl.a */, + ); + name = Products; + sourceTree = ""; + }; + 06F9D62314F7332500246CD7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 06F9D62414F7332500246CD7 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 06F9D63314F7453B00246CD7 /* include */ = { + isa = PBXGroup; + children = ( + 06F9D63414F7453B00246CD7 /* sgl.h */, + ); + path = include; + sourceTree = ""; + }; + 06F9D63614F7456100246CD7 /* src */ = { + isa = PBXGroup; + children = ( + 06C75229159AA36A006C47C6 /* ios_init.h */, + 06C7522A159AA36A006C47C6 /* ios_init.m */, + 06F9D67714F88B1300246CD7 /* wsys_ios.m */, + 06F9D63714F7456100246CD7 /* cb.c */, + 06F9D63A14F7456100246CD7 /* config.h */, + 06F9D63B14F7456100246CD7 /* log.c */, + 06F9D63D14F7456100246CD7 /* log.h */, + 06F9D64214F7456100246CD7 /* sgl.c */, + 06F9D64514F7456100246CD7 /* wsys.c */, + 06F9D64714F7456100246CD7 /* wsys.h */, + ); + path = src; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 06F9D61F14F7332500246CD7 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 06F9D63514F7453B00246CD7 /* sgl.h in Headers */, + 06F9D65A14F7456100246CD7 /* config.h in Headers */, + 06F9D65D14F7456100246CD7 /* log.h in Headers */, + 06F9D66714F7456100246CD7 /* wsys.h in Headers */, + 06C7522B159AA36B006C47C6 /* ios_init.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 06F9D62014F7332500246CD7 /* sgl */ = { + isa = PBXNativeTarget; + buildConfigurationList = 06F9D62E14F7332500246CD7 /* Build configuration list for PBXNativeTarget "sgl" */; + buildPhases = ( + 06F9D61D14F7332500246CD7 /* Sources */, + 06F9D61E14F7332500246CD7 /* Frameworks */, + 06F9D61F14F7332500246CD7 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = sgl; + productName = sgl; + productReference = 06F9D62114F7332500246CD7 /* libsgl.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 06F9D61814F7332500246CD7 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0430; + }; + buildConfigurationList = 06F9D61B14F7332500246CD7 /* Build configuration list for PBXProject "sgl" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 06F9D61614F7332500246CD7; + productRefGroup = 06F9D62214F7332500246CD7 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 06F9D62014F7332500246CD7 /* sgl */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 06F9D61D14F7332500246CD7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 06F9D65714F7456100246CD7 /* cb.c in Sources */, + 06F9D65B14F7456100246CD7 /* log.c in Sources */, + 06F9D66214F7456100246CD7 /* sgl.c in Sources */, + 06F9D66514F7456100246CD7 /* wsys.c in Sources */, + 06F9D67814F88B1300246CD7 /* wsys_ios.m in Sources */, + 06C7522C159AA36B006C47C6 /* ios_init.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 06F9D62C14F7332500246CD7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 06F9D62D14F7332500246CD7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 06F9D62F14F7332500246CD7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/sgl.dst; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 06F9D63014F7332500246CD7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/sgl.dst; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 06F9D61B14F7332500246CD7 /* Build configuration list for PBXProject "sgl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 06F9D62C14F7332500246CD7 /* Debug */, + 06F9D62D14F7332500246CD7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 06F9D62E14F7332500246CD7 /* Build configuration list for PBXNativeTarget "sgl" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 06F9D62F14F7332500246CD7 /* Debug */, + 06F9D63014F7332500246CD7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 06F9D61814F7332500246CD7 /* Project object */; +} diff -r af9d2e895594 -r b3374e30361c sgl.xcodeproj/project.xcworkspace/contents.xcworkspacedata --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sgl.xcodeproj/project.xcworkspace/contents.xcworkspacedata Wed Jun 27 05:15:50 2012 +0300 @@ -0,0 +1,7 @@ + + + + + diff -r af9d2e895594 -r b3374e30361c sgl.xcodeproj/project.xcworkspace/xcuserdata/nuclear.xcuserdatad/UserInterfaceState.xcuserstate Binary file sgl.xcodeproj/project.xcworkspace/xcuserdata/nuclear.xcuserdatad/UserInterfaceState.xcuserstate has changed diff -r af9d2e895594 -r b3374e30361c sgl.xcodeproj/project.xcworkspace/xcuserdata/nuclear.xcuserdatad/WorkspaceSettings.xcsettings --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sgl.xcodeproj/project.xcworkspace/xcuserdata/nuclear.xcuserdatad/WorkspaceSettings.xcsettings Wed Jun 27 05:15:50 2012 +0300 @@ -0,0 +1,20 @@ + + + + + IDEWorkspaceUserSettings_BuildLocationStyle + 0 + IDEWorkspaceUserSettings_BuildSubfolderNameStyle + 0 + IDEWorkspaceUserSettings_DerivedDataLocationStyle + 0 + IDEWorkspaceUserSettings_IssueFilterStyle + 0 + IDEWorkspaceUserSettings_LiveSourceIssuesEnabled + + IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges + + IDEWorkspaceUserSettings_SnapshotLocationStyle + 0 + + diff -r af9d2e895594 -r b3374e30361c sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/sgl.xcscheme --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/sgl.xcscheme Wed Jun 27 05:15:50 2012 +0300 @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -r af9d2e895594 -r b3374e30361c sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/xcschememanagement.plist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/xcschememanagement.plist Wed Jun 27 05:15:50 2012 +0300 @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + sgl.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 06F9D62014F7332500246CD7 + + primary + + + + + diff -r af9d2e895594 -r b3374e30361c src/ios_init.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ios_init.h Wed Jun 27 05:15:50 2012 +0300 @@ -0,0 +1,8 @@ +#import + +@interface sgl : NSObject +// XXX no need for init yet... +@end + + +void sgl_modules_init(void); \ No newline at end of file diff -r af9d2e895594 -r b3374e30361c src/ios_init.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ios_init.m Wed Jun 27 05:15:50 2012 +0300 @@ -0,0 +1,22 @@ +#import "ios_init.h" + +@implementation sgl + +- (id)init +{ + self = [super init]; + if(self) { + // Initialization code here. + } + + return self; +} + +@end + +void sgl_register_uikit(void); + +void sgl_modules_init(void) +{ + sgl_register_uikit(); +} \ No newline at end of file diff -r af9d2e895594 -r b3374e30361c src/wsys_ios.m --- a/src/wsys_ios.m Fri Feb 24 08:49:29 2012 +0200 +++ b/src/wsys_ios.m Wed Jun 27 05:15:50 2012 +0300 @@ -1,9 +1,10 @@ #include #import +#import #include #include -@interface GLView : UIView { +@interface SGLView : UIView { @private BOOL active; BOOL use_disp_link; @@ -14,22 +15,28 @@ unsigned int fbo, rbuf_color, rbuf_depth; } +@property (readonly, nonatomic, getter=isAnimating) BOOL active; +@property (nonatomic) NSInteger frame_interval; + -(void)start_anim; -(void)stop_anim; --(void)draw: (id)sender; +-(void)drawView: (id)sender; @end @interface SGLDelegate : NSObject { UIWindow *win; - GLView *view; + SGLView *view; } + +@property (nonatomic, retain) IBOutlet UIWindow *win; +@property (nonatomic, retain) IBOutlet SGLView *view; @end -@implementation GLView +@implementation SGLView -@synthesize animating; +@synthesize active; @dynamic frame_interval; +(Class)layerClass @@ -72,7 +79,7 @@ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rbuf_depth); assert(glGetError() == GL_NO_ERROR); - animating = FALSE; + active = FALSE; use_disp_link = FALSE; frame_interval = 1; disp_link = nil; @@ -82,7 +89,7 @@ // class is used as fallback when it isn't available. NSString *req_ver = @"3.1"; NSString *cur_ver = [[UIDevice currentDevice] systemVersion]; - if([curr_ver compare: req_ver options: NSNumericSearch] != NSOrderedAscending) { + if([cur_ver compare: req_ver options: NSNumericSearch] != NSOrderedAscending) { use_disp_link = TRUE; } @@ -122,13 +129,13 @@ if(active) { - [self stopAnimation]; - [self startAnimation]; + [self stop_anim]; + [self start_anim]; } } } --(void)startAnimation +-(void)start_anim { if(!active) { if(use_disp_link) { @@ -138,8 +145,8 @@ disp_link = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget: self selector: @selector(drawView:)]; - [displayLink setFrameInterval: frame_interval]; - [displayLink addToRunLoop: [NSRunLoop currentRunLoop] forMode: NSDefaultRunLoopMode]; + [disp_link setFrameInterval: frame_interval]; + [disp_link addToRunLoop: [NSRunLoop currentRunLoop] forMode: NSDefaultRunLoopMode]; } else { anim_timer = [NSTimer scheduledTimerWithTimeInterval: (NSTimeInterval)((1.0 / 60.0) * frame_interval) target: self selector: @selector(drawView:) userInfo: nil @@ -150,7 +157,7 @@ } } -- (void)stopAnimation +- (void)stop_anim { if(active) { if(use_disp_link) { @@ -179,23 +186,23 @@ -(BOOL)application: (UIApplication*)app didFinishLaunchingWithOptions: (NSDictionary*)opt { - [view startAnimation]; + [view start_anim]; return YES; } -(void)applicationWillResignActive: (UIApplication*)app { - [view stopAnimation]; + [view stop_anim]; } -(void)applicationDidBecomeActive: (UIApplication*)app { - [view startAnimation]; + [view start_anim]; } -(void)applicationWillTerminate: (UIApplication*)app { - [view stopAnimation]; + [view stop_anim]; } -(void)dealloc