Bläddra i källkod

Merge branch 'osx_10_14_compat'

* osx_10_14_compat:
  Revert re-arrangement of init function. World and Renderer need to initialize before the openGLContext to function...
  Fix issue caused by 10.14 SDK Silently killing off OpenGL functionality.
  Fix compiler and linker errors. TODO: Fix grayed out screen issue (again).
Sam Jaffe 6 år sedan
förälder
incheckning
c513c2a551
2 ändrade filer med 33 tillägg och 10 borttagningar
  1. 23 4
      danmaku.xcodeproj/project.pbxproj
  2. 10 6
      danmaku/GameView.mm

+ 23 - 4
danmaku.xcodeproj/project.pbxproj

@@ -26,10 +26,10 @@
 		CD49F778229B0FCD00EB8926 /* actor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CD49F777229B0FCD00EB8926 /* actor.cxx */; };
 		CD49F783229B194C00EB8926 /* burstshot_pattern.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CD49F782229B194C00EB8926 /* burstshot_pattern.cxx */; };
 		CD49F784229B25DE00EB8926 /* libmath.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = CD7E883022960DBC00D877FE /* libmath.dylib */; };
-		CD49F786229B291D00EB8926 /* libjsoncpp.1.8.4.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = CD49F785229B291D00EB8926 /* libjsoncpp.1.8.4.dylib */; };
 		CD49F794229C22A800EB8926 /* serial.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CD49F793229C22A800EB8926 /* serial.cxx */; };
 		CD49F7B3229C530A00EB8926 /* world.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CD49F7B2229C530A00EB8926 /* world.cxx */; };
 		CD7E87A52295FCED00D877FE /* danmakuUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = CD7E87A42295FCED00D877FE /* danmakuUITests.m */; };
+		CDA4693823061D5B0011E246 /* libjsoncpp.1.9.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = CDA4693723061D5B0011E246 /* libjsoncpp.1.9.0.dylib */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -75,6 +75,13 @@
 			remoteGlobalIDString = CD3AC6E21D2C0364002B4BB0;
 			remoteInfo = graphics;
 		};
+		CDA4693323061D4D0011E246 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = CD7E883322960DBF00D877FE /* graphics.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = CDED9C1422A2D6CD00AE5CE5;
+			remoteInfo = "graphics-test";
+		};
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
@@ -108,6 +115,7 @@
 		CD7E881D22960D9C00D877FE /* gameutils.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = gameutils.xcodeproj; path = ../game/util/gameutils.xcodeproj; sourceTree = "<group>"; };
 		CD7E882922960DBB00D877FE /* math.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = math.xcodeproj; path = ../game/math/math.xcodeproj; sourceTree = "<group>"; };
 		CD7E883322960DBF00D877FE /* graphics.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = graphics.xcodeproj; path = ../game/graphics/graphics.xcodeproj; sourceTree = "<group>"; };
+		CDA4693723061D5B0011E246 /* libjsoncpp.1.9.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libjsoncpp.1.9.0.dylib; path = ../../../../../../opt/local/lib/libjsoncpp.1.9.0.dylib; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -115,7 +123,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				CD49F786229B291D00EB8926 /* libjsoncpp.1.8.4.dylib in Frameworks */,
+				CDA4693823061D5B0011E246 /* libjsoncpp.1.9.0.dylib in Frameworks */,
 				CD49F784229B25DE00EB8926 /* libmath.dylib in Frameworks */,
 				CD1C833F2298A9E000825C4E /* libengine.dylib in Frameworks */,
 				CD1C83402298A9E000825C4E /* libgameutils.dylib in Frameworks */,
@@ -220,6 +228,7 @@
 		CD7E87CE2295FFC500D877FE /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				CDA4693723061D5B0011E246 /* libjsoncpp.1.9.0.dylib */,
 				CD49F785229B291D00EB8926 /* libjsoncpp.1.8.4.dylib */,
 			);
 			name = Frameworks;
@@ -255,6 +264,7 @@
 			isa = PBXGroup;
 			children = (
 				CD7E883922960DBF00D877FE /* libgraphics.dylib */,
+				CDA4693423061D4D0011E246 /* graphics-test.xctest */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -394,6 +404,13 @@
 			remoteRef = CD7E883822960DBF00D877FE /* PBXContainerItemProxy */;
 			sourceTree = BUILT_PRODUCTS_DIR;
 		};
+		CDA4693423061D4D0011E246 /* graphics-test.xctest */ = {
+			isa = PBXReferenceProxy;
+			fileType = wrapper.cfbundle;
+			path = "graphics-test.xctest";
+			remoteRef = CDA4693323061D4D0011E246 /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
 /* End PBXReferenceProxy section */
 
 /* Begin PBXResourcesBuildPhase section */
@@ -548,7 +565,8 @@
 				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
 				MTL_FAST_MATH = YES;
 				ONLY_ACTIVE_ARCH = YES;
-				SDKROOT = macosx;
+				OTHER_CFLAGS = "-DNCURSES_UNCTRL_H_incl";
+				SDKROOT = macosx10.13;
 				SYSTEM_HEADER_SEARCH_PATHS = /opt/local/include/;
 				USER_HEADER_SEARCH_PATHS = (
 					"$(PROJECT_DIR)/../game/include/expect/include",
@@ -607,7 +625,8 @@
 				MACOSX_DEPLOYMENT_TARGET = 10.13;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				MTL_FAST_MATH = YES;
-				SDKROOT = macosx;
+				OTHER_CFLAGS = "-DNCURSES_UNCTRL_H_incl";
+				SDKROOT = macosx10.13;
 				SYSTEM_HEADER_SEARCH_PATHS = /opt/local/include/;
 				USER_HEADER_SEARCH_PATHS = (
 					"$(PROJECT_DIR)/../game/include/expect/include",

+ 10 - 6
danmaku/GameView.mm

@@ -56,11 +56,12 @@ namespace env { namespace detail {
   [self setOpenGLContext:context];
   [self setPixelFormat:nsglFormat];
   [[self openGLContext] makeCurrentContext];
-  
+
   return self;
 }
 
 - (void)prepareOpenGL {
+  [super prepareOpenGL];
   // enable vertical sychronization to refresh rate
   const GLint vals = 0x01;
   [[self openGLContext] setValues:&vals forParameter:NSOpenGLCPSwapInterval];
@@ -91,14 +92,17 @@ namespace env { namespace detail {
 }
 
 - (void)reshape {
-  NSRect newFrame = {0, 0, [[self window] frame].size.width,
-    [[self window] frame].size.height};
-  [self setFrame:newFrame];
+  [super reshape];
+  
+  const CGSize dims = [[self window] frame].size;
+  if (dims.width == 0 || dims.height == 0) return;
+  
+  [self setFrame:NSRect{0, 0, dims.width, dims.height}];
   
   // window resize; width and height are in pixel coordinates
   // but they are floats
-  float screen_w = [self frame].size.width;
-  float screen_h = [self frame].size.height;
+  float screen_w = dims.width;
+  float screen_h = dims.height;
   
   //  glViewport(0,0, screen_w, screen_h);