Skip to content

Commit 398a513

Browse files
committed
Initial Apple TV / tvOS support.
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.
1 parent 5935e90 commit 398a513

File tree

21 files changed

+1185
-56
lines changed

21 files changed

+1185
-56
lines changed

Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@
1010
1D3623EC0D0F72F000981E51 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
1111
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1212
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
13+
FA30DEB01BBF5A8F009C397F /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0060E26BC0500F39101 /* common.c */; };
14+
FA30DEB11BBF5A93009C397F /* happy.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0080E26BC0500F39101 /* happy.c */; };
15+
FA30DEB31BBF5AD7009C397F /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDB651CC0E43D19800F688B5 /* icon.bmp */; };
16+
FA30DEB41BBF5ADD009C397F /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = FD925B180E0F276600E92347 /* Icon.png */; };
17+
FA30DEB61BBF5AE6009C397F /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = FD787AA00E22A5CC003E8E36 /* Default.png */; };
18+
FA30DEB71BBF5BB8009C397F /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA30DEAC1BBF59D9009C397F /* libSDL2.a */; };
19+
FA30DEC81BBF5C14009C397F /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; };
20+
FA30DEC91BBF5C14009C397F /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDF0D7220E12D31800247964 /* AudioToolbox.framework */; };
21+
FA30DECA1BBF5C14009C397F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDB96EDF0DEFC9DC00FAF19F /* QuartzCore.framework */; };
22+
FA30DECB1BBF5C14009C397F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDB96ED30DEFC9C700FAF19F /* OpenGLES.framework */; };
23+
FA30DECC1BBF5C14009C397F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3623EB0D0F72F000981E51 /* CoreGraphics.framework */; };
24+
FA30DECD1BBF5C14009C397F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
25+
FA30DECE1BBF5C14009C397F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
26+
FA30DECF1BBF5C14009C397F /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDF0D71D0E12D2AB00247964 /* CoreAudio.framework */; };
1327
FA8B4BA31967070A00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
1428
FA8B4BA41967071300F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
1529
FA8B4BA51967071A00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
@@ -168,6 +182,20 @@
168182
remoteGlobalIDString = FD6526620DE8FCCB002AD96B;
169183
remoteInfo = libSDL;
170184
};
185+
FA30DEAB1BBF59D9009C397F /* PBXContainerItemProxy */ = {
186+
isa = PBXContainerItemProxy;
187+
containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */;
188+
proxyType = 2;
189+
remoteGlobalIDString = FAB598141BB5C1B100BE72C5;
190+
remoteInfo = "libSDL-tv";
191+
};
192+
FA30DEAE1BBF5A69009C397F /* PBXContainerItemProxy */ = {
193+
isa = PBXContainerItemProxy;
194+
containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */;
195+
proxyType = 1;
196+
remoteGlobalIDString = FAB598131BB5C1B100BE72C5;
197+
remoteInfo = "libSDL-tv";
198+
};
171199
FD1B489D0E313154007AB34E /* PBXContainerItemProxy */ = {
172200
isa = PBXContainerItemProxy;
173201
containerPortal = FD1B48920E313154007AB34E /* SDL.xcodeproj */;
@@ -183,6 +211,7 @@
183211
1D6058910D05DD3D006BFB54 /* Rectangles.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Rectangles.app; sourceTree = BUILT_PRODUCTS_DIR; };
184212
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
185213
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
214+
FA30DE961BBF59D9009C397F /* Happy-TV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Happy-TV.app"; sourceTree = BUILT_PRODUCTS_DIR; };
186215
FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
187216
FAE0E9691BAF96A00098DFA4 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
188217
FD15FCB20E086866003BDF25 /* Happy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Happy.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -237,6 +266,22 @@
237266
);
238267
runOnlyForDeploymentPostprocessing = 0;
239268
};
269+
FA30DE931BBF59D9009C397F /* Frameworks */ = {
270+
isa = PBXFrameworksBuildPhase;
271+
buildActionMask = 2147483647;
272+
files = (
273+
FA30DEB71BBF5BB8009C397F /* libSDL2.a in Frameworks */,
274+
FA30DEC81BBF5C14009C397F /* GameController.framework in Frameworks */,
275+
FA30DEC91BBF5C14009C397F /* AudioToolbox.framework in Frameworks */,
276+
FA30DECA1BBF5C14009C397F /* QuartzCore.framework in Frameworks */,
277+
FA30DECB1BBF5C14009C397F /* OpenGLES.framework in Frameworks */,
278+
FA30DECC1BBF5C14009C397F /* CoreGraphics.framework in Frameworks */,
279+
FA30DECD1BBF5C14009C397F /* UIKit.framework in Frameworks */,
280+
FA30DECE1BBF5C14009C397F /* Foundation.framework in Frameworks */,
281+
FA30DECF1BBF5C14009C397F /* CoreAudio.framework in Frameworks */,
282+
);
283+
runOnlyForDeploymentPostprocessing = 0;
284+
};
240285
FD15FCB00E086866003BDF25 /* Frameworks */ = {
241286
isa = PBXFrameworksBuildPhase;
242287
buildActionMask = 2147483647;
@@ -352,6 +397,7 @@
352397
FDF0D6A40E12D05400247964 /* Mixer.app */,
353398
FDC52EDE0E2843D6008D768C /* Fireworks.app */,
354399
FDB6520C0E43D1F300F688B5 /* Keyboard.app */,
400+
FA30DE961BBF59D9009C397F /* Happy-TV.app */,
355401
);
356402
name = Products;
357403
sourceTree = "<group>";
@@ -399,6 +445,7 @@
399445
isa = PBXGroup;
400446
children = (
401447
FD1B489E0E313154007AB34E /* libSDL2.a */,
448+
FA30DEAC1BBF59D9009C397F /* libSDL2.a */,
402449
);
403450
name = Products;
404451
sourceTree = "<group>";
@@ -473,6 +520,24 @@
473520
productReference = 1D6058910D05DD3D006BFB54 /* Rectangles.app */;
474521
productType = "com.apple.product-type.application";
475522
};
523+
FA30DE951BBF59D9009C397F /* Happy-TV */ = {
524+
isa = PBXNativeTarget;
525+
buildConfigurationList = FA30DEAD1BBF59D9009C397F /* Build configuration list for PBXNativeTarget "Happy-TV" */;
526+
buildPhases = (
527+
FA30DE921BBF59D9009C397F /* Sources */,
528+
FA30DE941BBF59D9009C397F /* Resources */,
529+
FA30DE931BBF59D9009C397F /* Frameworks */,
530+
);
531+
buildRules = (
532+
);
533+
dependencies = (
534+
FA30DEAF1BBF5A69009C397F /* PBXTargetDependency */,
535+
);
536+
name = "Happy-TV";
537+
productName = "Happy-TV";
538+
productReference = FA30DE961BBF59D9009C397F /* Happy-TV.app */;
539+
productType = "com.apple.product-type.application";
540+
};
476541
FD15FCB10E086866003BDF25 /* Happy */ = {
477542
isa = PBXNativeTarget;
478543
buildConfigurationList = FD15FCB70E086867003BDF25 /* Build configuration list for PBXNativeTarget "Happy" */;
@@ -588,6 +653,12 @@
588653
isa = PBXProject;
589654
attributes = {
590655
LastUpgradeCheck = 0630;
656+
TargetAttributes = {
657+
FA30DE951BBF59D9009C397F = {
658+
CreatedOnToolsVersion = 7.1;
659+
DevelopmentTeam = DJN9C5VR5G;
660+
};
661+
};
591662
};
592663
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Demos" */;
593664
compatibilityVersion = "Xcode 3.2";
@@ -598,6 +669,7 @@
598669
Japanese,
599670
French,
600671
German,
672+
Base,
601673
);
602674
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
603675
projectDirPath = "";
@@ -611,6 +683,7 @@
611683
targets = (
612684
1D6058900D05DD3D006BFB54 /* Rectangles */,
613685
FD15FCB10E086866003BDF25 /* Happy */,
686+
FA30DE951BBF59D9009C397F /* Happy-TV */,
614687
FD5F9BE30E0DEBEA008E885B /* Accel */,
615688
FDC202DD0E107B1200ABAC90 /* Touch */,
616689
FDF0D6920E12D05400247964 /* Mixer */,
@@ -621,6 +694,13 @@
621694
/* End PBXProject section */
622695

623696
/* Begin PBXReferenceProxy section */
697+
FA30DEAC1BBF59D9009C397F /* libSDL2.a */ = {
698+
isa = PBXReferenceProxy;
699+
fileType = archive.ar;
700+
path = libSDL2.a;
701+
remoteRef = FA30DEAB1BBF59D9009C397F /* PBXContainerItemProxy */;
702+
sourceTree = BUILT_PRODUCTS_DIR;
703+
};
624704
FD1B489E0E313154007AB34E /* libSDL2.a */ = {
625705
isa = PBXReferenceProxy;
626706
fileType = archive.ar;
@@ -640,6 +720,16 @@
640720
);
641721
runOnlyForDeploymentPostprocessing = 0;
642722
};
723+
FA30DE941BBF59D9009C397F /* Resources */ = {
724+
isa = PBXResourcesBuildPhase;
725+
buildActionMask = 2147483647;
726+
files = (
727+
FA30DEB31BBF5AD7009C397F /* icon.bmp in Resources */,
728+
FA30DEB41BBF5ADD009C397F /* Icon.png in Resources */,
729+
FA30DEB61BBF5AE6009C397F /* Default.png in Resources */,
730+
);
731+
runOnlyForDeploymentPostprocessing = 0;
732+
};
643733
FD15FCAE0E086866003BDF25 /* Resources */ = {
644734
isa = PBXResourcesBuildPhase;
645735
buildActionMask = 2147483647;
@@ -717,6 +807,15 @@
717807
);
718808
runOnlyForDeploymentPostprocessing = 0;
719809
};
810+
FA30DE921BBF59D9009C397F /* Sources */ = {
811+
isa = PBXSourcesBuildPhase;
812+
buildActionMask = 2147483647;
813+
files = (
814+
FA30DEB01BBF5A8F009C397F /* common.c in Sources */,
815+
FA30DEB11BBF5A93009C397F /* happy.c in Sources */,
816+
);
817+
runOnlyForDeploymentPostprocessing = 0;
818+
};
720819
FD15FCAF0E086866003BDF25 /* Sources */ = {
721820
isa = PBXSourcesBuildPhase;
722821
buildActionMask = 2147483647;
@@ -809,6 +908,11 @@
809908
name = libSDL;
810909
targetProxy = 049F36A0130CD8A000FF080F /* PBXContainerItemProxy */;
811910
};
911+
FA30DEAF1BBF5A69009C397F /* PBXTargetDependency */ = {
912+
isa = PBXTargetDependency;
913+
name = "libSDL-tv";
914+
targetProxy = FA30DEAE1BBF5A69009C397F /* PBXContainerItemProxy */;
915+
};
812916
/* End PBXTargetDependency section */
813917

814918
/* Begin XCBuildConfiguration section */
@@ -852,6 +956,92 @@
852956
};
853957
name = Release;
854958
};
959+
FA30DEA71BBF59D9009C397F /* Debug */ = {
960+
isa = XCBuildConfiguration;
961+
buildSettings = {
962+
ALWAYS_SEARCH_USER_PATHS = NO;
963+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
964+
CLANG_CXX_LIBRARY = "libc++";
965+
CLANG_ENABLE_MODULES = YES;
966+
CLANG_ENABLE_OBJC_ARC = YES;
967+
CLANG_WARN_BOOL_CONVERSION = YES;
968+
CLANG_WARN_CONSTANT_CONVERSION = YES;
969+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
970+
CLANG_WARN_EMPTY_BODY = YES;
971+
CLANG_WARN_ENUM_CONVERSION = YES;
972+
CLANG_WARN_INT_CONVERSION = YES;
973+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
974+
CLANG_WARN_UNREACHABLE_CODE = YES;
975+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
976+
COPY_PHASE_STRIP = NO;
977+
DEBUG_INFORMATION_FORMAT = dwarf;
978+
ENABLE_STRICT_OBJC_MSGSEND = YES;
979+
ENABLE_TESTABILITY = YES;
980+
GCC_C_LANGUAGE_STANDARD = gnu99;
981+
GCC_DYNAMIC_NO_PIC = NO;
982+
GCC_NO_COMMON_BLOCKS = YES;
983+
GCC_PREPROCESSOR_DEFINITIONS = (
984+
"DEBUG=1",
985+
"$(inherited)",
986+
);
987+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
988+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
989+
GCC_WARN_UNDECLARED_SELECTOR = YES;
990+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
991+
GCC_WARN_UNUSED_FUNCTION = YES;
992+
GCC_WARN_UNUSED_VARIABLE = YES;
993+
INFOPLIST_FILE = Info.plist;
994+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
995+
MTL_ENABLE_DEBUG_INFO = YES;
996+
PRODUCT_BUNDLE_IDENTIFIER = "com.Happy-TV";
997+
PRODUCT_NAME = "$(TARGET_NAME)";
998+
SDKROOT = appletvos;
999+
TARGETED_DEVICE_FAMILY = 3;
1000+
TVOS_DEPLOYMENT_TARGET = 9.0;
1001+
};
1002+
name = Debug;
1003+
};
1004+
FA30DEA81BBF59D9009C397F /* Release */ = {
1005+
isa = XCBuildConfiguration;
1006+
buildSettings = {
1007+
ALWAYS_SEARCH_USER_PATHS = NO;
1008+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
1009+
CLANG_CXX_LIBRARY = "libc++";
1010+
CLANG_ENABLE_MODULES = YES;
1011+
CLANG_ENABLE_OBJC_ARC = YES;
1012+
CLANG_WARN_BOOL_CONVERSION = YES;
1013+
CLANG_WARN_CONSTANT_CONVERSION = YES;
1014+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
1015+
CLANG_WARN_EMPTY_BODY = YES;
1016+
CLANG_WARN_ENUM_CONVERSION = YES;
1017+
CLANG_WARN_INT_CONVERSION = YES;
1018+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1019+
CLANG_WARN_UNREACHABLE_CODE = YES;
1020+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
1021+
COPY_PHASE_STRIP = NO;
1022+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1023+
ENABLE_NS_ASSERTIONS = NO;
1024+
ENABLE_STRICT_OBJC_MSGSEND = YES;
1025+
GCC_C_LANGUAGE_STANDARD = gnu99;
1026+
GCC_NO_COMMON_BLOCKS = YES;
1027+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
1028+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
1029+
GCC_WARN_UNDECLARED_SELECTOR = YES;
1030+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
1031+
GCC_WARN_UNUSED_FUNCTION = YES;
1032+
GCC_WARN_UNUSED_VARIABLE = YES;
1033+
INFOPLIST_FILE = Info.plist;
1034+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1035+
MTL_ENABLE_DEBUG_INFO = NO;
1036+
PRODUCT_BUNDLE_IDENTIFIER = "com.Happy-TV";
1037+
PRODUCT_NAME = "$(TARGET_NAME)";
1038+
SDKROOT = appletvos;
1039+
TARGETED_DEVICE_FAMILY = 3;
1040+
TVOS_DEPLOYMENT_TARGET = 9.0;
1041+
VALIDATE_PRODUCT = YES;
1042+
};
1043+
name = Release;
1044+
};
8551045
FD15FCB50E086866003BDF25 /* Debug */ = {
8561046
isa = XCBuildConfiguration;
8571047
buildSettings = {
@@ -982,6 +1172,15 @@
9821172
defaultConfigurationIsVisible = 0;
9831173
defaultConfigurationName = Release;
9841174
};
1175+
FA30DEAD1BBF59D9009C397F /* Build configuration list for PBXNativeTarget "Happy-TV" */ = {
1176+
isa = XCConfigurationList;
1177+
buildConfigurations = (
1178+
FA30DEA71BBF59D9009C397F /* Debug */,
1179+
FA30DEA81BBF59D9009C397F /* Release */,
1180+
);
1181+
defaultConfigurationIsVisible = 0;
1182+
defaultConfigurationName = Release;
1183+
};
9851184
FD15FCB70E086867003BDF25 /* Build configuration list for PBXNativeTarget "Happy" */ = {
9861185
isa = XCConfigurationList;
9871186
buildConfigurations = (

Xcode-iOS/Demos/src/common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
* use however you want
55
*/
66

7+
#if __TVOS__
8+
#define SCREEN_WIDTH 1920
9+
#define SCREEN_HEIGHT 1080
10+
#else
711
#define SCREEN_WIDTH 320
812
#define SCREEN_HEIGHT 480
13+
#endif
914

1015
extern int randomInt(int min, int max);
1116
extern float randomFloat(float min, float max);

0 commit comments

Comments
 (0)