Skip to content

Commit

Permalink
Initial Apple TV / tvOS support.
Browse files Browse the repository at this point in the history
The Apple TV remote is currently exposed as a joystick with its touch surface treated as two axes. Key presses are also generated when its buttons and touch surface are used.

A new hint has been added to help deal with deciding whether to background the app when the remote's menu button is pressed: SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS.
  • Loading branch information
slime73 committed Sep 14, 2016
1 parent 86708c3 commit f050576
Show file tree
Hide file tree
Showing 21 changed files with 1,185 additions and 56 deletions.
199 changes: 199 additions & 0 deletions Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj
Expand Up @@ -10,6 +10,20 @@
1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
FA30DEB01BBF5A8F009C397F /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0060E26BC0500F39101 /* common.c */; };
FA30DEB11BBF5A93009C397F /* happy.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0080E26BC0500F39101 /* happy.c */; };
FA30DEB31BBF5AD7009C397F /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDB651CC0E43D19800F688B5 /* icon.bmp */; };
FA30DEB41BBF5ADD009C397F /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = FD925B180E0F276600E92347 /* Icon.png */; };
FA30DEB61BBF5AE6009C397F /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = FD787AA00E22A5CC003E8E36 /* Default.png */; };
FA30DEB71BBF5BB8009C397F /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA30DEAC1BBF59D9009C397F /* libSDL2.a */; };
FA30DEC81BBF5C14009C397F /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
FA30DEC91BBF5C14009C397F /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDF0D7220E12D31800247964 /* AudioToolbox.framework */; };
FA30DECA1BBF5C14009C397F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDB96EDF0DEFC9DC00FAF19F /* QuartzCore.framework */; };
FA30DECB1BBF5C14009C397F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDB96ED30DEFC9C700FAF19F /* OpenGLES.framework */; };
FA30DECC1BBF5C14009C397F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
FA30DECD1BBF5C14009C397F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
FA30DECE1BBF5C14009C397F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
FA30DECF1BBF5C14009C397F /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDF0D71D0E12D2AB00247964 /* CoreAudio.framework */; };
FA8B4BA31967070A00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
FA8B4BA41967071300F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
FA8B4BA51967071A00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
Expand Down Expand Up @@ -168,6 +182,20 @@
remoteGlobalIDString = FD6526620DE8FCCB002AD96B;
remoteInfo = libSDL;
};
FA30DEAB1BBF59D9009C397F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = FAB598141BB5C1B100BE72C5;
remoteInfo = "libSDL-tv";
};
FA30DEAE1BBF5A69009C397F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = FAB598131BB5C1B100BE72C5;
remoteInfo = "libSDL-tv";
};
FD1B489D0E313154007AB34E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */;
Expand All @@ -183,6 +211,7 @@
1D6058910D05DD3D006BFB54 /* Rectangles.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Rectangles.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FA30DE961BBF59D9009C397F /* Happy-TV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Happy-TV.app"; sourceTree = BUILT_PRODUCTS_DIR; };
FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
FAE0E9691BAF96A00098DFA4 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
FD15FCB20E086866003BDF25 /* Happy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Happy.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -237,6 +266,22 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
FA30DE931BBF59D9009C397F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FA30DEB71BBF5BB8009C397F /* libSDL2.a in Frameworks */,
FA30DEC81BBF5C14009C397F /* GameController.framework in Frameworks */,
FA30DEC91BBF5C14009C397F /* AudioToolbox.framework in Frameworks */,
FA30DECA1BBF5C14009C397F /* QuartzCore.framework in Frameworks */,
FA30DECB1BBF5C14009C397F /* OpenGLES.framework in Frameworks */,
FA30DECC1BBF5C14009C397F /* CoreGraphics.framework in Frameworks */,
FA30DECD1BBF5C14009C397F /* UIKit.framework in Frameworks */,
FA30DECE1BBF5C14009C397F /* Foundation.framework in Frameworks */,
FA30DECF1BBF5C14009C397F /* CoreAudio.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
FD15FCB00E086866003BDF25 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -352,6 +397,7 @@
FDF0D6A40E12D05400247964 /* Mixer.app */,
FDC52EDE0E2843D6008D768C /* Fireworks.app */,
FDB6520C0E43D1F300F688B5 /* Keyboard.app */,
FA30DE961BBF59D9009C397F /* Happy-TV.app */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -399,6 +445,7 @@
isa = PBXGroup;
children = (
FD1B489E0E313154007AB34E /* libSDL2.a */,
FA30DEAC1BBF59D9009C397F /* libSDL2.a */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -473,6 +520,24 @@
productReference = 1D6058910D05DD3D006BFB54 /* Rectangles.app */;
productType = "com.apple.product-type.application";
};
FA30DE951BBF59D9009C397F /* Happy-TV */ = {
isa = PBXNativeTarget;
buildConfigurationList = FA30DEAD1BBF59D9009C397F /* Build configuration list for PBXNativeTarget "Happy-TV" */;
buildPhases = (
FA30DE921BBF59D9009C397F /* Sources */,
FA30DE941BBF59D9009C397F /* Resources */,
FA30DE931BBF59D9009C397F /* Frameworks */,
);
buildRules = (
);
dependencies = (
FA30DEAF1BBF5A69009C397F /* PBXTargetDependency */,
);
name = "Happy-TV";
productName = "Happy-TV";
productReference = FA30DE961BBF59D9009C397F /* Happy-TV.app */;
productType = "com.apple.product-type.application";
};
FD15FCB10E086866003BDF25 /* Happy */ = {
isa = PBXNativeTarget;
buildConfigurationList = FD15FCB70E086867003BDF25 /* Build configuration list for PBXNativeTarget "Happy" */;
Expand Down Expand Up @@ -588,6 +653,12 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0630;
TargetAttributes = {
FA30DE951BBF59D9009C397F = {
CreatedOnToolsVersion = 7.1;
DevelopmentTeam = DJN9C5VR5G;
};
};
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Demos" */;
compatibilityVersion = "Xcode 3.2";
Expand All @@ -598,6 +669,7 @@
Japanese,
French,
German,
Base,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
Expand All @@ -611,6 +683,7 @@
targets = (
1D6058900D05DD3D006BFB54 /* Rectangles */,
FD15FCB10E086866003BDF25 /* Happy */,
FA30DE951BBF59D9009C397F /* Happy-TV */,
FD5F9BE30E0DEBEA008E885B /* Accel */,
FDC202DD0E107B1200ABAC90 /* Touch */,
FDF0D6920E12D05400247964 /* Mixer */,
Expand All @@ -621,6 +694,13 @@
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
FA30DEAC1BBF59D9009C397F /* libSDL2.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libSDL2.a;
remoteRef = FA30DEAB1BBF59D9009C397F /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
FD1B489E0E313154007AB34E /* libSDL2.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
Expand All @@ -640,6 +720,16 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
FA30DE941BBF59D9009C397F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FA30DEB31BBF5AD7009C397F /* icon.bmp in Resources */,
FA30DEB41BBF5ADD009C397F /* Icon.png in Resources */,
FA30DEB61BBF5AE6009C397F /* Default.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
FD15FCAE0E086866003BDF25 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -717,6 +807,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
FA30DE921BBF59D9009C397F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FA30DEB01BBF5A8F009C397F /* common.c in Sources */,
FA30DEB11BBF5A93009C397F /* happy.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
FD15FCAF0E086866003BDF25 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -809,6 +908,11 @@
name = libSDL;
targetProxy = 049F36A0130CD8A000FF080F /* PBXContainerItemProxy */;
};
FA30DEAF1BBF5A69009C397F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "libSDL-tv";
targetProxy = FA30DEAE1BBF5A69009C397F /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
Expand Down Expand Up @@ -852,6 +956,92 @@
};
name = Release;
};
FA30DEA71BBF59D9009C397F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.Happy-TV";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
};
FA30DEA81BBF59D9009C397F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.Happy-TV";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
FD15FCB50E086866003BDF25 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
Expand Down Expand Up @@ -982,6 +1172,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
FA30DEAD1BBF59D9009C397F /* Build configuration list for PBXNativeTarget "Happy-TV" */ = {
isa = XCConfigurationList;
buildConfigurations = (
FA30DEA71BBF59D9009C397F /* Debug */,
FA30DEA81BBF59D9009C397F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
FD15FCB70E086867003BDF25 /* Build configuration list for PBXNativeTarget "Happy" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
5 changes: 5 additions & 0 deletions Xcode-iOS/Demos/src/common.h
Expand Up @@ -4,8 +4,13 @@
* use however you want
*/

#if __TVOS__
#define SCREEN_WIDTH 1920
#define SCREEN_HEIGHT 1080
#else
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 480
#endif

extern int randomInt(int min, int max);
extern float randomFloat(float min, float max);
Expand Down

0 comments on commit f050576

Please sign in to comment.