sgl
changeset 40:f7de32814f34 tip
sortof made the ios backend to compile and run ... sortof
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 28 Jun 2012 03:42:26 +0300 |
parents | e1a27aa24956 |
children | |
files | include/sgl.h isimple/isimple-Info.plist isimple/isimple.c sgl.xcodeproj/project.pbxproj sgl.xcodeproj/project.xcworkspace/xcuserdata/nuclear.xcuserdatad/UserInterfaceState.xcuserstate sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/isimple.xcscheme sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/sgl.xcscheme sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/xcschememanagement.plist src/wsys_ios.m tests/simple/simple.c |
diffstat | 10 files changed, 432 insertions(+), 34 deletions(-) [+] |
line diff
1.1 --- a/include/sgl.h Wed Jun 27 05:54:57 2012 +0300 1.2 +++ b/include/sgl.h Thu Jun 28 03:42:26 2012 +0300 1.3 @@ -1,6 +1,26 @@ 1.4 #ifndef SGL_H_ 1.5 #define SGL_H_ 1.6 1.7 +#ifdef __APPLE__ 1.8 +#include <TargetConditionals.h> 1.9 + 1.10 +#if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR) 1.11 +#include <OpenGLES/ES2/gl.h> 1.12 +#else /* !iphone */ 1.13 +#include <OpenGL/gl.h> 1.14 +#endif /* iphone/isim */ 1.15 + 1.16 +#else 1.17 +/* !__APPLE__ */ 1.18 +#ifdef WIN32 1.19 +#include <windows.h> 1.20 +#endif /* WIN32 */ 1.21 + 1.22 +#include <GL/gl.h> 1.23 +#endif /* __APPLE__ */ 1.24 + 1.25 + 1.26 + 1.27 #define SGL_DOUBLE 1 1.28 #define SGL_DEPTH 2 1.29 #define SGL_STENCIL 4
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/isimple/isimple-Info.plist Thu Jun 28 03:42:26 2012 +0300 2.3 @@ -0,0 +1,47 @@ 2.4 +<?xml version="1.0" encoding="UTF-8"?> 2.5 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 2.6 +<plist version="1.0"> 2.7 +<dict> 2.8 + <key>CFBundleDevelopmentRegion</key> 2.9 + <string>en</string> 2.10 + <key>CFBundleDisplayName</key> 2.11 + <string>${PRODUCT_NAME}</string> 2.12 + <key>CFBundleExecutable</key> 2.13 + <string>${EXECUTABLE_NAME}</string> 2.14 + <key>CFBundleIdentifier</key> 2.15 + <string>Mutant-Stargoat.${PRODUCT_NAME:rfc1034identifier}</string> 2.16 + <key>CFBundleInfoDictionaryVersion</key> 2.17 + <string>6.0</string> 2.18 + <key>CFBundleName</key> 2.19 + <string>${PRODUCT_NAME}</string> 2.20 + <key>CFBundlePackageType</key> 2.21 + <string>APPL</string> 2.22 + <key>CFBundleShortVersionString</key> 2.23 + <string>1.0</string> 2.24 + <key>CFBundleSignature</key> 2.25 + <string>????</string> 2.26 + <key>CFBundleVersion</key> 2.27 + <string>1.0</string> 2.28 + <key>LSRequiresIPhoneOS</key> 2.29 + <true/> 2.30 + <key>UIRequiredDeviceCapabilities</key> 2.31 + <array> 2.32 + <string>armv7</string> 2.33 + </array> 2.34 + <key>UIStatusBarHidden</key> 2.35 + <true/> 2.36 + <key>UISupportedInterfaceOrientations</key> 2.37 + <array> 2.38 + <string>UIInterfaceOrientationPortrait</string> 2.39 + <string>UIInterfaceOrientationLandscapeLeft</string> 2.40 + <string>UIInterfaceOrientationLandscapeRight</string> 2.41 + </array> 2.42 + <key>UISupportedInterfaceOrientations~ipad</key> 2.43 + <array> 2.44 + <string>UIInterfaceOrientationPortrait</string> 2.45 + <string>UIInterfaceOrientationPortraitUpsideDown</string> 2.46 + <string>UIInterfaceOrientationLandscapeLeft</string> 2.47 + <string>UIInterfaceOrientationLandscapeRight</string> 2.48 + </array> 2.49 +</dict> 2.50 +</plist>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/isimple/isimple.c Thu Jun 28 03:42:26 2012 +0300 3.3 @@ -0,0 +1,84 @@ 3.4 +#include <stdio.h> 3.5 +#include <ctype.h> 3.6 +#include "sgl.h" 3.7 + 3.8 +void disp(void); 3.9 +void reshape(int x, int y); 3.10 +void keyb(int key, int state); 3.11 +void mouse(int pidx, int bn, int state, int x, int y); 3.12 +void motion(int pidx, int x, int y); 3.13 + 3.14 + 3.15 +int main(void) 3.16 +{ 3.17 + if(sgl_init() == -1) { 3.18 + return 1; 3.19 + } 3.20 + 3.21 + sgl_create_window(640, 480, SGL_DOUBLE | SGL_DEPTH); 3.22 + 3.23 + sgl_display_callback(disp); 3.24 + sgl_reshape_callback(reshape); 3.25 + sgl_keyboard_callback(keyb); 3.26 + sgl_mouse_callback(mouse); 3.27 + sgl_motion_callback(motion); 3.28 + 3.29 + sgl_event_loop(); 3.30 + sgl_quit(); 3.31 + return 0; 3.32 +} 3.33 + 3.34 + 3.35 +void disp(void) 3.36 +{ 3.37 + sgl_log("redisplay\n"); 3.38 + 3.39 + glClearColor(0.2, 0.2, 0.2, 1); 3.40 + glClear(GL_COLOR_BUFFER_BIT); 3.41 + 3.42 +#ifndef GL_ES_VERSION_2_0 3.43 + glBegin(GL_QUADS); 3.44 + glColor3f(1, 0, 0); 3.45 + glVertex2f(-1, -1); 3.46 + glColor3f(0, 1, 0); 3.47 + glVertex2f(1, -1); 3.48 + glColor3f(0, 0, 1); 3.49 + glVertex2f(1, 1); 3.50 + glColor3f(1, 1, 0); 3.51 + glVertex2f(-1, 1); 3.52 + glEnd(); 3.53 +#endif 3.54 + 3.55 + sgl_swap_buffers(); 3.56 +} 3.57 + 3.58 +void reshape(int x, int y) 3.59 +{ 3.60 + printf("reshape: %dx%d\n", x, y); 3.61 + glViewport(0, 0, x, y); 3.62 +} 3.63 + 3.64 +void keyb(int key, int state) 3.65 +{ 3.66 + char *ststr = state ? "pressed" : "released"; 3.67 + 3.68 + if(key < 0xff && isprint(key)) { 3.69 + sgl_log("keyboard: '%c' %s\n", (char)key, ststr); 3.70 + } else { 3.71 + sgl_log("keyboard: %x %s\n", key, ststr); 3.72 + } 3.73 + 3.74 + if(key == 27) { 3.75 + sgl_quit(); 3.76 + } 3.77 +} 3.78 + 3.79 +void mouse(int pidx, int bn, int state, int x, int y) 3.80 +{ 3.81 + printf("mouse: button%d %s (ptr: %d %d)\n", bn, state ? "pressed" : "released", x, y); 3.82 +} 3.83 + 3.84 +void motion(int pidx, int x, int y) 3.85 +{ 3.86 + printf("mouse dragged to: (%d %d)\n", x, y); 3.87 +}
4.1 --- a/sgl.xcodeproj/project.pbxproj Wed Jun 27 05:54:57 2012 +0300 4.2 +++ b/sgl.xcodeproj/project.pbxproj Thu Jun 28 03:42:26 2012 +0300 4.3 @@ -7,12 +7,20 @@ 4.4 objects = { 4.5 4.6 /* Begin PBXBuildFile section */ 4.7 - 06C7522B159AA36B006C47C6 /* ios_init.h in Headers */ = {isa = PBXBuildFile; fileRef = 06C75229159AA36A006C47C6 /* ios_init.h */; }; 4.8 - 06C7522C159AA36B006C47C6 /* ios_init.m in Sources */ = {isa = PBXBuildFile; fileRef = 06C7522A159AA36A006C47C6 /* ios_init.m */; }; 4.9 + 06C75232159BA81F006C47C6 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06C75231159BA81F006C47C6 /* OpenGLES.framework */; }; 4.10 + 06C75234159BA849006C47C6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06C75233159BA849006C47C6 /* UIKit.framework */; }; 4.11 + 06E2EF2A159BDA5300E169B6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06C75233159BA849006C47C6 /* UIKit.framework */; }; 4.12 + 06E2EF2B159BDA5300E169B6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06F9D62414F7332500246CD7 /* Foundation.framework */; }; 4.13 + 06E2EF2D159BDA5300E169B6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06E2EF2C159BDA5300E169B6 /* CoreGraphics.framework */; }; 4.14 + 06E2EF2F159BDA5300E169B6 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06E2EF2E159BDA5300E169B6 /* GLKit.framework */; }; 4.15 + 06E2EF30159BDA5300E169B6 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06C75231159BA81F006C47C6 /* OpenGLES.framework */; }; 4.16 + 06E2EF36159BDA5300E169B6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 06E2EF34159BDA5300E169B6 /* InfoPlist.strings */; }; 4.17 + 06E2EF4E159BDAAE00E169B6 /* isimple.c in Sources */ = {isa = PBXBuildFile; fileRef = 06E2EF4D159BDAAE00E169B6 /* isimple.c */; }; 4.18 + 06E2EF4F159BDAFC00E169B6 /* libsgl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 06F9D62114F7332500246CD7 /* libsgl.a */; }; 4.19 + 06E2EF52159BDF2D00E169B6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06E2EF51159BDF2D00E169B6 /* QuartzCore.framework */; }; 4.20 06F9D62514F7332500246CD7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06F9D62414F7332500246CD7 /* Foundation.framework */; }; 4.21 06F9D63514F7453B00246CD7 /* sgl.h in Headers */ = {isa = PBXBuildFile; fileRef = 06F9D63414F7453B00246CD7 /* sgl.h */; }; 4.22 06F9D65714F7456100246CD7 /* cb.c in Sources */ = {isa = PBXBuildFile; fileRef = 06F9D63714F7456100246CD7 /* cb.c */; }; 4.23 - 06F9D65A14F7456100246CD7 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 06F9D63A14F7456100246CD7 /* config.h */; }; 4.24 06F9D65B14F7456100246CD7 /* log.c in Sources */ = {isa = PBXBuildFile; fileRef = 06F9D63B14F7456100246CD7 /* log.c */; }; 4.25 06F9D65D14F7456100246CD7 /* log.h in Headers */ = {isa = PBXBuildFile; fileRef = 06F9D63D14F7456100246CD7 /* log.h */; }; 4.26 06F9D66214F7456100246CD7 /* sgl.c in Sources */ = {isa = PBXBuildFile; fileRef = 06F9D64214F7456100246CD7 /* sgl.c */; }; 4.27 @@ -22,13 +30,19 @@ 4.28 /* End PBXBuildFile section */ 4.29 4.30 /* Begin PBXFileReference section */ 4.31 - 06C75229159AA36A006C47C6 /* ios_init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios_init.h; sourceTree = "<group>"; }; 4.32 - 06C7522A159AA36A006C47C6 /* ios_init.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ios_init.m; sourceTree = "<group>"; }; 4.33 + 06C75231159BA81F006C47C6 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; 4.34 + 06C75233159BA849006C47C6 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 4.35 + 06E2EF28159BDA5300E169B6 /* isimple.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = isimple.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4.36 + 06E2EF2C159BDA5300E169B6 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 4.37 + 06E2EF2E159BDA5300E169B6 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; 4.38 + 06E2EF33159BDA5300E169B6 /* isimple-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "isimple-Info.plist"; sourceTree = "<group>"; }; 4.39 + 06E2EF35159BDA5300E169B6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 4.40 + 06E2EF4D159BDAAE00E169B6 /* isimple.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = isimple.c; sourceTree = "<group>"; }; 4.41 + 06E2EF51159BDF2D00E169B6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 4.42 06F9D62114F7332500246CD7 /* libsgl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libsgl.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4.43 06F9D62414F7332500246CD7 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 4.44 06F9D63414F7453B00246CD7 /* sgl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sgl.h; sourceTree = "<group>"; }; 4.45 06F9D63714F7456100246CD7 /* cb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cb.c; sourceTree = "<group>"; }; 4.46 - 06F9D63A14F7456100246CD7 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; }; 4.47 06F9D63B14F7456100246CD7 /* log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = log.c; sourceTree = "<group>"; }; 4.48 06F9D63D14F7456100246CD7 /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = "<group>"; }; 4.49 06F9D64214F7456100246CD7 /* sgl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sgl.c; sourceTree = "<group>"; }; 4.50 @@ -38,10 +52,26 @@ 4.51 /* End PBXFileReference section */ 4.52 4.53 /* Begin PBXFrameworksBuildPhase section */ 4.54 + 06E2EF25159BDA5300E169B6 /* Frameworks */ = { 4.55 + isa = PBXFrameworksBuildPhase; 4.56 + buildActionMask = 2147483647; 4.57 + files = ( 4.58 + 06E2EF52159BDF2D00E169B6 /* QuartzCore.framework in Frameworks */, 4.59 + 06E2EF4F159BDAFC00E169B6 /* libsgl.a in Frameworks */, 4.60 + 06E2EF2A159BDA5300E169B6 /* UIKit.framework in Frameworks */, 4.61 + 06E2EF2B159BDA5300E169B6 /* Foundation.framework in Frameworks */, 4.62 + 06E2EF2D159BDA5300E169B6 /* CoreGraphics.framework in Frameworks */, 4.63 + 06E2EF2F159BDA5300E169B6 /* GLKit.framework in Frameworks */, 4.64 + 06E2EF30159BDA5300E169B6 /* OpenGLES.framework in Frameworks */, 4.65 + ); 4.66 + runOnlyForDeploymentPostprocessing = 0; 4.67 + }; 4.68 06F9D61E14F7332500246CD7 /* Frameworks */ = { 4.69 isa = PBXFrameworksBuildPhase; 4.70 buildActionMask = 2147483647; 4.71 files = ( 4.72 + 06C75234159BA849006C47C6 /* UIKit.framework in Frameworks */, 4.73 + 06C75232159BA81F006C47C6 /* OpenGLES.framework in Frameworks */, 4.74 06F9D62514F7332500246CD7 /* Foundation.framework in Frameworks */, 4.75 ); 4.76 runOnlyForDeploymentPostprocessing = 0; 4.77 @@ -49,11 +79,30 @@ 4.78 /* End PBXFrameworksBuildPhase section */ 4.79 4.80 /* Begin PBXGroup section */ 4.81 + 06E2EF31159BDA5300E169B6 /* isimple */ = { 4.82 + isa = PBXGroup; 4.83 + children = ( 4.84 + 06E2EF32159BDA5300E169B6 /* Supporting Files */, 4.85 + 06E2EF4D159BDAAE00E169B6 /* isimple.c */, 4.86 + ); 4.87 + path = isimple; 4.88 + sourceTree = "<group>"; 4.89 + }; 4.90 + 06E2EF32159BDA5300E169B6 /* Supporting Files */ = { 4.91 + isa = PBXGroup; 4.92 + children = ( 4.93 + 06E2EF33159BDA5300E169B6 /* isimple-Info.plist */, 4.94 + 06E2EF34159BDA5300E169B6 /* InfoPlist.strings */, 4.95 + ); 4.96 + name = "Supporting Files"; 4.97 + sourceTree = "<group>"; 4.98 + }; 4.99 06F9D61614F7332500246CD7 = { 4.100 isa = PBXGroup; 4.101 children = ( 4.102 06F9D63614F7456100246CD7 /* src */, 4.103 06F9D63314F7453B00246CD7 /* include */, 4.104 + 06E2EF31159BDA5300E169B6 /* isimple */, 4.105 06F9D62314F7332500246CD7 /* Frameworks */, 4.106 06F9D62214F7332500246CD7 /* Products */, 4.107 ); 4.108 @@ -63,6 +112,7 @@ 4.109 isa = PBXGroup; 4.110 children = ( 4.111 06F9D62114F7332500246CD7 /* libsgl.a */, 4.112 + 06E2EF28159BDA5300E169B6 /* isimple.app */, 4.113 ); 4.114 name = Products; 4.115 sourceTree = "<group>"; 4.116 @@ -70,7 +120,12 @@ 4.117 06F9D62314F7332500246CD7 /* Frameworks */ = { 4.118 isa = PBXGroup; 4.119 children = ( 4.120 + 06E2EF51159BDF2D00E169B6 /* QuartzCore.framework */, 4.121 + 06C75233159BA849006C47C6 /* UIKit.framework */, 4.122 + 06C75231159BA81F006C47C6 /* OpenGLES.framework */, 4.123 06F9D62414F7332500246CD7 /* Foundation.framework */, 4.124 + 06E2EF2C159BDA5300E169B6 /* CoreGraphics.framework */, 4.125 + 06E2EF2E159BDA5300E169B6 /* GLKit.framework */, 4.126 ); 4.127 name = Frameworks; 4.128 sourceTree = "<group>"; 4.129 @@ -86,11 +141,8 @@ 4.130 06F9D63614F7456100246CD7 /* src */ = { 4.131 isa = PBXGroup; 4.132 children = ( 4.133 - 06C75229159AA36A006C47C6 /* ios_init.h */, 4.134 - 06C7522A159AA36A006C47C6 /* ios_init.m */, 4.135 06F9D67714F88B1300246CD7 /* wsys_ios.m */, 4.136 06F9D63714F7456100246CD7 /* cb.c */, 4.137 - 06F9D63A14F7456100246CD7 /* config.h */, 4.138 06F9D63B14F7456100246CD7 /* log.c */, 4.139 06F9D63D14F7456100246CD7 /* log.h */, 4.140 06F9D64214F7456100246CD7 /* sgl.c */, 4.141 @@ -108,16 +160,31 @@ 4.142 buildActionMask = 2147483647; 4.143 files = ( 4.144 06F9D63514F7453B00246CD7 /* sgl.h in Headers */, 4.145 - 06F9D65A14F7456100246CD7 /* config.h in Headers */, 4.146 06F9D65D14F7456100246CD7 /* log.h in Headers */, 4.147 06F9D66714F7456100246CD7 /* wsys.h in Headers */, 4.148 - 06C7522B159AA36B006C47C6 /* ios_init.h in Headers */, 4.149 ); 4.150 runOnlyForDeploymentPostprocessing = 0; 4.151 }; 4.152 /* End PBXHeadersBuildPhase section */ 4.153 4.154 /* Begin PBXNativeTarget section */ 4.155 + 06E2EF27159BDA5300E169B6 /* isimple */ = { 4.156 + isa = PBXNativeTarget; 4.157 + buildConfigurationList = 06E2EF4A159BDA5300E169B6 /* Build configuration list for PBXNativeTarget "isimple" */; 4.158 + buildPhases = ( 4.159 + 06E2EF24159BDA5300E169B6 /* Sources */, 4.160 + 06E2EF25159BDA5300E169B6 /* Frameworks */, 4.161 + 06E2EF26159BDA5300E169B6 /* Resources */, 4.162 + ); 4.163 + buildRules = ( 4.164 + ); 4.165 + dependencies = ( 4.166 + ); 4.167 + name = isimple; 4.168 + productName = isimple; 4.169 + productReference = 06E2EF28159BDA5300E169B6 /* isimple.app */; 4.170 + productType = "com.apple.product-type.application"; 4.171 + }; 4.172 06F9D62014F7332500246CD7 /* sgl */ = { 4.173 isa = PBXNativeTarget; 4.174 buildConfigurationList = 06F9D62E14F7332500246CD7 /* Build configuration list for PBXNativeTarget "sgl" */; 4.175 @@ -156,11 +223,31 @@ 4.176 projectRoot = ""; 4.177 targets = ( 4.178 06F9D62014F7332500246CD7 /* sgl */, 4.179 + 06E2EF27159BDA5300E169B6 /* isimple */, 4.180 ); 4.181 }; 4.182 /* End PBXProject section */ 4.183 4.184 +/* Begin PBXResourcesBuildPhase section */ 4.185 + 06E2EF26159BDA5300E169B6 /* Resources */ = { 4.186 + isa = PBXResourcesBuildPhase; 4.187 + buildActionMask = 2147483647; 4.188 + files = ( 4.189 + 06E2EF36159BDA5300E169B6 /* InfoPlist.strings in Resources */, 4.190 + ); 4.191 + runOnlyForDeploymentPostprocessing = 0; 4.192 + }; 4.193 +/* End PBXResourcesBuildPhase section */ 4.194 + 4.195 /* Begin PBXSourcesBuildPhase section */ 4.196 + 06E2EF24159BDA5300E169B6 /* Sources */ = { 4.197 + isa = PBXSourcesBuildPhase; 4.198 + buildActionMask = 2147483647; 4.199 + files = ( 4.200 + 06E2EF4E159BDAAE00E169B6 /* isimple.c in Sources */, 4.201 + ); 4.202 + runOnlyForDeploymentPostprocessing = 0; 4.203 + }; 4.204 06F9D61D14F7332500246CD7 /* Sources */ = { 4.205 isa = PBXSourcesBuildPhase; 4.206 buildActionMask = 2147483647; 4.207 @@ -170,32 +257,77 @@ 4.208 06F9D66214F7456100246CD7 /* sgl.c in Sources */, 4.209 06F9D66514F7456100246CD7 /* wsys.c in Sources */, 4.210 06F9D67814F88B1300246CD7 /* wsys_ios.m in Sources */, 4.211 - 06C7522C159AA36B006C47C6 /* ios_init.m in Sources */, 4.212 ); 4.213 runOnlyForDeploymentPostprocessing = 0; 4.214 }; 4.215 /* End PBXSourcesBuildPhase section */ 4.216 4.217 +/* Begin PBXVariantGroup section */ 4.218 + 06E2EF34159BDA5300E169B6 /* InfoPlist.strings */ = { 4.219 + isa = PBXVariantGroup; 4.220 + children = ( 4.221 + 06E2EF35159BDA5300E169B6 /* en */, 4.222 + ); 4.223 + name = InfoPlist.strings; 4.224 + sourceTree = "<group>"; 4.225 + }; 4.226 +/* End PBXVariantGroup section */ 4.227 + 4.228 /* Begin XCBuildConfiguration section */ 4.229 + 06E2EF4B159BDA5300E169B6 /* Debug */ = { 4.230 + isa = XCBuildConfiguration; 4.231 + buildSettings = { 4.232 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 4.233 + GCC_PRECOMPILE_PREFIX_HEADER = NO; 4.234 + GCC_PREFIX_HEADER = ""; 4.235 + GCC_PREPROCESSOR_DEFINITIONS = ( 4.236 + "DEBUG=1", 4.237 + "$(inherited)", 4.238 + ); 4.239 + "GCC_THUMB_SUPPORT[arch=armv6]" = ""; 4.240 + GCC_WARN_UNINITIALIZED_AUTOS = YES; 4.241 + INFOPLIST_FILE = "isimple/isimple-Info.plist"; 4.242 + IPHONEOS_DEPLOYMENT_TARGET = 5.1; 4.243 + PRODUCT_NAME = "$(TARGET_NAME)"; 4.244 + TARGETED_DEVICE_FAMILY = "1,2"; 4.245 + WRAPPER_EXTENSION = app; 4.246 + }; 4.247 + name = Debug; 4.248 + }; 4.249 + 06E2EF4C159BDA5300E169B6 /* Release */ = { 4.250 + isa = XCBuildConfiguration; 4.251 + buildSettings = { 4.252 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 4.253 + GCC_PRECOMPILE_PREFIX_HEADER = NO; 4.254 + GCC_PREFIX_HEADER = ""; 4.255 + "GCC_THUMB_SUPPORT[arch=armv6]" = ""; 4.256 + GCC_WARN_UNINITIALIZED_AUTOS = YES; 4.257 + INFOPLIST_FILE = "isimple/isimple-Info.plist"; 4.258 + IPHONEOS_DEPLOYMENT_TARGET = 5.1; 4.259 + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 4.260 + PRODUCT_NAME = "$(TARGET_NAME)"; 4.261 + TARGETED_DEVICE_FAMILY = "1,2"; 4.262 + WRAPPER_EXTENSION = app; 4.263 + }; 4.264 + name = Release; 4.265 + }; 4.266 06F9D62C14F7332500246CD7 /* Debug */ = { 4.267 isa = XCBuildConfiguration; 4.268 buildSettings = { 4.269 ALWAYS_SEARCH_USER_PATHS = NO; 4.270 ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 4.271 COPY_PHASE_STRIP = NO; 4.272 - GCC_C_LANGUAGE_STANDARD = gnu99; 4.273 + GCC_C_LANGUAGE_STANDARD = c89; 4.274 GCC_DYNAMIC_NO_PIC = NO; 4.275 GCC_OPTIMIZATION_LEVEL = 0; 4.276 - GCC_PREPROCESSOR_DEFINITIONS = ( 4.277 - "DEBUG=1", 4.278 - "$(inherited)", 4.279 - ); 4.280 + GCC_PREPROCESSOR_DEFINITIONS = USE_WSYS_MODULE_IOS; 4.281 + "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "DEBUG=1"; 4.282 GCC_SYMBOLS_PRIVATE_EXTERN = NO; 4.283 GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 4.284 GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 4.285 GCC_WARN_ABOUT_RETURN_TYPE = YES; 4.286 GCC_WARN_UNUSED_VARIABLE = YES; 4.287 - IPHONEOS_DEPLOYMENT_TARGET = 5.0; 4.288 + IPHONEOS_DEPLOYMENT_TARGET = 4.1; 4.289 SDKROOT = iphoneos; 4.290 }; 4.291 name = Debug; 4.292 @@ -206,12 +338,13 @@ 4.293 ALWAYS_SEARCH_USER_PATHS = NO; 4.294 ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 4.295 COPY_PHASE_STRIP = YES; 4.296 - GCC_C_LANGUAGE_STANDARD = gnu99; 4.297 + GCC_C_LANGUAGE_STANDARD = c89; 4.298 + GCC_PREPROCESSOR_DEFINITIONS = USE_WSYS_MODULE_IOS; 4.299 GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 4.300 GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 4.301 GCC_WARN_ABOUT_RETURN_TYPE = YES; 4.302 GCC_WARN_UNUSED_VARIABLE = YES; 4.303 - IPHONEOS_DEPLOYMENT_TARGET = 5.0; 4.304 + IPHONEOS_DEPLOYMENT_TARGET = 4.1; 4.305 SDKROOT = iphoneos; 4.306 VALIDATE_PRODUCT = YES; 4.307 }; 4.308 @@ -221,8 +354,13 @@ 4.309 isa = XCBuildConfiguration; 4.310 buildSettings = { 4.311 DSTROOT = /tmp/sgl.dst; 4.312 + GCC_C_LANGUAGE_STANDARD = gnu99; 4.313 GCC_PRECOMPILE_PREFIX_HEADER = NO; 4.314 GCC_PREFIX_HEADER = ""; 4.315 + GCC_PREPROCESSOR_DEFINITIONS = ( 4.316 + USE_WSYS_MODULE_IOS, 4.317 + XCODE_BUILD, 4.318 + ); 4.319 OTHER_LDFLAGS = "-ObjC"; 4.320 PRODUCT_NAME = "$(TARGET_NAME)"; 4.321 SKIP_INSTALL = YES; 4.322 @@ -233,8 +371,13 @@ 4.323 isa = XCBuildConfiguration; 4.324 buildSettings = { 4.325 DSTROOT = /tmp/sgl.dst; 4.326 + GCC_C_LANGUAGE_STANDARD = gnu99; 4.327 GCC_PRECOMPILE_PREFIX_HEADER = NO; 4.328 GCC_PREFIX_HEADER = ""; 4.329 + GCC_PREPROCESSOR_DEFINITIONS = ( 4.330 + USE_WSYS_MODULE_IOS, 4.331 + XCODE_BUILD, 4.332 + ); 4.333 OTHER_LDFLAGS = "-ObjC"; 4.334 PRODUCT_NAME = "$(TARGET_NAME)"; 4.335 SKIP_INSTALL = YES; 4.336 @@ -244,6 +387,14 @@ 4.337 /* End XCBuildConfiguration section */ 4.338 4.339 /* Begin XCConfigurationList section */ 4.340 + 06E2EF4A159BDA5300E169B6 /* Build configuration list for PBXNativeTarget "isimple" */ = { 4.341 + isa = XCConfigurationList; 4.342 + buildConfigurations = ( 4.343 + 06E2EF4B159BDA5300E169B6 /* Debug */, 4.344 + 06E2EF4C159BDA5300E169B6 /* Release */, 4.345 + ); 4.346 + defaultConfigurationIsVisible = 0; 4.347 + }; 4.348 06F9D61B14F7332500246CD7 /* Build configuration list for PBXProject "sgl" */ = { 4.349 isa = XCConfigurationList; 4.350 buildConfigurations = (
5.1 Binary file sgl.xcodeproj/project.xcworkspace/xcuserdata/nuclear.xcuserdatad/UserInterfaceState.xcuserstate has changed
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/isimple.xcscheme Thu Jun 28 03:42:26 2012 +0300 6.3 @@ -0,0 +1,85 @@ 6.4 +<?xml version="1.0" encoding="UTF-8"?> 6.5 +<Scheme 6.6 + version = "1.3"> 6.7 + <BuildAction 6.8 + parallelizeBuildables = "YES" 6.9 + buildImplicitDependencies = "YES"> 6.10 + <BuildActionEntries> 6.11 + <BuildActionEntry 6.12 + buildForTesting = "YES" 6.13 + buildForRunning = "YES" 6.14 + buildForProfiling = "YES" 6.15 + buildForArchiving = "YES" 6.16 + buildForAnalyzing = "YES"> 6.17 + <BuildableReference 6.18 + BuildableIdentifier = "primary" 6.19 + BlueprintIdentifier = "06E2EF27159BDA5300E169B6" 6.20 + BuildableName = "isimple.app" 6.21 + BlueprintName = "isimple" 6.22 + ReferencedContainer = "container:sgl.xcodeproj"> 6.23 + </BuildableReference> 6.24 + </BuildActionEntry> 6.25 + </BuildActionEntries> 6.26 + </BuildAction> 6.27 + <TestAction 6.28 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 6.29 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 6.30 + shouldUseLaunchSchemeArgsEnv = "YES" 6.31 + buildConfiguration = "Debug"> 6.32 + <Testables> 6.33 + </Testables> 6.34 + <MacroExpansion> 6.35 + <BuildableReference 6.36 + BuildableIdentifier = "primary" 6.37 + BlueprintIdentifier = "06E2EF27159BDA5300E169B6" 6.38 + BuildableName = "isimple.app" 6.39 + BlueprintName = "isimple" 6.40 + ReferencedContainer = "container:sgl.xcodeproj"> 6.41 + </BuildableReference> 6.42 + </MacroExpansion> 6.43 + </TestAction> 6.44 + <LaunchAction 6.45 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 6.46 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 6.47 + launchStyle = "0" 6.48 + useCustomWorkingDirectory = "NO" 6.49 + buildConfiguration = "Debug" 6.50 + ignoresPersistentStateOnLaunch = "NO" 6.51 + debugDocumentVersioning = "YES" 6.52 + allowLocationSimulation = "YES"> 6.53 + <BuildableProductRunnable> 6.54 + <BuildableReference 6.55 + BuildableIdentifier = "primary" 6.56 + BlueprintIdentifier = "06E2EF27159BDA5300E169B6" 6.57 + BuildableName = "isimple.app" 6.58 + BlueprintName = "isimple" 6.59 + ReferencedContainer = "container:sgl.xcodeproj"> 6.60 + </BuildableReference> 6.61 + </BuildableProductRunnable> 6.62 + <AdditionalOptions> 6.63 + </AdditionalOptions> 6.64 + </LaunchAction> 6.65 + <ProfileAction 6.66 + shouldUseLaunchSchemeArgsEnv = "YES" 6.67 + savedToolIdentifier = "" 6.68 + useCustomWorkingDirectory = "NO" 6.69 + buildConfiguration = "Release" 6.70 + debugDocumentVersioning = "YES"> 6.71 + <BuildableProductRunnable> 6.72 + <BuildableReference 6.73 + BuildableIdentifier = "primary" 6.74 + BlueprintIdentifier = "06E2EF27159BDA5300E169B6" 6.75 + BuildableName = "isimple.app" 6.76 + BlueprintName = "isimple" 6.77 + ReferencedContainer = "container:sgl.xcodeproj"> 6.78 + </BuildableReference> 6.79 + </BuildableProductRunnable> 6.80 + </ProfileAction> 6.81 + <AnalyzeAction 6.82 + buildConfiguration = "Debug"> 6.83 + </AnalyzeAction> 6.84 + <ArchiveAction 6.85 + buildConfiguration = "Release" 6.86 + revealArchiveInOrganizer = "YES"> 6.87 + </ArchiveAction> 6.88 +</Scheme>
7.1 --- a/sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/sgl.xcscheme Wed Jun 27 05:54:57 2012 +0300 7.2 +++ b/sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/sgl.xcscheme Thu Jun 28 03:42:26 2012 +0300 7.3 @@ -32,7 +32,7 @@ 7.4 </TestAction> 7.5 <LaunchAction 7.6 selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 7.7 - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" 7.8 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 7.9 launchStyle = "0" 7.10 useCustomWorkingDirectory = "NO" 7.11 buildConfiguration = "Debug"
8.1 --- a/sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/xcschememanagement.plist Wed Jun 27 05:54:57 2012 +0300 8.2 +++ b/sgl.xcodeproj/xcuserdata/nuclear.xcuserdatad/xcschemes/xcschememanagement.plist Thu Jun 28 03:42:26 2012 +0300 8.3 @@ -4,6 +4,11 @@ 8.4 <dict> 8.5 <key>SchemeUserState</key> 8.6 <dict> 8.7 + <key>isimple.xcscheme</key> 8.8 + <dict> 8.9 + <key>orderHint</key> 8.10 + <integer>2</integer> 8.11 + </dict> 8.12 <key>sgl.xcscheme</key> 8.13 <dict> 8.14 <key>orderHint</key> 8.15 @@ -12,6 +17,11 @@ 8.16 </dict> 8.17 <key>SuppressBuildableAutocreation</key> 8.18 <dict> 8.19 + <key>06E2EF27159BDA5300E169B6</key> 8.20 + <dict> 8.21 + <key>primary</key> 8.22 + <true/> 8.23 + </dict> 8.24 <key>06F9D62014F7332500246CD7</key> 8.25 <dict> 8.26 <key>primary</key>
9.1 --- a/src/wsys_ios.m Wed Jun 27 05:54:57 2012 +0300 9.2 +++ b/src/wsys_ios.m Thu Jun 28 03:42:26 2012 +0300 9.3 @@ -1,8 +1,6 @@ 9.4 /* SimplyGL window system module for iOS */ 9.5 /* mac-framework: -framework UIKit */ 9.6 9.7 -#include "config.h" 9.8 - 9.9 #ifdef USE_WSYS_MODULE_IOS 9.10 9.11 #include <assert.h> 9.12 @@ -10,6 +8,8 @@ 9.13 #import <QuartzCore/QuartzCore.h> 9.14 #include <OpenGLES/ES2/gl.h> 9.15 #include <OpenGLES/ES2/glext.h> 9.16 +#include "sgl.h" 9.17 +#include "wsys.h" 9.18 9.19 @interface SGLView : UIView { 9.20 @private 9.21 @@ -35,6 +35,7 @@ 9.22 SGLView *view; 9.23 } 9.24 9.25 + 9.26 @property (nonatomic, retain) IBOutlet UIWindow *win; 9.27 @property (nonatomic, retain) IBOutlet SGLView *view; 9.28 @end 9.29 @@ -333,7 +334,13 @@ 9.30 9.31 static int process_events(void) 9.32 { 9.33 - return -1; 9.34 + char *argv[] = {"foobar", 0}; 9.35 + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 9.36 + 9.37 + int res = UIApplicationMain(1, argv, 0, @"SGLDelegate"); 9.38 + 9.39 + [pool release]; 9.40 + return res; 9.41 } 9.42 9.43 9.44 @@ -363,7 +370,7 @@ 9.45 9.46 void sgl_modules_init(void) 9.47 { 9.48 - sgl_register_uikit(); 9.49 + sgl_register_ios(); 9.50 } 9.51 9.52 #endif /* XCODE_BUILD */
10.1 --- a/tests/simple/simple.c Wed Jun 27 05:54:57 2012 +0300 10.2 +++ b/tests/simple/simple.c Thu Jun 28 03:42:26 2012 +0300 10.3 @@ -1,19 +1,11 @@ 10.4 #include <stdio.h> 10.5 #include <ctype.h> 10.6 -#ifdef WIN32 10.7 -#include <windows.h> 10.8 -#endif /* WIN32 */ 10.9 -#ifndef __APPLE__ 10.10 -#include <GL/gl.h> 10.11 -#else 10.12 -#include <OpenGL/gl.h> 10.13 -#endif 10.14 #include "sgl.h" 10.15 10.16 void disp(void); 10.17 void reshape(int x, int y); 10.18 void keyb(int key, int state); 10.19 -void mouse(int pidx, int bn, int state, int x, int y); 10.20 +void mouse(int pidx, int bn, int state, int x, int y) 10.21 void motion(int pidx, int x, int y); 10.22 10.23 10.24 @@ -44,6 +36,7 @@ 10.25 glClearColor(0.2, 0.2, 0.2, 1); 10.26 glClear(GL_COLOR_BUFFER_BIT); 10.27 10.28 +#ifndef GL_ES_VERSION_2_0 10.29 glBegin(GL_QUADS); 10.30 glColor3f(1, 0, 0); 10.31 glVertex2f(-1, -1); 10.32 @@ -54,6 +47,7 @@ 10.33 glColor3f(1, 1, 0); 10.34 glVertex2f(-1, 1); 10.35 glEnd(); 10.36 +#endif 10.37 10.38 sgl_swap_buffers(); 10.39 }