# HG changeset patch # User John Tsiombikas # Date 1340844146 -10800 # Node ID f7de32814f343818babe2af8221f2a00e851e2d5 # Parent e1a27aa2495636a6458f85b4eca454f2157852b4 sortof made the ios backend to compile and run ... sortof diff -r e1a27aa24956 -r f7de32814f34 include/sgl.h --- a/include/sgl.h Wed Jun 27 05:54:57 2012 +0300 +++ b/include/sgl.h Thu Jun 28 03:42:26 2012 +0300 @@ -1,6 +1,26 @@ #ifndef SGL_H_ #define SGL_H_ +#ifdef __APPLE__ +#include + +#if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR) +#include +#else /* !iphone */ +#include +#endif /* iphone/isim */ + +#else +/* !__APPLE__ */ +#ifdef WIN32 +#include +#endif /* WIN32 */ + +#include +#endif /* __APPLE__ */ + + + #define SGL_DOUBLE 1 #define SGL_DEPTH 2 #define SGL_STENCIL 4 diff -r e1a27aa24956 -r f7de32814f34 isimple/isimple-Info.plist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/isimple/isimple-Info.plist Thu Jun 28 03:42:26 2012 +0300 @@ -0,0 +1,47 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + Mutant-Stargoat.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UIStatusBarHidden + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff -r e1a27aa24956 -r f7de32814f34 isimple/isimple.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/isimple/isimple.c Thu Jun 28 03:42:26 2012 +0300 @@ -0,0 +1,84 @@ +#include +#include +#include "sgl.h" + +void disp(void); +void reshape(int x, int y); +void keyb(int key, int state); +void mouse(int pidx, int bn, int state, int x, int y); +void motion(int pidx, int x, int y); + + +int main(void) +{ + if(sgl_init() == -1) { + return 1; + } + + sgl_create_window(640, 480, SGL_DOUBLE | SGL_DEPTH); + + sgl_display_callback(disp); + sgl_reshape_callback(reshape); + sgl_keyboard_callback(keyb); + sgl_mouse_callback(mouse); + sgl_motion_callback(motion); + + sgl_event_loop(); + sgl_quit(); + return 0; +} + + +void disp(void) +{ + sgl_log("redisplay\n"); + + glClearColor(0.2, 0.2, 0.2, 1); + glClear(GL_COLOR_BUFFER_BIT); + +#ifndef GL_ES_VERSION_2_0 + glBegin(GL_QUADS); + glColor3f(1, 0, 0); + glVertex2f(-1, -1); + glColor3f(0, 1, 0); + glVertex2f(1, -1); + glColor3f(0, 0, 1); + glVertex2f(1, 1); + glColor3f(1, 1, 0); + glVertex2f(-1, 1); + glEnd(); +#endif + + sgl_swap_buffers(); +} + +void reshape(int x, int y) +{ + printf("reshape: %dx%d\n", x, y); + glViewport(0, 0, x, y); +} + +void keyb(int key, int state) +{ + char *ststr = state ? "pressed" : "released"; + + if(key < 0xff && isprint(key)) { + sgl_log("keyboard: '%c' %s\n", (char)key, ststr); + } else { + sgl_log("keyboard: %x %s\n", key, ststr); + } + + if(key == 27) { + sgl_quit(); + } +} + +void mouse(int pidx, int bn, int state, int x, int y) +{ + printf("mouse: button%d %s (ptr: %d %d)\n", bn, state ? "pressed" : "released", x, y); +} + +void motion(int pidx, int x, int y) +{ + printf("mouse dragged to: (%d %d)\n", x, y); +} diff -r e1a27aa24956 -r f7de32814f34 sgl.xcodeproj/project.pbxproj --- a/sgl.xcodeproj/project.pbxproj Wed Jun 27 05:54:57 2012 +0300 +++ b/sgl.xcodeproj/project.pbxproj Thu Jun 28 03:42:26 2012 +0300 @@ -7,12 +7,20 @@ 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 */; }; + 06C75232159BA81F006C47C6 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06C75231159BA81F006C47C6 /* OpenGLES.framework */; }; + 06C75234159BA849006C47C6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06C75233159BA849006C47C6 /* UIKit.framework */; }; + 06E2EF2A159BDA5300E169B6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06C75233159BA849006C47C6 /* UIKit.framework */; }; + 06E2EF2B159BDA5300E169B6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06F9D62414F7332500246CD7 /* Foundation.framework */; }; + 06E2EF2D159BDA5300E169B6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06E2EF2C159BDA5300E169B6 /* CoreGraphics.framework */; }; + 06E2EF2F159BDA5300E169B6 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06E2EF2E159BDA5300E169B6 /* GLKit.framework */; }; + 06E2EF30159BDA5300E169B6 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06C75231159BA81F006C47C6 /* OpenGLES.framework */; }; + 06E2EF36159BDA5300E169B6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 06E2EF34159BDA5300E169B6 /* InfoPlist.strings */; }; + 06E2EF4E159BDAAE00E169B6 /* isimple.c in Sources */ = {isa = PBXBuildFile; fileRef = 06E2EF4D159BDAAE00E169B6 /* isimple.c */; }; + 06E2EF4F159BDAFC00E169B6 /* libsgl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 06F9D62114F7332500246CD7 /* libsgl.a */; }; + 06E2EF52159BDF2D00E169B6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06E2EF51159BDF2D00E169B6 /* QuartzCore.framework */; }; 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 */; }; @@ -22,13 +30,19 @@ /* 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 = ""; }; + 06C75231159BA81F006C47C6 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + 06C75233159BA849006C47C6 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 06E2EF28159BDA5300E169B6 /* isimple.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = isimple.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 06E2EF2C159BDA5300E169B6 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 06E2EF2E159BDA5300E169B6 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; + 06E2EF33159BDA5300E169B6 /* isimple-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "isimple-Info.plist"; sourceTree = ""; }; + 06E2EF35159BDA5300E169B6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 06E2EF4D159BDAAE00E169B6 /* isimple.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = isimple.c; sourceTree = ""; }; + 06E2EF51159BDF2D00E169B6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 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 = ""; }; @@ -38,10 +52,26 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 06E2EF25159BDA5300E169B6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 06E2EF52159BDF2D00E169B6 /* QuartzCore.framework in Frameworks */, + 06E2EF4F159BDAFC00E169B6 /* libsgl.a in Frameworks */, + 06E2EF2A159BDA5300E169B6 /* UIKit.framework in Frameworks */, + 06E2EF2B159BDA5300E169B6 /* Foundation.framework in Frameworks */, + 06E2EF2D159BDA5300E169B6 /* CoreGraphics.framework in Frameworks */, + 06E2EF2F159BDA5300E169B6 /* GLKit.framework in Frameworks */, + 06E2EF30159BDA5300E169B6 /* OpenGLES.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 06F9D61E14F7332500246CD7 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 06C75234159BA849006C47C6 /* UIKit.framework in Frameworks */, + 06C75232159BA81F006C47C6 /* OpenGLES.framework in Frameworks */, 06F9D62514F7332500246CD7 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -49,11 +79,30 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 06E2EF31159BDA5300E169B6 /* isimple */ = { + isa = PBXGroup; + children = ( + 06E2EF32159BDA5300E169B6 /* Supporting Files */, + 06E2EF4D159BDAAE00E169B6 /* isimple.c */, + ); + path = isimple; + sourceTree = ""; + }; + 06E2EF32159BDA5300E169B6 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 06E2EF33159BDA5300E169B6 /* isimple-Info.plist */, + 06E2EF34159BDA5300E169B6 /* InfoPlist.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; 06F9D61614F7332500246CD7 = { isa = PBXGroup; children = ( 06F9D63614F7456100246CD7 /* src */, 06F9D63314F7453B00246CD7 /* include */, + 06E2EF31159BDA5300E169B6 /* isimple */, 06F9D62314F7332500246CD7 /* Frameworks */, 06F9D62214F7332500246CD7 /* Products */, ); @@ -63,6 +112,7 @@ isa = PBXGroup; children = ( 06F9D62114F7332500246CD7 /* libsgl.a */, + 06E2EF28159BDA5300E169B6 /* isimple.app */, ); name = Products; sourceTree = ""; @@ -70,7 +120,12 @@ 06F9D62314F7332500246CD7 /* Frameworks */ = { isa = PBXGroup; children = ( + 06E2EF51159BDF2D00E169B6 /* QuartzCore.framework */, + 06C75233159BA849006C47C6 /* UIKit.framework */, + 06C75231159BA81F006C47C6 /* OpenGLES.framework */, 06F9D62414F7332500246CD7 /* Foundation.framework */, + 06E2EF2C159BDA5300E169B6 /* CoreGraphics.framework */, + 06E2EF2E159BDA5300E169B6 /* GLKit.framework */, ); name = Frameworks; sourceTree = ""; @@ -86,11 +141,8 @@ 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 */, @@ -108,16 +160,31 @@ 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 */ + 06E2EF27159BDA5300E169B6 /* isimple */ = { + isa = PBXNativeTarget; + buildConfigurationList = 06E2EF4A159BDA5300E169B6 /* Build configuration list for PBXNativeTarget "isimple" */; + buildPhases = ( + 06E2EF24159BDA5300E169B6 /* Sources */, + 06E2EF25159BDA5300E169B6 /* Frameworks */, + 06E2EF26159BDA5300E169B6 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = isimple; + productName = isimple; + productReference = 06E2EF28159BDA5300E169B6 /* isimple.app */; + productType = "com.apple.product-type.application"; + }; 06F9D62014F7332500246CD7 /* sgl */ = { isa = PBXNativeTarget; buildConfigurationList = 06F9D62E14F7332500246CD7 /* Build configuration list for PBXNativeTarget "sgl" */; @@ -156,11 +223,31 @@ projectRoot = ""; targets = ( 06F9D62014F7332500246CD7 /* sgl */, + 06E2EF27159BDA5300E169B6 /* isimple */, ); }; /* End PBXProject section */ +/* Begin PBXResourcesBuildPhase section */ + 06E2EF26159BDA5300E169B6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 06E2EF36159BDA5300E169B6 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ + 06E2EF24159BDA5300E169B6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 06E2EF4E159BDAAE00E169B6 /* isimple.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 06F9D61D14F7332500246CD7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -170,32 +257,77 @@ 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 PBXVariantGroup section */ + 06E2EF34159BDA5300E169B6 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 06E2EF35159BDA5300E169B6 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ + 06E2EF4B159BDA5300E169B6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + "GCC_THUMB_SUPPORT[arch=armv6]" = ""; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + INFOPLIST_FILE = "isimple/isimple-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 06E2EF4C159BDA5300E169B6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + "GCC_THUMB_SUPPORT[arch=armv6]" = ""; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + INFOPLIST_FILE = "isimple/isimple-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; 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_C_LANGUAGE_STANDARD = c89; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); + GCC_PREPROCESSOR_DEFINITIONS = USE_WSYS_MODULE_IOS; + "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "DEBUG=1"; 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; + IPHONEOS_DEPLOYMENT_TARGET = 4.1; SDKROOT = iphoneos; }; name = Debug; @@ -206,12 +338,13 @@ ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_32_BIT)"; COPY_PHASE_STRIP = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_C_LANGUAGE_STANDARD = c89; + GCC_PREPROCESSOR_DEFINITIONS = USE_WSYS_MODULE_IOS; 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; + IPHONEOS_DEPLOYMENT_TARGET = 4.1; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; @@ -221,8 +354,13 @@ isa = XCBuildConfiguration; buildSettings = { DSTROOT = /tmp/sgl.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + USE_WSYS_MODULE_IOS, + XCODE_BUILD, + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -233,8 +371,13 @@ isa = XCBuildConfiguration; buildSettings = { DSTROOT = /tmp/sgl.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + USE_WSYS_MODULE_IOS, + XCODE_BUILD, + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -244,6 +387,14 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 06E2EF4A159BDA5300E169B6 /* Build configuration list for PBXNativeTarget "isimple" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 06E2EF4B159BDA5300E169B6 /* Debug */, + 06E2EF4C159BDA5300E169B6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; 06F9D61B14F7332500246CD7 /* Build configuration list for PBXProject "sgl" */ = { isa = XCConfigurationList; buildConfigurations = ( diff -r e1a27aa24956 -r f7de32814f34 sgl.xcodeproj/project.xcworkspace/xcuserdata/nuclear.xcuserdatad/UserInterfaceState.xcuserstate Binary file sgl.xcodeproj/project.xcworkspace/xcuserdata/nuclear.xcuserdatad/UserInterfaceState.xcuserstate has changed diff -r e1a27aa24956 -r f7de32814f34 sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/isimple.xcscheme --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/isimple.xcscheme Thu Jun 28 03:42:26 2012 +0300 @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r e1a27aa24956 -r f7de32814f34 sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/sgl.xcscheme --- a/sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/sgl.xcscheme Wed Jun 27 05:54:57 2012 +0300 +++ b/sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/sgl.xcscheme Thu Jun 28 03:42:26 2012 +0300 @@ -32,7 +32,7 @@ SchemeUserState + isimple.xcscheme + + orderHint + 2 + sgl.xcscheme orderHint @@ -12,6 +17,11 @@ SuppressBuildableAutocreation + 06E2EF27159BDA5300E169B6 + + primary + + 06F9D62014F7332500246CD7 primary diff -r e1a27aa24956 -r f7de32814f34 src/wsys_ios.m --- a/src/wsys_ios.m Wed Jun 27 05:54:57 2012 +0300 +++ b/src/wsys_ios.m Thu Jun 28 03:42:26 2012 +0300 @@ -1,8 +1,6 @@ /* SimplyGL window system module for iOS */ /* mac-framework: -framework UIKit */ -#include "config.h" - #ifdef USE_WSYS_MODULE_IOS #include @@ -10,6 +8,8 @@ #import #include #include +#include "sgl.h" +#include "wsys.h" @interface SGLView : UIView { @private @@ -35,6 +35,7 @@ SGLView *view; } + @property (nonatomic, retain) IBOutlet UIWindow *win; @property (nonatomic, retain) IBOutlet SGLView *view; @end @@ -333,7 +334,13 @@ static int process_events(void) { - return -1; + char *argv[] = {"foobar", 0}; + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + int res = UIApplicationMain(1, argv, 0, @"SGLDelegate"); + + [pool release]; + return res; } @@ -363,7 +370,7 @@ void sgl_modules_init(void) { - sgl_register_uikit(); + sgl_register_ios(); } #endif /* XCODE_BUILD */ diff -r e1a27aa24956 -r f7de32814f34 tests/simple/simple.c --- a/tests/simple/simple.c Wed Jun 27 05:54:57 2012 +0300 +++ b/tests/simple/simple.c Thu Jun 28 03:42:26 2012 +0300 @@ -1,19 +1,11 @@ #include #include -#ifdef WIN32 -#include -#endif /* WIN32 */ -#ifndef __APPLE__ -#include -#else -#include -#endif #include "sgl.h" void disp(void); void reshape(int x, int y); void keyb(int key, int state); -void mouse(int pidx, int bn, int state, int x, int y); +void mouse(int pidx, int bn, int state, int x, int y) void motion(int pidx, int x, int y); @@ -44,6 +36,7 @@ glClearColor(0.2, 0.2, 0.2, 1); glClear(GL_COLOR_BUFFER_BIT); +#ifndef GL_ES_VERSION_2_0 glBegin(GL_QUADS); glColor3f(1, 0, 0); glVertex2f(-1, -1); @@ -54,6 +47,7 @@ glColor3f(1, 1, 0); glVertex2f(-1, 1); glEnd(); +#endif sgl_swap_buffers(); }