Browse Source

Moved Mac-specific code from platform/macosx/ to src/common/

--HG--
branch : minor
Alex Szpakowski 10 years ago
parent
commit
606f077e5d

+ 8 - 0
platform/macosx/love-framework.xcodeproj/project.pbxproj

@@ -11,6 +11,8 @@
 		FA01BE1F1878E35B00640047 /* wrap_Texture.h in Headers */ = {isa = PBXBuildFile; fileRef = FA01BE1D1878E35B00640047 /* wrap_Texture.h */; };
 		FA01BE1F1878E35B00640047 /* wrap_Texture.h in Headers */ = {isa = PBXBuildFile; fileRef = FA01BE1D1878E35B00640047 /* wrap_Texture.h */; };
 		FA03546C1731F3A700284828 /* simplexnoise1234.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA03546A1731F3A700284828 /* simplexnoise1234.cpp */; };
 		FA03546C1731F3A700284828 /* simplexnoise1234.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA03546A1731F3A700284828 /* simplexnoise1234.cpp */; };
 		FA03546D1731F3A700284828 /* simplexnoise1234.h in Headers */ = {isa = PBXBuildFile; fileRef = FA03546B1731F3A700284828 /* simplexnoise1234.h */; };
 		FA03546D1731F3A700284828 /* simplexnoise1234.h in Headers */ = {isa = PBXBuildFile; fileRef = FA03546B1731F3A700284828 /* simplexnoise1234.h */; };
+		FA088D861A919E1400F26F29 /* OSX.h in Headers */ = {isa = PBXBuildFile; fileRef = FA088D841A919E1400F26F29 /* OSX.h */; };
+		FA088D871A919E1400F26F29 /* OSX.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA088D851A919E1400F26F29 /* OSX.mm */; };
 		FA08F5B016C752F900F007B5 /* Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2FB732687B1669402408356D /* Source.cpp */; };
 		FA08F5B016C752F900F007B5 /* Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2FB732687B1669402408356D /* Source.cpp */; };
 		FA08F5B116C752F900F007B5 /* wrap_Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02CA1BE908D91B104EB9590F /* wrap_Audio.cpp */; };
 		FA08F5B116C752F900F007B5 /* wrap_Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02CA1BE908D91B104EB9590F /* wrap_Audio.cpp */; };
 		FA08F5B216C752F900F007B5 /* wrap_Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02662CBC29B954295A634A39 /* wrap_Source.cpp */; };
 		FA08F5B216C752F900F007B5 /* wrap_Source.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02662CBC29B954295A634A39 /* wrap_Source.cpp */; };
@@ -787,6 +789,8 @@
 		FA01BE1D1878E35B00640047 /* wrap_Texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Texture.h; sourceTree = "<group>"; };
 		FA01BE1D1878E35B00640047 /* wrap_Texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Texture.h; sourceTree = "<group>"; };
 		FA03546A1731F3A700284828 /* simplexnoise1234.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = simplexnoise1234.cpp; sourceTree = "<group>"; };
 		FA03546A1731F3A700284828 /* simplexnoise1234.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = simplexnoise1234.cpp; sourceTree = "<group>"; };
 		FA03546B1731F3A700284828 /* simplexnoise1234.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simplexnoise1234.h; sourceTree = "<group>"; };
 		FA03546B1731F3A700284828 /* simplexnoise1234.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simplexnoise1234.h; sourceTree = "<group>"; };
+		FA088D841A919E1400F26F29 /* OSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSX.h; sourceTree = "<group>"; };
+		FA088D851A919E1400F26F29 /* OSX.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OSX.mm; sourceTree = "<group>"; };
 		FA08F5AE16C7525600F007B5 /* Info-Framework.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = "<group>"; };
 		FA08F5AE16C7525600F007B5 /* Info-Framework.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = "<group>"; };
 		FA0A4BEE182E0C2800E1E4D2 /* b2MotorJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2MotorJoint.cpp; sourceTree = "<group>"; };
 		FA0A4BEE182E0C2800E1E4D2 /* b2MotorJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2MotorJoint.cpp; sourceTree = "<group>"; };
 		FA0A4BEF182E0C2800E1E4D2 /* b2MotorJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2MotorJoint.h; sourceTree = "<group>"; };
 		FA0A4BEF182E0C2800E1E4D2 /* b2MotorJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2MotorJoint.h; sourceTree = "<group>"; };
@@ -1048,6 +1052,8 @@
 				63024AF52EE3658260BE116B /* Module.h */,
 				63024AF52EE3658260BE116B /* Module.h */,
 				411B061C49172C971C622125 /* Object.cpp */,
 				411B061C49172C971C622125 /* Object.cpp */,
 				350C47C774835EA552130431 /* Object.h */,
 				350C47C774835EA552130431 /* Object.h */,
+				FA088D841A919E1400F26F29 /* OSX.h */,
+				FA088D851A919E1400F26F29 /* OSX.mm */,
 				35B31EBC4DDB6F994BCA46B6 /* Reference.cpp */,
 				35B31EBC4DDB6F994BCA46B6 /* Reference.cpp */,
 				2CEC5ED5211174C7583849AD /* Reference.h */,
 				2CEC5ED5211174C7583849AD /* Reference.h */,
 				45E761A0072E0EF92BD66EA9 /* runtime.cpp */,
 				45E761A0072E0EF92BD66EA9 /* runtime.cpp */,
@@ -2124,6 +2130,7 @@
 				FAE010E5170DF75C006F29D0 /* wrap_CompressedData.h in Headers */,
 				FAE010E5170DF75C006F29D0 /* wrap_CompressedData.h in Headers */,
 				FA705741194A55CB00670B30 /* wrap_DroppedFile.h in Headers */,
 				FA705741194A55CB00670B30 /* wrap_DroppedFile.h in Headers */,
 				FAF6704E18184FF800DBDEEA /* wuff_config.h in Headers */,
 				FAF6704E18184FF800DBDEEA /* wuff_config.h in Headers */,
+				FA088D861A919E1400F26F29 /* OSX.h in Headers */,
 				FA0CDE3D1710F9A50056E8D7 /* FormatHandler.h in Headers */,
 				FA0CDE3D1710F9A50056E8D7 /* FormatHandler.h in Headers */,
 				FA7AA59317F6AC1F00704BE2 /* wrap_Mesh.h in Headers */,
 				FA7AA59317F6AC1F00704BE2 /* wrap_Mesh.h in Headers */,
 				FA01BE1F1878E35B00640047 /* wrap_Texture.h in Headers */,
 				FA01BE1F1878E35B00640047 /* wrap_Texture.h in Headers */,
@@ -2475,6 +2482,7 @@
 				FAEC808A1710FEA60057279A /* ImageData.cpp in Sources */,
 				FAEC808A1710FEA60057279A /* ImageData.cpp in Sources */,
 				FAEC808E1711E76C0057279A /* CompressedData.cpp in Sources */,
 				FAEC808E1711E76C0057279A /* CompressedData.cpp in Sources */,
 				FA636D8A171B70920065623F /* RandomGenerator.cpp in Sources */,
 				FA636D8A171B70920065623F /* RandomGenerator.cpp in Sources */,
+				FA088D871A919E1400F26F29 /* OSX.mm in Sources */,
 				FA636D8E171B72A70065623F /* wrap_RandomGenerator.cpp in Sources */,
 				FA636D8E171B72A70065623F /* wrap_RandomGenerator.cpp in Sources */,
 				FAC86E631724552C00EED715 /* wrap_Quad.cpp in Sources */,
 				FAC86E631724552C00EED715 /* wrap_Quad.cpp in Sources */,
 				FAC86E6B1724555D00EED715 /* Quad.cpp in Sources */,
 				FAC86E6B1724555D00EED715 /* Quad.cpp in Sources */,

+ 0 - 6
platform/macosx/love.xcodeproj/project.pbxproj

@@ -26,7 +26,6 @@
 		FA9B4A0B16E157B500074F42 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0916E1579F00074F42 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
 		FA9B4A0B16E157B500074F42 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0916E1579F00074F42 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
 		FAAFF04716CB120000CCDE45 /* OpenAL-Soft.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
 		FAAFF04716CB120000CCDE45 /* OpenAL-Soft.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
 		FAC1A449196F5DC600125284 /* license.txt in Resources */ = {isa = PBXBuildFile; fileRef = FAC1A448196F5DC600125284 /* license.txt */; };
 		FAC1A449196F5DC600125284 /* license.txt in Resources */ = {isa = PBXBuildFile; fileRef = FAC1A448196F5DC600125284 /* license.txt */; };
-		FAC8E8D416F3C468004DADF3 /* OSX.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAC8E8D316F3C468004DADF3 /* OSX.mm */; };
 /* End PBXBuildFile section */
 /* End PBXBuildFile section */
 
 
 /* Begin PBXContainerItemProxy section */
 /* Begin PBXContainerItemProxy section */
@@ -84,8 +83,6 @@
 		FA9B4A0916E1579F00074F42 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<absolute>"; };
 		FA9B4A0916E1579F00074F42 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<absolute>"; };
 		FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenAL-Soft.framework"; path = "/Library/Frameworks/OpenAL-Soft.framework"; sourceTree = "<absolute>"; };
 		FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenAL-Soft.framework"; path = "/Library/Frameworks/OpenAL-Soft.framework"; sourceTree = "<absolute>"; };
 		FAC1A448196F5DC600125284 /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = license.txt; path = ../../license.txt; sourceTree = "<group>"; };
 		FAC1A448196F5DC600125284 /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = license.txt; path = ../../license.txt; sourceTree = "<group>"; };
-		FAC8E8D316F3C468004DADF3 /* OSX.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OSX.mm; sourceTree = "<group>"; };
-		FAC8E8D616F3C46E004DADF3 /* OSX.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSX.h; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 /* End PBXFileReference section */
 
 
 /* Begin PBXFrameworksBuildPhase section */
 /* Begin PBXFrameworksBuildPhase section */
@@ -167,8 +164,6 @@
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
 				A93E6A3410420AC0007D418B /* love.cpp */,
 				A93E6A3410420AC0007D418B /* love.cpp */,
-				FAC8E8D616F3C46E004DADF3 /* OSX.h */,
-				FAC8E8D316F3C468004DADF3 /* OSX.mm */,
 			);
 			);
 			name = Source;
 			name = Source;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
@@ -257,7 +252,6 @@
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
 				A93E6EED10420BA8007D418B /* love.cpp in Sources */,
 				A93E6EED10420BA8007D418B /* love.cpp in Sources */,
-				FAC8E8D416F3C468004DADF3 /* OSX.mm in Sources */,
 			);
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 		};

+ 7 - 1
platform/macosx/OSX.h → src/common/OSX.h

@@ -21,6 +21,10 @@
 #ifndef LOVE_OSX_H
 #ifndef LOVE_OSX_H
 #define LOVE_OSX_H
 #define LOVE_OSX_H
 
 
+#include "config.h"
+
+#ifdef LOVE_MACOSX
+
 #include <string>
 #include <string>
 
 
 namespace love
 namespace love
@@ -30,7 +34,7 @@ namespace osx
 
 
 /**
 /**
  * Returns the filepath of the first detected love file in the Resources folder
  * Returns the filepath of the first detected love file in the Resources folder
- * in love.app.
+ * in the main bundle (love.app.)
  * Returns an empty string if no love file is found.
  * Returns an empty string if no love file is found.
  **/
  **/
 std::string getLoveInResources();
 std::string getLoveInResources();
@@ -44,4 +48,6 @@ std::string checkDropEvents();
 } // osx
 } // osx
 } // love
 } // love
 
 
+#endif // LOVE_MACOSX
+
 #endif // LOVE_OSX_H
 #endif // LOVE_OSX_H

+ 8 - 6
platform/macosx/OSX.mm → src/common/OSX.mm

@@ -18,7 +18,10 @@
  * 3. This notice may not be removed or altered from any source distribution.
  * 3. This notice may not be removed or altered from any source distribution.
  **/
  **/
 
 
-#import "OSX.h"
+#include "OSX.h"
+
+#ifdef LOVE_MACOSX
+
 #import <Foundation/Foundation.h>
 #import <Foundation/Foundation.h>
 
 
 #include <SDL2/SDL.h>
 #include <SDL2/SDL.h>
@@ -49,9 +52,7 @@ std::string checkDropEvents()
 	std::string dropstr;
 	std::string dropstr;
 	SDL_Event event;
 	SDL_Event event;
 
 
-	bool initvideo = SDL_WasInit(SDL_INIT_VIDEO) != 0;
-	if (!initvideo)
-		SDL_InitSubSystem(SDL_INIT_VIDEO);
+	SDL_InitSubSystem(SDL_INIT_VIDEO);
 
 
 	SDL_PumpEvents();
 	SDL_PumpEvents();
 	if (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_DROPFILE, SDL_DROPFILE) > 0)
 	if (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_DROPFILE, SDL_DROPFILE) > 0)
@@ -63,11 +64,12 @@ std::string checkDropEvents()
 		}
 		}
 	}
 	}
 
 
-	if (!initvideo)
-		SDL_QuitSubSystem(SDL_INIT_VIDEO);
+	SDL_QuitSubSystem(SDL_INIT_VIDEO);
 
 
 	return dropstr;
 	return dropstr;
 }
 }
 
 
 } // osx
 } // osx
 } // love
 } // love
+
+#endif // LOVE_MACOSX

+ 1 - 1
src/love.cpp

@@ -36,7 +36,7 @@ extern "C" {
 #endif // LOVE_WINDOWS
 #endif // LOVE_WINDOWS
 
 
 #ifdef LOVE_MACOSX
 #ifdef LOVE_MACOSX
-#include "OSX.h"
+#include "common/OSX.h"
 #endif // LOVE_MACOSX
 #endif // LOVE_MACOSX
 
 
 #ifdef LOVE_WINDOWS
 #ifdef LOVE_WINDOWS

+ 2 - 0
src/modules/sound/lullaby/CoreAudioDecoder.h

@@ -21,6 +21,8 @@
 #ifndef LOVE_SOUND_LULLABY_CORE_AUDIO_DECODER_H
 #ifndef LOVE_SOUND_LULLABY_CORE_AUDIO_DECODER_H
 #define LOVE_SOUND_LULLABY_CORE_AUDIO_DECODER_H
 #define LOVE_SOUND_LULLABY_CORE_AUDIO_DECODER_H
 
 
+#include "common/config.h"
+
 #ifdef LOVE_SUPPORT_CORE_AUDIO
 #ifdef LOVE_SUPPORT_CORE_AUDIO
 
 
 // LOVE
 // LOVE