case SDL_MOUSEBUTTONDOWN:
{
val = clamp_sdl_mouse_button(e.button.button);
- if (val >= 0)
+ if ((val >= 0) && (val <= 2))
{
if (val == 0)
- {
g_button = true;
- SetKey(MAC_MOUSEBUTTON1);
- }
-
- else if (val == 1)
- SetKey(MAC_MOUSEBUTTON2);
-
buttons[val] = true;
}
}
case SDL_MOUSEBUTTONUP:
{
val = clamp_sdl_mouse_button(e.button.button);
- if (val >= 0)
+ if ((val >= 0) && (val <= 2))
{
if (val == 0)
- {
g_button = false;
- ClearKey(MAC_MOUSEBUTTON1);
- }
-
- else if (val == 1)
- ClearKey(MAC_MOUSEBUTTON2);
-
buttons[val] = false;
}
}
if (!cmdline("windowed"))
sdlflags |= SDL_FULLSCREEN;
- SDL_WM_SetCaption("Lugaru", "lugaru");
+ SDL_WM_SetCaption("Lugaru", "Lugaru");
SDL_ShowCursor(0);
#ifdef WIN32
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
+#elif (defined(__APPLE__) && defined(__MACH__))
+ const char *fmt = "open '%s'";
+ const size_t len = strlen(fmt) + strlen(url) + 16;
+ char *buf = new char[len];
+ snprintf(buf, len, fmt, url);
+ system(buf);
+ delete[] buf;
+
#elif PLATFORM_LINUX
const char *fmt = "PATH=$PATH:. xdg-open '%s'";
const size_t len = strlen(fmt) + strlen(url) + 16;
char *dir = calcBaseDir(argv0);
if (dir)
{
+ #if (defined(__APPLE__) && defined(__MACH__))
+ // Chop off /Contents/MacOS if it's at the end of the string, so we
+ // land in the base of the app bundle.
+ const size_t len = strlen(dir);
+ const char *bundledirs = "/Contents/MacOS";
+ const size_t bundledirslen = strlen(bundledirs);
+ if (len > bundledirslen)
+ {
+ char *ptr = (dir + len) - bundledirslen;
+ if (strcasecmp(ptr, bundledirs) == 0)
+ *ptr = '\0';
+ }
+ #endif
chdir(dir);
free(dir);
}
// if(game.registernow){
if(regnow)
{
- #if PLATFORM_LINUX // (this may not be necessary any more.)
- launch_web_browser("http://www.wolfire.com/registerlinux.html");
+ #if (defined(__APPLE__) && defined(__MACH__))
+ launch_web_browser("http://www.wolfire.com/purchase/lugaru/mac");
+ #elif PLATFORM_LINUX
+ launch_web_browser("http://www.wolfire.com/purchase/lugaru/linux");
#else
- launch_web_browser("http://www.wolfire.com/registerpc.html");
+ launch_web_browser("http://www.wolfire.com/purchase/lugaru/pc");
#endif
}