diff --git a/platform/macosx/love-framework.xcodeproj/project.pbxproj b/platform/macosx/love-framework.xcodeproj/project.pbxproj index 46d51da64..ca6b625ee 100644 --- a/platform/macosx/love-framework.xcodeproj/project.pbxproj +++ b/platform/macosx/love-framework.xcodeproj/project.pbxproj @@ -11,6 +11,8 @@ FA01BE1F1878E35B00640047 /* wrap_Texture.h in Headers */ = {isa = PBXBuildFile; fileRef = FA01BE1D1878E35B00640047 /* wrap_Texture.h */; }; FA03546C1731F3A700284828 /* simplexnoise1234.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA03546A1731F3A700284828 /* simplexnoise1234.cpp */; }; 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 */; }; 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 */; }; @@ -787,6 +789,8 @@ FA01BE1D1878E35B00640047 /* wrap_Texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_Texture.h; sourceTree = ""; }; FA03546A1731F3A700284828 /* simplexnoise1234.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = simplexnoise1234.cpp; sourceTree = ""; }; FA03546B1731F3A700284828 /* simplexnoise1234.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simplexnoise1234.h; sourceTree = ""; }; + FA088D841A919E1400F26F29 /* OSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSX.h; sourceTree = ""; }; + FA088D851A919E1400F26F29 /* OSX.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OSX.mm; sourceTree = ""; }; FA08F5AE16C7525600F007B5 /* Info-Framework.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = ""; }; FA0A4BEE182E0C2800E1E4D2 /* b2MotorJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2MotorJoint.cpp; sourceTree = ""; }; FA0A4BEF182E0C2800E1E4D2 /* b2MotorJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2MotorJoint.h; sourceTree = ""; }; @@ -1048,6 +1052,8 @@ 63024AF52EE3658260BE116B /* Module.h */, 411B061C49172C971C622125 /* Object.cpp */, 350C47C774835EA552130431 /* Object.h */, + FA088D841A919E1400F26F29 /* OSX.h */, + FA088D851A919E1400F26F29 /* OSX.mm */, 35B31EBC4DDB6F994BCA46B6 /* Reference.cpp */, 2CEC5ED5211174C7583849AD /* Reference.h */, 45E761A0072E0EF92BD66EA9 /* runtime.cpp */, @@ -2124,6 +2130,7 @@ FAE010E5170DF75C006F29D0 /* wrap_CompressedData.h in Headers */, FA705741194A55CB00670B30 /* wrap_DroppedFile.h in Headers */, FAF6704E18184FF800DBDEEA /* wuff_config.h in Headers */, + FA088D861A919E1400F26F29 /* OSX.h in Headers */, FA0CDE3D1710F9A50056E8D7 /* FormatHandler.h in Headers */, FA7AA59317F6AC1F00704BE2 /* wrap_Mesh.h in Headers */, FA01BE1F1878E35B00640047 /* wrap_Texture.h in Headers */, @@ -2475,6 +2482,7 @@ FAEC808A1710FEA60057279A /* ImageData.cpp in Sources */, FAEC808E1711E76C0057279A /* CompressedData.cpp in Sources */, FA636D8A171B70920065623F /* RandomGenerator.cpp in Sources */, + FA088D871A919E1400F26F29 /* OSX.mm in Sources */, FA636D8E171B72A70065623F /* wrap_RandomGenerator.cpp in Sources */, FAC86E631724552C00EED715 /* wrap_Quad.cpp in Sources */, FAC86E6B1724555D00EED715 /* Quad.cpp in Sources */, diff --git a/platform/macosx/love.xcodeproj/project.pbxproj b/platform/macosx/love.xcodeproj/project.pbxproj index dc4996a7d..96328a692 100644 --- a/platform/macosx/love.xcodeproj/project.pbxproj +++ b/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, ); }; }; 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 */; }; - FAC8E8D416F3C468004DADF3 /* OSX.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAC8E8D316F3C468004DADF3 /* OSX.mm */; }; /* End PBXBuildFile 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 = ""; }; FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenAL-Soft.framework"; path = "/Library/Frameworks/OpenAL-Soft.framework"; sourceTree = ""; }; FAC1A448196F5DC600125284 /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = license.txt; path = ../../license.txt; sourceTree = ""; }; - FAC8E8D316F3C468004DADF3 /* OSX.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OSX.mm; sourceTree = ""; }; - FAC8E8D616F3C46E004DADF3 /* OSX.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSX.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -167,8 +164,6 @@ isa = PBXGroup; children = ( A93E6A3410420AC0007D418B /* love.cpp */, - FAC8E8D616F3C46E004DADF3 /* OSX.h */, - FAC8E8D316F3C468004DADF3 /* OSX.mm */, ); name = Source; sourceTree = ""; @@ -257,7 +252,6 @@ buildActionMask = 2147483647; files = ( A93E6EED10420BA8007D418B /* love.cpp in Sources */, - FAC8E8D416F3C468004DADF3 /* OSX.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/platform/macosx/OSX.h b/src/common/OSX.h similarity index 93% rename from platform/macosx/OSX.h rename to src/common/OSX.h index 3972cdfc0..ddd7e0c84 100644 --- a/platform/macosx/OSX.h +++ b/src/common/OSX.h @@ -21,6 +21,10 @@ #ifndef LOVE_OSX_H #define LOVE_OSX_H +#include "config.h" + +#ifdef LOVE_MACOSX + #include namespace love @@ -30,7 +34,7 @@ namespace osx /** * 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. **/ std::string getLoveInResources(); @@ -44,4 +48,6 @@ std::string checkDropEvents(); } // osx } // love +#endif // LOVE_MACOSX + #endif // LOVE_OSX_H diff --git a/platform/macosx/OSX.mm b/src/common/OSX.mm similarity index 90% rename from platform/macosx/OSX.mm rename to src/common/OSX.mm index a2a1a7cf3..3d7eae65f 100644 --- a/platform/macosx/OSX.mm +++ b/src/common/OSX.mm @@ -18,7 +18,10 @@ * 3. This notice may not be removed or altered from any source distribution. **/ -#import "OSX.h" +#include "OSX.h" + +#ifdef LOVE_MACOSX + #import #include @@ -49,9 +52,7 @@ std::string checkDropEvents() std::string dropstr; 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(); 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; } } // osx } // love + +#endif // LOVE_MACOSX diff --git a/src/love.cpp b/src/love.cpp index 3543136d6..3fd0fb1fc 100644 --- a/src/love.cpp +++ b/src/love.cpp @@ -36,7 +36,7 @@ extern "C" { #endif // LOVE_WINDOWS #ifdef LOVE_MACOSX -#include "OSX.h" +#include "common/OSX.h" #endif // LOVE_MACOSX #ifdef LOVE_WINDOWS diff --git a/src/modules/sound/lullaby/CoreAudioDecoder.h b/src/modules/sound/lullaby/CoreAudioDecoder.h index 58de380bd..8918de7bf 100644 --- a/src/modules/sound/lullaby/CoreAudioDecoder.h +++ b/src/modules/sound/lullaby/CoreAudioDecoder.h @@ -21,6 +21,8 @@ #ifndef LOVE_SOUND_LULLABY_CORE_AUDIO_DECODER_H #define LOVE_SOUND_LULLABY_CORE_AUDIO_DECODER_H +#include "common/config.h" + #ifdef LOVE_SUPPORT_CORE_AUDIO // LOVE