Last active
December 16, 2015 20:19
-
-
Save justinbowes/5491222 to your computer and use it in GitHub Desktop.
Making pighead10's SFML Ludum Dare entry, "You are the Minimalist", run in OSX.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Call to implicitly-deleted copy constructor | |
Game.cpp:16 -------------------- | |
-sf::RenderTexture Game::gameOutput = sf::RenderTexture(); | |
+sf::RenderTexture Game::gameOutput; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main.cpp:3 --------------------- | |
#ifdef __APPLE__ | |
#include <cstdio> | |
#include <sys/syslimits.h> | |
#include <CoreFoundation/CoreFoundation.h> | |
#define MAXPATHLEN PATH_MAX | |
#endif | |
// Need to copy media/ to Resources directory in app bundle | |
// App needs to cd into Resources in order for relative paths to work | |
// This code stolen from GLFW by elmindreda et al. | |
static void changeToResourcesDirectory(void) | |
{ | |
char resourcesPath[MAXPATHLEN]; | |
CFBundleRef bundle = CFBundleGetMainBundle(); | |
if (!bundle) | |
return; | |
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(bundle); | |
CFStringRef last = CFURLCopyLastPathComponent(resourcesURL); | |
if (CFStringCompare(CFSTR("Resources"), last, 0) != kCFCompareEqualTo) | |
{ | |
CFRelease(last); | |
CFRelease(resourcesURL); | |
return; | |
} | |
CFRelease(last); | |
if (!CFURLGetFileSystemRepresentation(resourcesURL, | |
true, | |
(UInt8*) resourcesPath, | |
MAXPATHLEN)) | |
{ | |
CFRelease(resourcesURL); | |
return; | |
} | |
CFRelease(resourcesURL); | |
chdir(resourcesPath); | |
} | |
int main(){ | |
changeToResourcesDirectory(); | |
Game::start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment