Reorganizing Mac and Linux blocks and commence on retina support

This commit is contained in:
Vinyl Darkscratch 2016-12-13 21:16:33 -08:00
parent b3e3bdba30
commit 85da9ff7e8
8 changed files with 49 additions and 55 deletions

View file

@ -20,5 +20,9 @@
<string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key>
<string>10.7</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>

Binary file not shown.

View file

@ -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) \

View file

@ -44,6 +44,8 @@
#include <map>
#include <iostream>
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<int, SDL_Joystick*>::iterator jsit;
std::map<int, SDL_GameController*>::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;

View file

@ -40,6 +40,10 @@
#include <stack>
#ifdef __APPLE__
#define OS_OSX
#endif
#ifdef OS_OSX
#include <iconv.h>
#endif
@ -354,7 +358,7 @@ struct CacheEnumData
FileSystemPrivate *p;
std::stack<std::vector<std::string>*> 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;

View file

@ -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 */

View file

@ -19,18 +19,16 @@
#include <shlobj.h>
#include <SDL2/SDL_syswm.h>
#elif defined __APPLE__ || __linux__
#ifdef __APPLE__
#define OS_OSX
#else
#define OS_LINUX
#endif
#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
#include <dlfcn.h>
#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;