diff --git a/OneShot.app/Contents/Info.plist b/OneShot.app/Contents/Info.plist index dcbdbfb..7e91af9 100755 --- a/OneShot.app/Contents/Info.plist +++ b/OneShot.app/Contents/Info.plist @@ -20,5 +20,9 @@ public.app-category.games LSMinimumSystemVersion 10.7 + NSPrincipalClass + NSApplication + NSHighResolutionCapable + True diff --git a/OneShot.app/Contents/MacOS/oneshot b/OneShot.app/Contents/MacOS/oneshot new file mode 100755 index 0000000..074af0c Binary files /dev/null and b/OneShot.app/Contents/MacOS/oneshot differ diff --git a/OneShot.app/Contents/Resources/oneshot b/OneShot.app/Contents/Resources/oneshot index 55d9120..80272d0 100755 Binary files a/OneShot.app/Contents/Resources/oneshot and b/OneShot.app/Contents/Resources/oneshot differ diff --git a/src/config.cpp b/src/config.cpp index ec9fbb1..bf3ff78 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -64,7 +64,7 @@ void Config::read(int argc, char *argv[]) PO_DESC(printFPS, bool, false) \ PO_DESC(fullscreen, bool, false) \ PO_DESC(fixedAspectRatio, bool, true) \ - PO_DESC(smoothScaling, bool, false) \ + PO_DESC(smoothScaling, bool, true) \ PO_DESC(vsync, bool, true) \ PO_DESC(fixedFramerate, int, 0) \ PO_DESC(frameSkip, bool, true) \ diff --git a/src/eventthread.cpp b/src/eventthread.cpp index 7063ec9..fdebe83 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -44,6 +44,8 @@ #include +#include + typedef void (ALC_APIENTRY *LPALCDEVICEPAUSESOFT) (ALCdevice *device); typedef void (ALC_APIENTRY *LPALCDEVICERESUMESOFT) (ALCdevice *device); @@ -173,7 +175,7 @@ void EventThread::process(RGSSThreadData &rtData) std::map::iterator jsit; std::map::iterator gcit; - SDL_GetWindowSize(win, &winW, &winH); + SDL_GetWindowSize(win, &winW, &winH); // SDL_GL_GetDrawableSize(win, &winW, &winH); SettingsMenu *sMenu = 0; @@ -226,6 +228,8 @@ void EventThread::process(RGSSThreadData &rtData) winW = event.window.data1; winH = event.window.data2; + //SDL_GL_GetDrawableSize(win, &winW, &winH); + windowSizeMsg.post(Vec2i(winW, winH)); resetInputStates(); break; diff --git a/src/filesystem.cpp b/src/filesystem.cpp index c634878..5afbdf2 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -40,6 +40,10 @@ #include #ifdef __APPLE__ +#define OS_OSX +#endif + +#ifdef OS_OSX #include #endif @@ -354,7 +358,7 @@ struct CacheEnumData FileSystemPrivate *p; std::stack*> fileLists; -#ifdef __APPLE__ +#ifdef OS_OSX iconv_t nfd2nfc; char buf[512]; #endif @@ -362,14 +366,14 @@ struct CacheEnumData CacheEnumData(FileSystemPrivate *p) : p(p) { -#ifdef __APPLE__ +#ifdef OS_OSX nfd2nfc = iconv_open("utf-8", "utf-8-mac"); #endif } ~CacheEnumData() { -#ifdef __APPLE__ +#ifdef OS_OSX iconv_close(nfd2nfc); #endif } @@ -377,7 +381,7 @@ struct CacheEnumData /* Converts in-place */ void toNFC(char *inout) { -#ifdef __APPLE__ +#ifdef OS_OSX size_t srcSize = strlen(inout); size_t bufSize = sizeof(buf); char *bufPtr = buf; diff --git a/src/main.cpp b/src/main.cpp index 66345de..8bfaef8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -255,7 +255,7 @@ int main(int argc, char *argv[]) SDL_Surface *iconImg = IMG_Load_RW(iconSrc, SDL_TRUE); SDL_Window *win; - Uint32 winFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_INPUT_FOCUS; + Uint32 winFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_RESIZABLE; //| SDL_WINDOW_ALLOW_HIGHDPI; if (conf.fullscreen) winFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; @@ -308,7 +308,7 @@ int main(int argc, char *argv[]) #endif int winW, winH; - SDL_GetWindowSize(win, &winW, &winH); + SDL_GetWindowSize(win, &winW, &winH); // SDL_GL_GetDrawableSize(win, &winW, &winH); rtData.windowSizeMsg.post(Vec2i(winW, winH)); /* Load and post key bindings */ diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 640a4b2..6c3adfe 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -19,18 +19,16 @@ #include #include #elif defined __APPLE__ || __linux__ - #ifdef __APPLE__ - #define OS_OSX - #else - #define OS_LINUX - #endif - #include #include #include #include - #ifdef OS_LINUX + #ifdef __APPLE__ + #define OS_OSX + #else + #define OS_LINUX + class GtkWidget; typedef enum @@ -426,41 +424,24 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : else p->lang = "en"; + //Get user's name #ifdef OS_OSX - - //Get user's name struct passwd *pwd = getpwuid(geteuid()); - if (pwd) - { - if (pwd->pw_gecos && pwd->pw_gecos[0] && pwd->pw_gecos[0] != ',') - { - //Get the user's full name - int comma = 0; - for (; pwd->pw_gecos[comma] && pwd->pw_gecos[comma] != ','; ++comma) {} - p->userName = std::string(pwd->pw_gecos, comma); - } - else - p->userName = pwd->pw_name; - } - #elif defined OS_LINUX - - //Get user's name struct passwd *pwd = getpwuid(getuid()); - if (pwd) - { - if (pwd->pw_gecos && pwd->pw_gecos[0] && pwd->pw_gecos[0] != ',') - { - //Get the user's full name - int comma = 0; - for (; pwd->pw_gecos[comma] && pwd->pw_gecos[comma] != ','; ++comma) {} - p->userName = std::string(pwd->pw_gecos, comma); - } - else - p->userName = pwd->pw_name; - } - #endif + if (pwd) + { + if (pwd->pw_gecos && pwd->pw_gecos[0] && pwd->pw_gecos[0] != ',') + { + //Get the user's full name + int comma = 0; + for (; pwd->pw_gecos[comma] && pwd->pw_gecos[comma] != ','; ++comma) {} + p->userName = std::string(pwd->pw_gecos, comma); + } + else + p->userName = pwd->pw_name; + } //Get documents path char *path = xdg_user_dir_lookup_with_fallback("DOCUMENTS", getenv("HOME")); @@ -696,15 +677,16 @@ bool Oneshot::msgbox(int type, const char *body, const char *title) //Interpret result return (result == IDOK || result == IDYES); #else -#if defined OS_LINUX - if (p->libgtk) - { - linux_DialogData data = {p, type, body, title, 0}; - p->gdk_threads_add_idle(linux_dialog, &data); - p->gtk_main(); - return data.result; - } -#endif + #if defined OS_LINUX + if (p->libgtk) + { + linux_DialogData data = {p, type, body, title, 0}; + p->gdk_threads_add_idle(linux_dialog, &data); + p->gtk_main(); + return data.result; + } + #endif + //SDL message box //Button data @@ -716,7 +698,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title) //Messagebox data SDL_MessageBoxData data; - data.window = p->window; + data.window = NULL;//p->window; data.colorScheme = 0; data.title = title; data.message = body;