From 9682c8870b8ff5e4ac2e4c70b759f791c6f38c1f Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Mon, 9 Jul 2012 11:27:07 -0700 Subject: Import SDL release-1.2.15 Change-Id: I505c4aea24325cad475f217db5589814b4c75dbf --- .../English.lproj/InfoPlist.strings | Bin 0 -> 588 bytes .../English.lproj/SDLMain.nib/classes.nib | 19 + .../English.lproj/SDLMain.nib/info.nib | 21 ++ .../English.lproj/SDLMain.nib/objects.nib | Bin 0 -> 2590 bytes .../SDL Cocoa Application/Info.plist | 28 ++ .../SDL Cocoa Application/SDLApp_Prefix.pch | 9 + .../SDLCocoaApp.xcodeproj/TemplateInfo.plist | 12 + .../SDLCocoaApp.xcodeproj/project.pbxproj | 336 ++++++++++++++++++ .../SDL Cocoa Application/SDLMain.h | 16 + .../SDL Cocoa Application/SDLMain.m | 383 +++++++++++++++++++++ .../SDL Cocoa Application/main.c | 65 ++++ 11 files changed, 889 insertions(+) create mode 100755 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/InfoPlist.strings create mode 100644 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/classes.nib create mode 100644 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/info.nib create mode 100644 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/objects.nib create mode 100644 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/Info.plist create mode 100644 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLApp_Prefix.pch create mode 100644 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLCocoaApp.xcodeproj/TemplateInfo.plist create mode 100644 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLCocoaApp.xcodeproj/project.pbxproj create mode 100644 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.h create mode 100644 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.m create mode 100644 distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/main.c (limited to 'distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application') diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/InfoPlist.strings b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/InfoPlist.strings new file mode 100755 index 0000000..e612457 Binary files /dev/null and b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/InfoPlist.strings differ diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/classes.nib b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/classes.nib new file mode 100644 index 0000000..799eaad --- /dev/null +++ b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/classes.nib @@ -0,0 +1,19 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = { + help = id; + newGame = id; + openGame = id; + prefsMenu = id; + saveGame = id; + saveGameAs = id; + }; + CLASS = SDLMain; + LANGUAGE = ObjC; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/info.nib b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/info.nib new file mode 100644 index 0000000..1d6fb7e --- /dev/null +++ b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/info.nib @@ -0,0 +1,21 @@ + + + + + IBDocumentLocation + 62 117 356 240 0 0 1152 848 + IBEditorPositions + + 29 + 62 362 195 44 0 0 1152 848 + + IBFramework Version + 291.0 + IBOpenObjects + + 29 + + IBSystem Version + 6L60 + + diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/objects.nib b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/objects.nib new file mode 100644 index 0000000..6378015 Binary files /dev/null and b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/English.lproj/SDLMain.nib/objects.nib differ diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/Info.plist b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/Info.plist new file mode 100644 index 0000000..c678d11 --- /dev/null +++ b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.«PROJECTNAMEASXML» + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + SDLMain + NSPrincipalClass + NSApplication + + diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLApp_Prefix.pch b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLApp_Prefix.pch new file mode 100644 index 0000000..0009507 --- /dev/null +++ b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLApp_Prefix.pch @@ -0,0 +1,9 @@ +// +// Prefix header for all source files of the 'ÇPROJECTNAMEÈ' target in the 'ÇPROJECTNAMEÈ' project +// + +#include "SDL.h" + +#ifdef __OBJC__ + #import +#endif diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLCocoaApp.xcodeproj/TemplateInfo.plist b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLCocoaApp.xcodeproj/TemplateInfo.plist new file mode 100644 index 0000000..1dcbea2 --- /dev/null +++ b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLCocoaApp.xcodeproj/TemplateInfo.plist @@ -0,0 +1,12 @@ +{ + FilesToRename = { + "SDLApp_Prefix.pch" = "ÇPROJECTNAMEÈ_Prefix.pch"; + }; + FilesToMacroExpand = ( + "ÇPROJECTNAMEÈ_Prefix.pch", + "Info.plist", + "English.lproj/InfoPlist.strings", + "main.c", + ); + Description = "This project builds an SDL-based application with Cocoa menus."; +} diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLCocoaApp.xcodeproj/project.pbxproj b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLCocoaApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5859662 --- /dev/null +++ b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLCocoaApp.xcodeproj/project.pbxproj @@ -0,0 +1,336 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 002F39FA09D0881F00EBEB88 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; }; + 002F3A0009D0884600EBEB88 /* SDL.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; }; + 002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 002F3A2C09D0888800EBEB88 /* SDLMain.m */; }; + 002F3A3F09D088BA00EBEB88 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F3A3E09D088BA00EBEB88 /* main.c */; }; + 002F3AF109D08F1000EBEB88 /* SDLMain.nib in Resources */ = {isa = PBXBuildFile; fileRef = 002F3AEF09D08F1000EBEB88 /* SDLMain.nib */; }; + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXBuildStyle section */ + 4A9504CCFFE6A4B311CA0CBA /* Debug */ = { + isa = PBXBuildStyle; + buildSettings = { + }; + name = Debug; + }; + 4A9504CDFFE6A4B311CA0CBA /* Release */ = { + isa = PBXBuildStyle; + buildSettings = { + }; + name = Release; + }; +/* End PBXBuildStyle section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 002F3A0009D0884600EBEB88 /* SDL.framework in Copy Frameworks into .app bundle */, + ); + name = "Copy Frameworks into .app bundle"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 002F39F909D0881F00EBEB88 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = ""; }; + 002F3A2B09D0888800EBEB88 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = SOURCE_ROOT; }; + 002F3A2C09D0888800EBEB88 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = SOURCE_ROOT; }; + 002F3A3E09D088BA00EBEB88 /* main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = SOURCE_ROOT; }; + 002F3AF009D08F1000EBEB88 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/SDLMain.nib; sourceTree = ""; }; + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32CA4F630368D1EE00C91783 /* «PROJECTNAME»_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file; path = "«PROJECTNAME»_Prefix.pch"; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* «PROJECTNAME».app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "«PROJECTNAME».app"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 002F39FA09D0881F00EBEB88 /* SDL.framework in Frameworks */, + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 002F3A2B09D0888800EBEB88 /* SDLMain.h */, + 002F3A2C09D0888800EBEB88 /* SDLMain.m */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 002F39F909D0881F00EBEB88 /* SDL.framework */, + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* «PROJECTNAME».app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* «PROJECTNAMEASXML» */ = { + isa = PBXGroup; + children = ( + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = "«PROJECTNAMEASXML»"; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* «PROJECTNAME»_Prefix.pch */, + 002F3A3E09D088BA00EBEB88 /* main.c */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 8D1107310486CEB800E47090 /* Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 002F3AEF09D08F1000EBEB88 /* SDLMain.nib */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* «PROJECTNAME» */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "«PROJECTNAME»" */; + buildPhases = ( + 8D1107290486CEB800E47090 /* Resources */, + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + 002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */, + ); + buildRules = ( + ); + buildSettings = { + }; + dependencies = ( + ); + name = "«PROJECTNAME»"; + productInstallPath = "$(HOME)/Applications"; + productName = "«PROJECTNAME»"; + productReference = 8D1107320486CEB800E47090 /* «PROJECTNAME».app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SDLCocoaApp" */; + buildSettings = { + }; + buildStyles = ( + 4A9504CCFFE6A4B311CA0CBA /* Debug */, + 4A9504CDFFE6A4B311CA0CBA /* Release */, + ); + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* «PROJECTNAMEASXML» */; + projectDirPath = ""; + targets = ( + 8D1107260486CEB800E47090 /* «PROJECTNAME» */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D1107290486CEB800E47090 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 002F3AF109D08F1000EBEB88 /* SDLMain.nib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 002F3A2E09D0888800EBEB88 /* SDLMain.m in Sources */, + 002F3A3F09D088BA00EBEB88 /* main.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 002F3AEF09D08F1000EBEB88 /* SDLMain.nib */ = { + isa = PBXVariantGroup; + children = ( + 002F3AF009D08F1000EBEB88 /* English */, + ); + name = SDLMain.nib; + sourceTree = ""; + }; + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = "«PROJECTNAME»"; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = "«PROJECTNAME»"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(HOME)/Library/Frameworks", + /Library/Frameworks, + "$(FRAMEWORK_SEARCH_PATHS)", + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(HOME)/Library/Frameworks/SDL.framework/Headers", + /Library/Frameworks/SDL.framework/Headers, + "$(HEADER_SEARCH_PATHS)", + ); + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(HOME)/Library/Frameworks", + /Library/Frameworks, + "$(FRAMEWORK_SEARCH_PATHS)", + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(HOME)/Library/Frameworks/SDL.framework/Headers", + /Library/Frameworks/SDL.framework/Headers, + "$(HEADER_SEARCH_PATHS)", + ); + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "«PROJECTNAME»" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SDLCocoaApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.h b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.h new file mode 100644 index 0000000..c56d90c --- /dev/null +++ b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.h @@ -0,0 +1,16 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + Initial Version: Darrell Walisser + Non-NIB-Code & other changes: Max Horn + + Feel free to customize this file to suit your needs +*/ + +#ifndef _SDLMain_h_ +#define _SDLMain_h_ + +#import + +@interface SDLMain : NSObject +@end + +#endif /* _SDLMain_h_ */ diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.m b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.m new file mode 100644 index 0000000..b065a20 --- /dev/null +++ b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/SDLMain.m @@ -0,0 +1,383 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + Initial Version: Darrell Walisser + Non-NIB-Code & other changes: Max Horn + + Feel free to customize this file to suit your needs +*/ + +#include "SDL.h" +#include "SDLMain.h" +#include /* for MAXPATHLEN */ +#include + +/* For some reaon, Apple removed setAppleMenu from the headers in 10.4, + but the method still is there and works. To avoid warnings, we declare + it ourselves here. */ +@interface NSApplication(SDL_Missing_Methods) +- (void)setAppleMenu:(NSMenu *)menu; +@end + +/* Use this flag to determine whether we use SDLMain.nib or not */ +#define SDL_USE_NIB_FILE 0 + +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + +static int gArgc; +static char **gArgv; +static BOOL gFinderLaunch; +static BOOL gCalledAppMainline = FALSE; + +static NSString *getApplicationName(void) +{ + const NSDictionary *dict; + NSString *appName = 0; + + /* Determine the application name */ + dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); + if (dict) + appName = [dict objectForKey: @"CFBundleName"]; + + if (![appName length]) + appName = [[NSProcessInfo processInfo] processName]; + + return appName; +} + +#if SDL_USE_NIB_FILE +/* A helper category for NSString */ +@interface NSString (ReplaceSubString) +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; +@end +#endif + +@interface SDLApplication : NSApplication +@end + +@implementation SDLApplication +/* Invoked from the Quit menu item */ +- (void)terminate:(id)sender +{ + /* Post a SDL_QUIT event */ + SDL_Event event; + event.type = SDL_QUIT; + SDL_PushEvent(&event); +} +@end + +/* The main class of the application, the application's delegate */ +@implementation SDLMain + +/* Set the working directory to the .app's parent directory */ +- (void) setupWorkingDirectory:(BOOL)shouldChdir +{ + if (shouldChdir) + { + char parentdir[MAXPATHLEN]; + CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); + if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) { + chdir(parentdir); /* chdir to the binary app's parent */ + } + CFRelease(url); + CFRelease(url2); + } +} + +#if SDL_USE_NIB_FILE + +/* Fix menu to contain the real app name instead of "SDL App" */ +- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName +{ + NSRange aRange; + NSEnumerator *enumerator; + NSMenuItem *menuItem; + + aRange = [[aMenu title] rangeOfString:@"SDL App"]; + if (aRange.length != 0) + [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]]; + + enumerator = [[aMenu itemArray] objectEnumerator]; + while ((menuItem = [enumerator nextObject])) + { + aRange = [[menuItem title] rangeOfString:@"SDL App"]; + if (aRange.length != 0) + [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; + if ([menuItem hasSubmenu]) + [self fixMenu:[menuItem submenu] withAppName:appName]; + } + [ aMenu sizeToFit ]; +} + +#else + +static void setApplicationMenu(void) +{ + /* warning: this code is very odd */ + NSMenu *appleMenu; + NSMenuItem *menuItem; + NSString *title; + NSString *appName; + + appName = getApplicationName(); + appleMenu = [[NSMenu alloc] initWithTitle:@""]; + + /* Add menu items */ + title = [@"About " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Hide " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; + + menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; + [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + + [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Quit " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; + + + /* Put menu into the menubar */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:appleMenu]; + [[NSApp mainMenu] addItem:menuItem]; + + /* Tell the application object that this is now the application menu */ + [NSApp setAppleMenu:appleMenu]; + + /* Finally give up our references to the objects */ + [appleMenu release]; + [menuItem release]; +} + +/* Create a window menu */ +static void setupWindowMenu(void) +{ + NSMenu *windowMenu; + NSMenuItem *windowMenuItem; + NSMenuItem *menuItem; + + windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; + + /* "Minimize" item */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; + [windowMenu addItem:menuItem]; + [menuItem release]; + + /* Put menu into the menubar */ + windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; + [windowMenuItem setSubmenu:windowMenu]; + [[NSApp mainMenu] addItem:windowMenuItem]; + + /* Tell the application object that this is now the window menu */ + [NSApp setWindowsMenu:windowMenu]; + + /* Finally give up our references to the objects */ + [windowMenu release]; + [windowMenuItem release]; +} + +/* Replacement for NSApplicationMain */ +static void CustomApplicationMain (int argc, char **argv) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + SDLMain *sdlMain; + + /* Ensure the application object is initialised */ + [SDLApplication sharedApplication]; + +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [SDLApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ + + /* Set up the menubar */ + [NSApp setMainMenu:[[NSMenu alloc] init]]; + setApplicationMenu(); + setupWindowMenu(); + + /* Create SDLMain and make it the app delegate */ + sdlMain = [[SDLMain alloc] init]; + [NSApp setDelegate:sdlMain]; + + /* Start the main event loop */ + [NSApp run]; + + [sdlMain release]; + [pool release]; +} + +#endif + + +/* + * Catch document open requests...this lets us notice files when the app + * was launched by double-clicking a document, or when a document was + * dragged/dropped on the app's icon. You need to have a + * CFBundleDocumentsType section in your Info.plist to get this message, + * apparently. + * + * Files are added to gArgv, so to the app, they'll look like command line + * arguments. Previously, apps launched from the finder had nothing but + * an argv[0]. + * + * This message may be received multiple times to open several docs on launch. + * + * This message is ignored once the app's mainline has been called. + */ +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename +{ + const char *temparg; + size_t arglen; + char *arg; + char **newargv; + + if (!gFinderLaunch) /* MacOS is passing command line args. */ + return FALSE; + + if (gCalledAppMainline) /* app has started, ignore this document. */ + return FALSE; + + temparg = [filename UTF8String]; + arglen = SDL_strlen(temparg) + 1; + arg = (char *) SDL_malloc(arglen); + if (arg == NULL) + return FALSE; + + newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2)); + if (newargv == NULL) + { + SDL_free(arg); + return FALSE; + } + gArgv = newargv; + + SDL_strlcpy(arg, temparg, arglen); + gArgv[gArgc++] = arg; + gArgv[gArgc] = NULL; + return TRUE; +} + + +/* Called when the internal event loop has just started running */ +- (void) applicationDidFinishLaunching: (NSNotification *) note +{ + int status; + + /* Set the working directory to the .app's parent directory */ + [self setupWorkingDirectory:gFinderLaunch]; + +#if SDL_USE_NIB_FILE + /* Set the main menu to contain the real app name instead of "SDL App" */ + [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()]; +#endif + + /* Hand off to main application code */ + gCalledAppMainline = TRUE; + status = SDL_main (gArgc, gArgv); + + /* We're done, thank you for playing */ + exit(status); +} +@end + + +@implementation NSString (ReplaceSubString) + +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString +{ + unsigned int bufferSize; + unsigned int selfLen = [self length]; + unsigned int aStringLen = [aString length]; + unichar *buffer; + NSRange localRange; + NSString *result; + + bufferSize = selfLen + aStringLen - aRange.length; + buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar)); + + /* Get first part into buffer */ + localRange.location = 0; + localRange.length = aRange.location; + [self getCharacters:buffer range:localRange]; + + /* Get middle part into buffer */ + localRange.location = 0; + localRange.length = aStringLen; + [aString getCharacters:(buffer+aRange.location) range:localRange]; + + /* Get last part into buffer */ + localRange.location = aRange.location + aRange.length; + localRange.length = selfLen - localRange.location; + [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange]; + + /* Build output string */ + result = [NSString stringWithCharacters:buffer length:bufferSize]; + + NSDeallocateMemoryPages(buffer, bufferSize); + + return result; +} + +@end + + + +#ifdef main +# undef main +#endif + + +/* Main entry point to executable - should *not* be SDL_main! */ +int main (int argc, char **argv) +{ + /* Copy the arguments into a global variable */ + /* This is passed if we are launched by double-clicking */ + if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { + gArgv = (char **) SDL_malloc(sizeof (char *) * 2); + gArgv[0] = argv[0]; + gArgv[1] = NULL; + gArgc = 1; + gFinderLaunch = YES; + } else { + int i; + gArgc = argc; + gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1)); + for (i = 0; i <= argc; i++) + gArgv[i] = argv[i]; + gFinderLaunch = NO; + } + +#if SDL_USE_NIB_FILE + [SDLApplication poseAsClass:[NSApplication class]]; + NSApplicationMain (argc, argv); +#else + CustomApplicationMain (argc, argv); +#endif + return 0; +} + diff --git a/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/main.c b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/main.c new file mode 100644 index 0000000..7115de9 --- /dev/null +++ b/distrib/sdl-1.2.15/Xcode/TemplatesForXcodeTiger/SDL Cocoa Application/main.c @@ -0,0 +1,65 @@ + +/* Simple program: Create a blank window, wait for keypress, quit. + + Please see the SDL documentation for details on using the SDL API: + /Developer/Documentation/SDL/docs.html +*/ + +#include +#include +#include +#include + +#include "SDL.h" + +int main(int argc, char *argv[]) +{ + Uint32 initflags = SDL_INIT_VIDEO; /* See documentation for details */ + SDL_Surface *screen; + Uint8 video_bpp = 0; + Uint32 videoflags = SDL_SWSURFACE; + int done; + SDL_Event event; + + /* Initialize the SDL library */ + if ( SDL_Init(initflags) < 0 ) { + fprintf(stderr, "Couldn't initialize SDL: %s\n", + SDL_GetError()); + exit(1); + } + + /* Set 640x480 video mode */ + screen=SDL_SetVideoMode(640,480, video_bpp, videoflags); + if (screen == NULL) { + fprintf(stderr, "Couldn't set 640x480x%d video mode: %s\n", + video_bpp, SDL_GetError()); + SDL_Quit(); + exit(2); + } + + done = 0; + while ( !done ) { + + /* Check for events */ + while ( SDL_PollEvent(&event) ) { + switch (event.type) { + + case SDL_MOUSEMOTION: + break; + case SDL_MOUSEBUTTONDOWN: + break; + case SDL_KEYDOWN: + /* Any keypress quits the app... */ + case SDL_QUIT: + done = 1; + break; + default: + break; + } + } + } + + /* Clean up the SDL library */ + SDL_Quit(); + return(0); +} -- cgit v1.1