Source code changes necessary to compile on OS X.
This commit is contained in:
parent
dda76c8fe4
commit
6a165e8f0b
|
@ -29,6 +29,23 @@ int main(int argc, char **argv)
|
|||
if (chdir(DATADIR) == -1)
|
||||
printf("Warning: failed to change directory to \"%s\"\n", DATADIR);
|
||||
|
||||
// This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle
|
||||
#ifdef __APPLE__
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
||||
char path[PATH_MAX];
|
||||
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
|
||||
{
|
||||
// error!
|
||||
}
|
||||
CFRelease(resourcesURL);
|
||||
|
||||
chdir(path);
|
||||
printf("Current directory \"%s\"\n", path);
|
||||
#endif
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
engine_init(); // Must do this first!
|
||||
|
||||
cheatAttempt = false;
|
||||
|
|
|
@ -28,9 +28,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2_image/SDL_image.h>
|
||||
#include <SDL2_mixer/SDL_mixer.h>
|
||||
#include "CoreFoundation/CoreFoundation.h"
|
||||
#else
|
||||
#include "SDL.h"
|
||||
#include "SDL_image.h"
|
||||
#include "SDL_mixer.h"
|
||||
#endif
|
||||
|
||||
#include "defs.h"
|
||||
#include "structs.h"
|
||||
|
|
|
@ -17,8 +17,6 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "Starfighter.h"
|
||||
|
||||
Uint32 red;
|
||||
|
|
|
@ -20,7 +20,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifndef GLOBALS_H
|
||||
#define GLOBALS_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <SDL2/SDL.h>
|
||||
#else
|
||||
#include "SDL.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "defs.h"
|
||||
#include "structs.h"
|
||||
|
|
|
@ -17,7 +17,12 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <SDL2/SDL.h>
|
||||
#else
|
||||
#include "SDL.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "screen.h"
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "engine.h"
|
||||
#include "gfx.h"
|
||||
#include "structs.h"
|
||||
|
|
|
@ -285,7 +285,7 @@ int doTitle()
|
|||
aliens[i].face = 0;
|
||||
}
|
||||
|
||||
sprintf(buildVersion, "Version "VERSION);
|
||||
sprintf(buildVersion, "Version %s", VERSION );
|
||||
|
||||
SDL_Rect optionRec;
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <SDL2/SDL.h>
|
||||
#else
|
||||
#include "SDL.h"
|
||||
#endif
|
||||
|
||||
|
||||
SDL_Window *window;
|
||||
|
|
Loading…
Reference in New Issue