mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
iOS port (for desktop_version) (#1137)
This commit is contained in:
@@ -178,7 +178,7 @@ bool BUTTONGLYPHS_keyboard_is_available(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
|
||||
return false;
|
||||
#else
|
||||
return !SDL_GetHintBoolean("SteamDeck", SDL_FALSE);
|
||||
|
||||
@@ -1331,6 +1331,19 @@ static int PLATFORM_getOSDirectory(char* output, const size_t output_size)
|
||||
}
|
||||
SDL_snprintf(output, output_size, "%s/", externalStoragePath);
|
||||
return 1;
|
||||
#elif defined(TARGET_OS_IPHONE)
|
||||
// (ab)use SDL APIs to get the path to the Documents folder without needing Objective-C
|
||||
const char* prefsPath = SDL_GetPrefPath("", "");
|
||||
if (prefsPath == NULL)
|
||||
{
|
||||
vlog_error(
|
||||
"Could not get OS directory: %s",
|
||||
SDL_GetError()
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
SDL_snprintf(output, output_size, "%s/../../Documents/", prefsPath);
|
||||
return 1;
|
||||
#else
|
||||
const char* prefDir = PHYSFS_getPrefDir("distractionware", "VVVVVV");
|
||||
if (prefDir == NULL)
|
||||
|
||||
@@ -377,7 +377,7 @@ void Game::init(void)
|
||||
screenshot_border_timer = 0;
|
||||
screenshot_saved_success = false;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
|
||||
checkpoint_saving = true;
|
||||
#else
|
||||
checkpoint_saving = false;
|
||||
|
||||
23
desktop_version/src/SDL_uikit_main.c
Normal file
23
desktop_version/src/SDL_uikit_main.c
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
SDL_uikit_main.c, placed in the public domain by Sam Lantinga 3/18/2019
|
||||
*/
|
||||
|
||||
/* Include the SDL main definition header */
|
||||
#include "SDL_main.h"
|
||||
|
||||
#if defined(__IPHONEOS__) || defined(__TVOS__)
|
||||
|
||||
#ifndef SDL_MAIN_HANDLED
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return SDL_UIKitRunApp(argc, argv, SDL_main);
|
||||
}
|
||||
#endif /* !SDL_MAIN_HANDLED */
|
||||
|
||||
#endif /* __IPHONEOS__ || __TVOS__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -383,7 +383,7 @@ bool Screen::isForcedFullscreen(void)
|
||||
* If you're working on a tenfoot-only build, add a def that always
|
||||
* returns true!
|
||||
*/
|
||||
#ifdef __ANDROID__
|
||||
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
|
||||
return true;
|
||||
#else
|
||||
return SDL_GetHintBoolean("SteamTenfoot", SDL_FALSE);
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
|
||||
// forward to SDL logging on Android, since stdout/stderr are /dev/null
|
||||
// they exist on iOS, but just get forwarded to the system log anyway, so might as well provide proper metadata
|
||||
#define VLOG_USE_SDL 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -604,6 +604,8 @@ int main(int argc, char *argv[])
|
||||
/* We already do the button swapping in ButtonGlyphs, disable SDL's swapping */
|
||||
SDL_SetHintWithPriority(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0", SDL_HINT_OVERRIDE);
|
||||
|
||||
SDL_SetHintWithPriority(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight", SDL_HINT_OVERRIDE);
|
||||
|
||||
if(!FILESYSTEM_init(argv[0], baseDir, assetsPath, langDir, fontsDir))
|
||||
{
|
||||
vlog_error("Unable to initialize filesystem!");
|
||||
|
||||
Reference in New Issue
Block a user