From 623ed467afc368d02d9b3d64713f1bde09f1dbb6 Mon Sep 17 00:00:00 2001 From: XProger Date: Sun, 2 Apr 2017 23:24:48 +0300 Subject: [PATCH] #23 iOS support --- src/core.h | 64 ++- src/lara.h | 4 +- src/platform/ios/AppDelegate.h | 9 + src/platform/ios/AppDelegate.mm | 38 ++ src/platform/ios/Default-568h@2x.png | Bin 0 -> 18594 bytes src/platform/ios/ViewController.h | 9 + src/platform/ios/ViewController.mm | 185 +++++++++ src/platform/ios/en.lproj/InfoPlist.strings | 2 + src/platform/ios/main.m | 9 + src/platform/ios/openlara-Info.plist | 60 +++ src/platform/ios/openlara-Prefix.pch | 10 + .../ios/openlara.xcodeproj/project.pbxproj | 375 ++++++++++++++++++ src/shader.h | 2 +- 13 files changed, 742 insertions(+), 25 deletions(-) create mode 100644 src/platform/ios/AppDelegate.h create mode 100644 src/platform/ios/AppDelegate.mm create mode 100644 src/platform/ios/Default-568h@2x.png create mode 100644 src/platform/ios/ViewController.h create mode 100644 src/platform/ios/ViewController.mm create mode 100644 src/platform/ios/en.lproj/InfoPlist.strings create mode 100644 src/platform/ios/main.m create mode 100644 src/platform/ios/openlara-Info.plist create mode 100644 src/platform/ios/openlara-Prefix.pch create mode 100644 src/platform/ios/openlara.xcodeproj/project.pbxproj diff --git a/src/core.h b/src/core.h index 71db6e9..4771418 100644 --- a/src/core.h +++ b/src/core.h @@ -48,27 +48,46 @@ #include #include #elif __APPLE__ - #include - #include - #include - #include - #include - #include + #define GL_TEXTURE_COMPARE_MODE GL_TEXTURE_COMPARE_MODE_EXT + #define GL_TEXTURE_COMPARE_FUNC GL_TEXTURE_COMPARE_FUNC_EXT + #define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_REF_TO_TEXTURE_EXT - #define GL_RGBA32F GL_RGBA - #define GL_RGBA16F GL_RGBA + #include "TargetConditionals.h" - #define GL_TEXTURE_COMPARE_MODE 0x884C - #define GL_TEXTURE_COMPARE_FUNC 0x884D - #define GL_COMPARE_REF_TO_TEXTURE 0x884E + #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR + #define MOBILE + #include + #include + #include - #define glGenVertexArrays glGenVertexArraysAPPLE - #define glDeleteVertexArrays glDeleteVertexArraysAPPLE - #define glBindVertexArray glBindVertexArrayAPPLE + #define PFNGLGENVERTEXARRAYSPROC PFNGLGENVERTEXARRAYSOESPROC + #define PFNGLDELETEVERTEXARRAYSPROC PFNGLDELETEVERTEXARRAYSOESPROC + #define PFNGLBINDVERTEXARRAYPROC PFNGLBINDVERTEXARRAYOESPROC + #define glGenVertexArrays glGenVertexArraysOES + #define glDeleteVertexArrays glDeleteVertexArraysOES + #define glBindVertexArray glBindVertexArrayOES - #define GL_PROGRAM_BINARY_LENGTH 0 - #define glGetProgramBinary(...) 0 - #define glProgramBinary(...) 0 + #define GL_STENCIL_TEST_TWO_SIDE_EXT 0 + #define glActiveStencilFaceEXT(...) + #else + #include + #include + #include + #include + #include + #include + + #define GL_RGBA32F GL_RGBA + #define GL_RGBA16F GL_RGBA + + #define glGenVertexArrays glGenVertexArraysAPPLE + #define glDeleteVertexArrays glDeleteVertexArraysAPPLE + #define glBindVertexArray glBindVertexArrayAPPLE + + #define GL_PROGRAM_BINARY_LENGTH 0 + #define glGetProgramBinary(...) 0 + #define glProgramBinary(...) 0 + #endif #elif __EMSCRIPTEN__ #define MOBILE #include @@ -178,7 +197,7 @@ PFNGLPROGRAMBINARYPROC glProgramBinary; #endif -#ifdef MOBILE +#if defined(ANDROID) || defined(__EMSCRIPTEN__) PFNGLDISCARDFRAMEBUFFEREXTPROC glDiscardFramebufferEXT; #endif @@ -272,7 +291,7 @@ namespace Core { enum Pass { passCompose, passShadow, passAmbient, passWater, passFilter, passVolume, passGUI, passMAX } pass; - GLuint FBO; + GLuint FBO, defaultFBO; struct RenderTargetCache { int count; struct Item { @@ -402,7 +421,7 @@ namespace Core { GetProcOGL(glStencilOpSeparate); #endif - #ifdef MOBILE + #if defined(ANDROID) || defined(__EMSCRIPTEN__) GetProcOGL(glDiscardFramebufferEXT); #endif @@ -416,7 +435,7 @@ namespace Core { char *ext = (char*)glGetString(GL_EXTENSIONS); //LOG("%s\n", ext); - support.shaderBinary = false;//extSupport(ext, "_program_binary"); + support.shaderBinary = extSupport(ext, "_program_binary"); support.VAO = extSupport(ext, "_vertex_array_object"); support.depthTexture = extSupport(ext, "_depth_texture"); support.shadowSampler = support.depthTexture && (extSupport(ext, "_shadow_samplers") || extSupport(ext, "GL_ARB_shadow")); @@ -460,6 +479,7 @@ namespace Core { LOG(" stencil : %s\n", support.stencil == 2 ? "separate" : (support.stencil == 1 ? "two_side" : "false")); LOG("\n"); + glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*)&defaultFBO); glGenFramebuffers(1, &FBO); memset(rtCache, 0, sizeof(rtCache)); @@ -664,7 +684,7 @@ namespace Core { return; if (!target) { - glBindFramebuffer(GL_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO); glColorMask(true, true, true, true); setViewport(int(viewportDef.x), int(viewportDef.y), int(viewportDef.z), int(viewportDef.w)); diff --git a/src/lara.h b/src/lara.h index bfc2bc6..6640267 100644 --- a/src/lara.h +++ b/src/lara.h @@ -407,7 +407,7 @@ struct Lara : Character { if (level->extra.braid > -1) braid = new Braid(this, vec3(-4.0f, 24.0f, -48.0f)); - reset(15, vec3(70067, -256, 29104), -0.68f); // level 2 (pool) +//reset(15, vec3(70067, -256, 29104), -0.68f); // level 2 (pool) #ifdef _DEBUG //reset(14, vec3(40448, 3584, 60928), PI * 0.5f, true); // gym (pool) @@ -2071,4 +2071,4 @@ struct Lara : Character { } }; -#endif \ No newline at end of file +#endif diff --git a/src/platform/ios/AppDelegate.h b/src/platform/ios/AppDelegate.h new file mode 100644 index 0000000..fb89962 --- /dev/null +++ b/src/platform/ios/AppDelegate.h @@ -0,0 +1,9 @@ +#import + +@class ViewController; + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/src/platform/ios/AppDelegate.mm b/src/platform/ios/AppDelegate.mm new file mode 100644 index 0000000..9f8349b --- /dev/null +++ b/src/platform/ios/AppDelegate.mm @@ -0,0 +1,38 @@ +#import "AppDelegate.h" +#import "ViewController.h" + +@implementation AppDelegate + +@synthesize window = _window; + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; + + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + self.window.rootViewController = [[ViewController alloc] init]; + [self.window makeKeyAndVisible]; + + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // +} + +@end diff --git a/src/platform/ios/Default-568h@2x.png b/src/platform/ios/Default-568h@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..0891b7aabfcf3422423b109c8beed2bab838c607 GIT binary patch literal 18594 zcmeI4X;f257Jx&9fS`ixvS;&$x8J@slQFSel)6zJN=?13FB7H(lQjRkSy8x_-S~tvu2gzn1oS+dLcF#eqtq$ z%tf9TTvX?`)R@}3uBI;jzS-=ZR-Td&MHaS&;!0?Ni*#$#`n*~CcQK)Q9vAQ~TUpnI!j)a2biYK^R)M~A5wUDZhx?ULMX z3x1P&qt=trOY6P2U67L=m=U?F|5#Uj(eCueNTZaHs_ceWiHeET+j+tp3Jt9g(ekqP z2WOvfR{qV+9r+o4J5?qK>7;;^+I7tGv-i)es$X_D=EoKF+S?zsyj^oRFElP}c}JT< zd8SUs-?O?}2YD#ngKbnHgzHBcboxK_2r9l(?eNCl-pEzkJm}fY?WC*jnS?VBE4EpY zO$fEejz6fU;W2Kl>JeQBZBl-%Irg`obSlg*@4QB;Dd1H7^Oi5wvt4d{RZ!8Og?^aE z)k0$1g+V3fd(gdQ3d&q2q-FL*uy#}|bc^=VhFsl0jBgUGJ+-s3U8MK9A!YJJMxpci z5hJ%|{DwV48fZn0{n5l$N_KcSb#NKE4plB`9I6Zt=Z!~-zw0{9tg$L&Ju1F0X)Cy8 zKF;(&lJ>x)Jw(=;p~sF(Sd9VWGwFE2rnyS9!f^DZ8+aCLq zQ};>lcJ1GDLqjm6Hd>|Eabno@P`~Bn(~6^aD_#yoEH(a?Nm1S<;S+hSxI5d16^<1lEM3NPFi zkqPrpL)+ zgnseFikg`gJVBha1&7C4;O6>h=dt~`ND+;Zd?W(4v2JIb7Pt>Td42%M-Ju-XAH#Pns762L}K3 zDhvsRqN0Ni(1UrishD2YvV?4*h2iFj$+&N||Fn$4n|^NSU+o?~jq`0jVQt8T9l{7b zXiwwODFh2V!Q6sqP9S>WH$oOf$N~=d0-bqTlD61!=`&0eAP-F>XN?*|gtOXX{ zQVTWyYo4ZK0GAw!GHf|pz9`D;-bbb*5LBX*{bnz|+)$@&P9|ORM2o?95{;ejvo&r- zq8cBhTN6nn)7~W>54U)%-F_-b?YKdfk5I8MHcuzBD5)!;yv#Z&R&^y=@=>VTIMy#r zX&U<=BsPkdqcMe<_}2+>H%XKyrr5ZR8_KVe>ZqYN z^=^~TFD};;rHJ$U;{~w^hYojl4hRI@SH$^K{YEo=sg)WY87r!*7blQK&qnpDo0`Vn zkl)9u9g=mCh&ZCJS(L4yN3k0kQ zuvg$h2KEEk51T+O0JQ+r0`R>g{jvqM0Mr6d3qUOZwE!?PI7HY@CE|dr sfw?Q;rAv?G4&^^8-z_>&sWXMxvD*gPOU4CBe-*@OtE+wfmVJNyHv)PfH~;_u literal 0 HcmV?d00001 diff --git a/src/platform/ios/ViewController.h b/src/platform/ios/ViewController.h new file mode 100644 index 0000000..1e7f23c --- /dev/null +++ b/src/platform/ios/ViewController.h @@ -0,0 +1,9 @@ +#import +#import + +@interface ViewController : GLKViewController +{ + NSMutableArray *m_touchList; +} + +@end diff --git a/src/platform/ios/ViewController.mm b/src/platform/ios/ViewController.mm new file mode 100644 index 0000000..881de50 --- /dev/null +++ b/src/platform/ios/ViewController.mm @@ -0,0 +1,185 @@ +#import "ViewController.h" +#include +#include +#include +#include +#include +#include "game.h" + +@interface ViewController () +@property (strong, nonatomic) EAGLContext *context; +@end + +@implementation ViewController + +@synthesize context = _context; + +#include + +char Stream::cacheDir[255]; +char Stream::contentDir[255]; + +int lastTime; + +int getTime() { + const int64_t kOneMillion = 1000 * 1000; + static mach_timebase_info_data_t info; + + if (info.denom == 0) + mach_timebase_info(&info); + + return (int)((mach_absolute_time() * info.numer) / (kOneMillion * info.denom)); +} + +#define SND_BUF_SIZE 4096 + +static AudioQueueRef audioQueue; + +void soundFill(void* inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) { + void* frames = inBuffer->mAudioData; + UInt32 count = inBuffer->mAudioDataBytesCapacity / 4; + Sound::fill((Sound::Frame*)frames, count); + inBuffer->mAudioDataByteSize = count * 4; + AudioQueueEnqueueBuffer(audioQueue, inBuffer, 0, NULL); +} + +void soundInit() { + AudioStreamBasicDescription deviceFormat; + deviceFormat.mSampleRate = 44100; + deviceFormat.mFormatID = kAudioFormatLinearPCM; + deviceFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger; + deviceFormat.mBytesPerPacket = 4; + deviceFormat.mFramesPerPacket = 1; + deviceFormat.mBytesPerFrame = 4; + deviceFormat.mChannelsPerFrame = 2; + deviceFormat.mBitsPerChannel = 16; + deviceFormat.mReserved = 0; + + AudioQueueNewOutput(&deviceFormat, soundFill, NULL, NULL, kCFRunLoopCommonModes, 0, &audioQueue); + + for (int i = 0; i < 2; i++) { + AudioQueueBufferRef mBuffer; + AudioQueueAllocateBuffer(audioQueue, SND_BUF_SIZE, &mBuffer); + soundFill(NULL, audioQueue, mBuffer); + } + AudioQueueStart(audioQueue, NULL); +} + +- (id)init +{ + self = [super init]; + [[NSMutableDictionary alloc] init]; + m_touchList = [[NSMutableArray alloc] init]; + for (int i=0; i<10; i++) + [m_touchList addObject:[NSNull null]]; + return self; +} + +- (void)dealloc +{ + AudioQueueDispose(audioQueue, true); + [m_touchList release]; + [super dealloc]; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; + + if (!self.context) { + NSLog(@"! core: failed to create ES context"); + return; + } + + GLKView *view = (GLKView *)self.view; + view.context = self.context; + self.preferredFramesPerSecond = 60; + view.drawableDepthFormat = GLKViewDrawableDepthFormat16; + view.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888; + [EAGLContext setCurrentContext:self.context]; + + self.view.multipleTouchEnabled = YES; + + Stream::contentDir[0] = Stream::cacheDir[0] = 0; + + NSString *path = [[NSBundle mainBundle] resourcePath]; + strcat(Stream::contentDir, [path UTF8String]); + strcat(Stream::contentDir, "/"); + + Stream *lvl = new Stream("LEVEL2.PSX"); + Stream *snd = new Stream("05.ogg"); + + Game::init(lvl, snd); + + soundInit(); + Input::reset(); + + lastTime = getTime() - 1; +} + +- (void)viewDidUnload { + [super viewDidUnload]; + Game::free(); + if ([EAGLContext currentContext] == self.context) + [EAGLContext setCurrentContext:nil]; + self.context = nil; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; +} + +- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect { + [((GLKView *) self.view) bindDrawable]; + glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*)&Core::defaultFBO); + + float scale = [[UIScreen mainScreen] scale]; + Core::width = self.view.bounds.size.width * scale; + Core::height = self.view.bounds.size.height * scale; + + int time = getTime(); + if (time == lastTime) + return; + Game::update((time - lastTime) * 0.001f); + lastTime = time; + + Game::render(); +} + +enum { TOUCH_DOWN, TOUCH_UP, TOUCH_MOVE }; + +- (void) doTouch:(UIEvent*)event { + float scale = [[UIScreen mainScreen] scale]; + + NSSet* touchSet = [event allTouches]; + for (UITouch *touch in touchSet) { + CGPoint pos = [touch locationInView:self.view]; + NSUInteger id = int(touch); + + InputKey key = Input::getTouch(id); + if (key == ikNone) return; + Input::setPos(key, vec2(pos.x, pos.y) * scale); + + if (touch.phase != UITouchPhaseMoved) + Input::setDown(key, touch.phase == UITouchPhaseBegan); + } +} + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + [self doTouch:event]; +} + +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { + [self doTouch:event]; +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { + [self doTouch:event]; +} + +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { + [self doTouch:event]; +} + +@end diff --git a/src/platform/ios/en.lproj/InfoPlist.strings b/src/platform/ios/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/src/platform/ios/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/src/platform/ios/main.m b/src/platform/ios/main.m new file mode 100644 index 0000000..7731e40 --- /dev/null +++ b/src/platform/ios/main.m @@ -0,0 +1,9 @@ +#import +#import "AppDelegate.h" + +int main(int argc, char *argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/src/platform/ios/openlara-Info.plist b/src/platform/ios/openlara-Info.plist new file mode 100644 index 0000000..22a407c --- /dev/null +++ b/src/platform/ios/openlara-Info.plist @@ -0,0 +1,60 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + OpenLara + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIcons + + CFBundlePrimaryIcon + + CFBundleIconFiles + + icon.png + + UIPrerenderedIcon + + + + CFBundleIdentifier + org.xproger.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 0.1 + CFBundleSignature + ???? + CFBundleVersion + 0.1 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UIRequiresFullScreen + + UIStatusBarHidden + + UIStatusBarHidden~ipad + + UISupportedInterfaceOrientations + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/src/platform/ios/openlara-Prefix.pch b/src/platform/ios/openlara-Prefix.pch new file mode 100644 index 0000000..2f331ed --- /dev/null +++ b/src/platform/ios/openlara-Prefix.pch @@ -0,0 +1,10 @@ +#import + +#ifndef __IPHONE_3_0 +#warning "This project uses features only available in iOS SDK 3.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/src/platform/ios/openlara.xcodeproj/project.pbxproj b/src/platform/ios/openlara.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c3cdc32 --- /dev/null +++ b/src/platform/ios/openlara.xcodeproj/project.pbxproj @@ -0,0 +1,375 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 99266D7E160A568B003FFEBA /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 99266D7D160A568B003FFEBA /* AudioToolbox.framework */; }; + 99266D81160A5E7C003FFEBA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 99266D80160A5E7C003FFEBA /* UIKit.framework */; }; + 996585AF160A31450097B128 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 996585AE160A31450097B128 /* Foundation.framework */; }; + 996585CB160A3A8B0097B128 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 996585C8160A3A8B0097B128 /* AppDelegate.mm */; }; + 996585CC160A3A8B0097B128 /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 996585CA160A3A8B0097B128 /* ViewController.mm */; }; + 996585FB160A3B500097B128 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 996585FA160A3B500097B128 /* OpenGLES.framework */; }; + 996585FD160A3C620097B128 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 996585FC160A3C620097B128 /* GLKit.framework */; }; + 99CF06251E9145830072E389 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 996585B8160A31450097B128 /* main.m */; }; + 99CF06301E91505D0072E389 /* minimp3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 99CF062E1E91505D0072E389 /* minimp3.cpp */; }; + 99CF06311E91505D0072E389 /* stb_vorbis.c in Sources */ = {isa = PBXBuildFile; fileRef = 99CF062F1E91505D0072E389 /* stb_vorbis.c */; }; + 99CF06351E9154170072E389 /* LEVEL2.PSX in Resources */ = {isa = PBXBuildFile; fileRef = 99CF06331E9154170072E389 /* LEVEL2.PSX */; }; + 99CF06361E9154170072E389 /* 05.ogg in Resources */ = {isa = PBXBuildFile; fileRef = 99CF06341E9154170072E389 /* 05.ogg */; }; + 99CF06381E9193370072E389 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 99CF06231E9143C60072E389 /* Default-568h@2x.png */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 99266D7D160A568B003FFEBA /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 99266D80160A5E7C003FFEBA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 996585A8160A31450097B128 /* OpenLara.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenLara.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 996585AE160A31450097B128 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 996585B0160A31450097B128 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 996585B4160A31450097B128 /* openlara-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "openlara-Info.plist"; sourceTree = ""; }; + 996585B6160A31450097B128 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 996585B8160A31450097B128 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 996585BA160A31450097B128 /* openlara-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "openlara-Prefix.pch"; sourceTree = ""; }; + 996585BB160A31450097B128 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 996585C8160A3A8B0097B128 /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = ""; }; + 996585C9160A3A8B0097B128 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 996585CA160A3A8B0097B128 /* ViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewController.mm; sourceTree = ""; }; + 996585FA160A3B500097B128 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + 996585FC160A3C620097B128 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; + 99C2D3CD178B2DCE002E6F09 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = ""; }; + 99CF06021E913FE90072E389 /* bin */ = {isa = PBXFileReference; lastKnownFileType = text; name = bin; path = ../../../bin; sourceTree = ""; }; + 99CF06031E913FE90072E389 /* bin */ = {isa = PBXFileReference; lastKnownFileType = text; name = bin; path = ../../../bin; sourceTree = ""; }; + 99CF06061E9140630072E389 /* animation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = animation.h; path = ../../animation.h; sourceTree = ""; }; + 99CF06071E9140630072E389 /* cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cache.h; path = ../../cache.h; sourceTree = ""; }; + 99CF06081E9140630072E389 /* camera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = camera.h; path = ../../camera.h; sourceTree = ""; }; + 99CF06091E9140630072E389 /* character.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = character.h; path = ../../character.h; sourceTree = ""; }; + 99CF060A1E9140630072E389 /* collision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = collision.h; path = ../../collision.h; sourceTree = ""; }; + 99CF060B1E9140630072E389 /* controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = controller.h; path = ../../controller.h; sourceTree = ""; }; + 99CF060C1E9140630072E389 /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = core.h; path = ../../core.h; sourceTree = ""; }; + 99CF060D1E9140630072E389 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = debug.h; path = ../../debug.h; sourceTree = ""; }; + 99CF060E1E9140630072E389 /* enemy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = enemy.h; path = ../../enemy.h; sourceTree = ""; }; + 99CF060F1E9140630072E389 /* format.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = format.h; path = ../../format.h; sourceTree = ""; }; + 99CF06101E9140630072E389 /* frustum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = frustum.h; path = ../../frustum.h; sourceTree = ""; }; + 99CF06111E9140630072E389 /* game.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = game.h; path = ../../game.h; sourceTree = ""; }; + 99CF06121E9140630072E389 /* input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = input.h; path = ../../input.h; sourceTree = ""; }; + 99CF06131E9140630072E389 /* inventory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = inventory.h; path = ../../inventory.h; sourceTree = ""; }; + 99CF06141E9140630072E389 /* lara.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lara.h; path = ../../lara.h; sourceTree = ""; }; + 99CF06151E9140630072E389 /* level.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = level.h; path = ../../level.h; sourceTree = ""; }; + 99CF06171E9140630072E389 /* mesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mesh.h; path = ../../mesh.h; sourceTree = ""; }; + 99CF06181E9140630072E389 /* shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = shader.h; path = ../../shader.h; sourceTree = ""; }; + 99CF061A1E9140630072E389 /* sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sound.h; path = ../../sound.h; sourceTree = ""; }; + 99CF061B1E9140630072E389 /* sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sprite.h; path = ../../sprite.h; sourceTree = ""; }; + 99CF061C1E9140630072E389 /* texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = texture.h; path = ../../texture.h; sourceTree = ""; }; + 99CF061D1E9140630072E389 /* trigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = trigger.h; path = ../../trigger.h; sourceTree = ""; }; + 99CF061E1E9140630072E389 /* ui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ui.h; path = ../../ui.h; sourceTree = ""; }; + 99CF061F1E9140630072E389 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../utils.h; sourceTree = ""; }; + 99CF06231E9143C60072E389 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; + 99CF06281E9145EC0072E389 /* shaders */ = {isa = PBXFileReference; lastKnownFileType = folder; name = shaders; path = ../../shaders; sourceTree = ""; }; + 99CF062E1E91505D0072E389 /* minimp3.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = minimp3.cpp; path = ../../libs/minimp3/minimp3.cpp; sourceTree = ""; }; + 99CF062F1E91505D0072E389 /* stb_vorbis.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = stb_vorbis.c; path = ../../libs/stb_vorbis/stb_vorbis.c; sourceTree = ""; }; + 99CF06331E9154170072E389 /* LEVEL2.PSX */ = {isa = PBXFileReference; lastKnownFileType = file; path = LEVEL2.PSX; sourceTree = ""; }; + 99CF06341E9154170072E389 /* 05.ogg */ = {isa = PBXFileReference; lastKnownFileType = file; path = 05.ogg; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 996585A5160A31450097B128 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 99266D81160A5E7C003FFEBA /* UIKit.framework in Frameworks */, + 99266D7E160A568B003FFEBA /* AudioToolbox.framework in Frameworks */, + 996585FD160A3C620097B128 /* GLKit.framework in Frameworks */, + 996585FB160A3B500097B128 /* OpenGLES.framework in Frameworks */, + 996585AF160A31450097B128 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9965859D160A31450097B128 = { + isa = PBXGroup; + children = ( + 996585CD160A3AC50097B128 /* src */, + 996585B8160A31450097B128 /* main.m */, + 996585C8160A3A8B0097B128 /* AppDelegate.mm */, + 996585C9160A3A8B0097B128 /* ViewController.h */, + 996585CA160A3A8B0097B128 /* ViewController.mm */, + 996585BB160A31450097B128 /* AppDelegate.h */, + 996585B3160A31450097B128 /* Supporting Files */, + 996585FE160A3C960097B128 /* data */, + 996585AB160A31450097B128 /* Frameworks */, + 996585A9160A31450097B128 /* Products */, + ); + sourceTree = ""; + }; + 996585A9160A31450097B128 /* Products */ = { + isa = PBXGroup; + children = ( + 996585A8160A31450097B128 /* OpenLara.app */, + ); + name = Products; + sourceTree = ""; + }; + 996585AB160A31450097B128 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 99266D80160A5E7C003FFEBA /* UIKit.framework */, + 99266D7D160A568B003FFEBA /* AudioToolbox.framework */, + 996585FC160A3C620097B128 /* GLKit.framework */, + 996585FA160A3B500097B128 /* OpenGLES.framework */, + 996585AE160A31450097B128 /* Foundation.framework */, + 996585B0160A31450097B128 /* CoreGraphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 996585B3160A31450097B128 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 99CF06331E9154170072E389 /* LEVEL2.PSX */, + 99CF06341E9154170072E389 /* 05.ogg */, + 996585BA160A31450097B128 /* openlara-Prefix.pch */, + 996585B4160A31450097B128 /* openlara-Info.plist */, + 996585B5160A31450097B128 /* InfoPlist.strings */, + 99C2D3CD178B2DCE002E6F09 /* icon.png */, + 99CF06231E9143C60072E389 /* Default-568h@2x.png */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 996585CD160A3AC50097B128 /* src */ = { + isa = PBXGroup; + children = ( + 99CF062E1E91505D0072E389 /* minimp3.cpp */, + 99CF062F1E91505D0072E389 /* stb_vorbis.c */, + 99CF06281E9145EC0072E389 /* shaders */, + 99CF06061E9140630072E389 /* animation.h */, + 99CF06071E9140630072E389 /* cache.h */, + 99CF06081E9140630072E389 /* camera.h */, + 99CF06091E9140630072E389 /* character.h */, + 99CF060A1E9140630072E389 /* collision.h */, + 99CF060B1E9140630072E389 /* controller.h */, + 99CF060C1E9140630072E389 /* core.h */, + 99CF060D1E9140630072E389 /* debug.h */, + 99CF060E1E9140630072E389 /* enemy.h */, + 99CF060F1E9140630072E389 /* format.h */, + 99CF06101E9140630072E389 /* frustum.h */, + 99CF06111E9140630072E389 /* game.h */, + 99CF06121E9140630072E389 /* input.h */, + 99CF06131E9140630072E389 /* inventory.h */, + 99CF06141E9140630072E389 /* lara.h */, + 99CF06151E9140630072E389 /* level.h */, + 99CF06171E9140630072E389 /* mesh.h */, + 99CF06181E9140630072E389 /* shader.h */, + 99CF061A1E9140630072E389 /* sound.h */, + 99CF061B1E9140630072E389 /* sprite.h */, + 99CF061C1E9140630072E389 /* texture.h */, + 99CF061D1E9140630072E389 /* trigger.h */, + 99CF061E1E9140630072E389 /* ui.h */, + 99CF061F1E9140630072E389 /* utils.h */, + ); + name = src; + path = ../src; + sourceTree = ""; + }; + 996585FE160A3C960097B128 /* data */ = { + isa = PBXGroup; + children = ( + 99CF06021E913FE90072E389 /* bin */, + 99CF06031E913FE90072E389 /* bin */, + ); + path = data; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 996585A7160A31450097B128 /* OpenLara */ = { + isa = PBXNativeTarget; + buildConfigurationList = 996585C0160A31450097B128 /* Build configuration list for PBXNativeTarget "OpenLara" */; + buildPhases = ( + 996585A4160A31450097B128 /* Sources */, + 996585A5160A31450097B128 /* Frameworks */, + 996585A6160A31450097B128 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = OpenLara; + productName = OpenLara; + productReference = 996585A8160A31450097B128 /* OpenLara.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9965859F160A31450097B128 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0430; + }; + buildConfigurationList = 996585A2160A31450097B128 /* Build configuration list for PBXProject "openlara" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 9965859D160A31450097B128; + productRefGroup = 996585A9160A31450097B128 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 996585A7160A31450097B128 /* OpenLara */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 996585A6160A31450097B128 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 99CF06381E9193370072E389 /* Default-568h@2x.png in Resources */, + 99CF06351E9154170072E389 /* LEVEL2.PSX in Resources */, + 99CF06361E9154170072E389 /* 05.ogg in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 996585A4160A31450097B128 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 99CF06301E91505D0072E389 /* minimp3.cpp in Sources */, + 99CF06311E91505D0072E389 /* stb_vorbis.c in Sources */, + 99CF06251E9145830072E389 /* main.m in Sources */, + 996585CB160A3A8B0097B128 /* AppDelegate.mm in Sources */, + 996585CC160A3A8B0097B128 /* ViewController.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 996585B5160A31450097B128 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 996585B6160A31450097B128 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 996585BE160A31450097B128 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CODE_SIGN_IDENTITY = ""; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + ONLY_ACTIVE_ARCH = NO; + PROVISIONING_PROFILE = ""; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 996585BF160A31450097B128 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CODE_SIGN_IDENTITY = ""; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = ""; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + ONLY_ACTIVE_ARCH = NO; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + PROVISIONING_PROFILE = ""; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 996585C1160A31450097B128 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "openlara-Prefix.pch"; + INFOPLIST_FILE = "openlara-Info.plist"; + PRODUCT_NAME = "${TARGET_NAME}"; + PROVISIONING_PROFILE = ""; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 996585C2160A31450097B128 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "openlara-Prefix.pch"; + INFOPLIST_FILE = "openlara-Info.plist"; + PRODUCT_NAME = "${TARGET_NAME}"; + PROVISIONING_PROFILE = ""; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 996585A2160A31450097B128 /* Build configuration list for PBXProject "openlara" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 996585BE160A31450097B128 /* Debug */, + 996585BF160A31450097B128 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 996585C0160A31450097B128 /* Build configuration list for PBXNativeTarget "OpenLara" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 996585C1160A31450097B128 /* Debug */, + 996585C2160A31450097B128 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9965859F160A31450097B128 /* Project object */; +} diff --git a/src/shader.h b/src/shader.h index cb678f2..ad55d39 100644 --- a/src/shader.h +++ b/src/shader.h @@ -108,7 +108,7 @@ struct Shader { { GLSL_DEFINE GLSL_FRAG "#define FRAGMENT\n", defines, text } }; - GLchar info[256]; + GLchar info[1024]; for (int i = 0; i < 2; i++) { GLuint obj = glCreateShader(type[i]);