mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 09:39:43 +01:00
iOS port (for desktop_version) (#1137)
This commit is contained in:
parent
6174d62f6f
commit
fa8517a521
13 changed files with 116 additions and 8 deletions
BIN
desktop_version/AppIcon.xcassets/AppIcon.appiconset/AppIcon.png
Normal file
BIN
desktop_version/AppIcon.xcassets/AppIcon.appiconset/AppIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 287 KiB |
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "AppIcon.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
|
"size" : "1024x1024"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
6
desktop_version/AppIcon.xcassets/Contents.json
Normal file
6
desktop_version/AppIcon.xcassets/Contents.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,7 +25,7 @@ option(REMOVE_ABSOLUTE_PATHS "If supported by the compiler, replace all absolute
|
||||||
|
|
||||||
|
|
||||||
# Architecture Flags
|
# Architecture Flags
|
||||||
if(APPLE)
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
# Wow, Apple is a huge jerk these days huh?
|
# Wow, Apple is a huge jerk these days huh?
|
||||||
set(OSX_10_9_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk)
|
set(OSX_10_9_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk)
|
||||||
if(NOT CMAKE_OSX_SYSROOT)
|
if(NOT CMAKE_OSX_SYSROOT)
|
||||||
|
@ -38,6 +38,8 @@ if(APPLE)
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
|
||||||
link_directories(/usr/local/lib)
|
link_directories(/usr/local/lib)
|
||||||
add_compile_options(-Werror=partial-availability)
|
add_compile_options(-Werror=partial-availability)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0) # SDL goes back to iOS 8.0, but modern Xcode doesn't
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(VVVVVV)
|
project(VVVVVV)
|
||||||
|
@ -48,7 +50,10 @@ endif()
|
||||||
|
|
||||||
# RPATH
|
# RPATH
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
if(APPLE)
|
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
|
set(BIN_LIBROOT "Frameworks")
|
||||||
|
set(BIN_RPATH "@executable_path/Frameworks")
|
||||||
|
elseif(APPLE)
|
||||||
set(BIN_LIBROOT "osx")
|
set(BIN_LIBROOT "osx")
|
||||||
set(BIN_RPATH "@executable_path/osx")
|
set(BIN_RPATH "@executable_path/osx")
|
||||||
elseif(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
elseif(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||||
|
@ -128,6 +133,9 @@ endif()
|
||||||
if(GOG)
|
if(GOG)
|
||||||
list(APPEND VVV_C_SRC src/GOGNetwork.c)
|
list(APPEND VVV_C_SRC src/GOGNetwork.c)
|
||||||
endif()
|
endif()
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
|
list(APPEND VVV_C_SRC src/SDL_uikit_main.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(VVV_SRC ${VVV_CXX_SRC} ${VVV_C_SRC})
|
set(VVV_SRC ${VVV_CXX_SRC} ${VVV_C_SRC})
|
||||||
|
|
||||||
|
@ -136,6 +144,30 @@ if(WIN32)
|
||||||
add_executable(VVVVVV WIN32 ${VVV_SRC} icon.rc)
|
add_executable(VVVVVV WIN32 ${VVV_SRC} icon.rc)
|
||||||
elseif(ANDROID)
|
elseif(ANDROID)
|
||||||
add_library(VVVVVV SHARED ${VVV_SRC})
|
add_library(VVVVVV SHARED ${VVV_SRC})
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
|
file(GLOB_RECURSE REPO_RESOURCES "fonts/*" "lang/*")
|
||||||
|
|
||||||
|
add_executable(VVVVVV MACOSX_BUNDLE ${VVV_SRC} ${DATA_ZIP} AppIcon.xcassets ${REPO_RESOURCES})
|
||||||
|
set_target_properties(VVVVVV PROPERTIES
|
||||||
|
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.distractionware.vvvvvvmobile"
|
||||||
|
XCODE_ATTRIBUTE_PRODUCT_NAME "VVVVVV"
|
||||||
|
XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" # iPhone, iPad
|
||||||
|
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION "2.5"
|
||||||
|
XCODE_ATTRIBUTE_MARKETING_VERSION "2.5"
|
||||||
|
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon
|
||||||
|
XCODE_ATTRIBUTE_GENERATE_INFOPLIST_FILE YES
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist"
|
||||||
|
XCODE_ATTRIBUTE_INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace YES
|
||||||
|
XCODE_ATTRIBUTE_INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents YES
|
||||||
|
RESOURCE "${DATA_ZIP};AppIcon.xcassets"
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(REPO_FILE ${REPO_RESOURCES})
|
||||||
|
file(RELATIVE_PATH REPO_FILE_REL "${CMAKE_CURRENT_SOURCE_DIR}" ${REPO_FILE})
|
||||||
|
get_filename_component(REPO_FILE_DIR ${REPO_FILE_REL} DIRECTORY)
|
||||||
|
set_property(SOURCE ${REPO_FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources/${REPO_FILE_DIR}")
|
||||||
|
source_group("Resources/${REPO_FILE_DIR}" FILES "${REPO_FILE}")
|
||||||
|
endforeach()
|
||||||
else()
|
else()
|
||||||
add_executable(VVVVVV ${VVV_SRC})
|
add_executable(VVVVVV ${VVV_SRC})
|
||||||
endif()
|
endif()
|
||||||
|
@ -419,6 +451,15 @@ elseif (EMSCRIPTEN)
|
||||||
target_compile_options(faudio-static PUBLIC -sUSE_SDL=2)
|
target_compile_options(faudio-static PUBLIC -sUSE_SDL=2)
|
||||||
target_link_libraries(faudio-static -sUSE_SDL=2)
|
target_link_libraries(faudio-static -sUSE_SDL=2)
|
||||||
endif()
|
endif()
|
||||||
|
elseif(DEFINED SDL2_FRAMEWORK)
|
||||||
|
message(STATUS "Using pre-defined SDL2 variable SDL2_FRAMEWORK")
|
||||||
|
target_include_directories(VVVVVV SYSTEM PRIVATE "$<BUILD_INTERFACE:${SDL2_FRAMEWORK}/Headers>")
|
||||||
|
target_link_libraries(VVVVVV ${SDL2_FRAMEWORK})
|
||||||
|
if(BUNDLE_DEPENDENCIES)
|
||||||
|
target_include_directories(faudio-static SYSTEM PRIVATE "$<BUILD_INTERFACE:${SDL2_FRAMEWORK}/Headers>")
|
||||||
|
target_link_libraries(faudio-static ${SDL2_FRAMEWORK})
|
||||||
|
endif()
|
||||||
|
set_target_properties(VVVVVV PROPERTIES XCODE_EMBED_FRAMEWORKS ${SDL2_FRAMEWORK})
|
||||||
else()
|
else()
|
||||||
# Only try to autodetect if both SDL2 variables aren't explicitly set
|
# Only try to autodetect if both SDL2 variables aren't explicitly set
|
||||||
find_package(SDL2 CONFIG)
|
find_package(SDL2 CONFIG)
|
||||||
|
|
8
desktop_version/Info.plist
Normal file
8
desktop_version/Info.plist
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>UIFileSharingEnabled</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -14,8 +14,8 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 29
|
minSdkVersion 29
|
||||||
targetSdkVersion 34
|
targetSdkVersion 34
|
||||||
versionCode 20004000
|
versionCode 20005000
|
||||||
versionName "2.4"
|
versionName "2.5"
|
||||||
applicationId "air.com.distractionware.vvvvvvmobile"
|
applicationId "air.com.distractionware.vvvvvvmobile"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
|
|
|
@ -178,7 +178,7 @@ bool BUTTONGLYPHS_keyboard_is_available(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
return !SDL_GetHintBoolean("SteamDeck", SDL_FALSE);
|
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);
|
SDL_snprintf(output, output_size, "%s/", externalStoragePath);
|
||||||
return 1;
|
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
|
#else
|
||||||
const char* prefDir = PHYSFS_getPrefDir("distractionware", "VVVVVV");
|
const char* prefDir = PHYSFS_getPrefDir("distractionware", "VVVVVV");
|
||||||
if (prefDir == NULL)
|
if (prefDir == NULL)
|
||||||
|
|
|
@ -377,7 +377,7 @@ void Game::init(void)
|
||||||
screenshot_border_timer = 0;
|
screenshot_border_timer = 0;
|
||||||
screenshot_saved_success = false;
|
screenshot_saved_success = false;
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
|
||||||
checkpoint_saving = true;
|
checkpoint_saving = true;
|
||||||
#else
|
#else
|
||||||
checkpoint_saving = false;
|
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
|
* If you're working on a tenfoot-only build, add a def that always
|
||||||
* returns true!
|
* returns true!
|
||||||
*/
|
*/
|
||||||
#ifdef __ANDROID__
|
#if defined(__ANDROID__) || defined(TARGET_OS_IPHONE)
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
return SDL_GetHintBoolean("SteamTenfoot", SDL_FALSE);
|
return SDL_GetHintBoolean("SteamTenfoot", SDL_FALSE);
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.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
|
// 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
|
#define VLOG_USE_SDL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -604,6 +604,8 @@ int main(int argc, char *argv[])
|
||||||
/* We already do the button swapping in ButtonGlyphs, disable SDL's swapping */
|
/* 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_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))
|
if(!FILESYSTEM_init(argv[0], baseDir, assetsPath, langDir, fontsDir))
|
||||||
{
|
{
|
||||||
vlog_error("Unable to initialize filesystem!");
|
vlog_error("Unable to initialize filesystem!");
|
||||||
|
|
Loading…
Reference in a new issue