├── Game Frame.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── Game Frame.xccheckout └── xcuserdata │ └── fogleman.xcuserdatad │ └── xcschemes │ ├── Game Frame.xcscheme │ └── xcschememanagement.plist ├── Game Frame ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── MainMenu.xib ├── Game Frame-Info.plist ├── Game Frame-Prefix.pch ├── Resources │ ├── frame.png │ └── mask.png ├── Util.h ├── Util.m ├── View.h ├── View.m ├── Watcher.h ├── Watcher.m ├── Window.xib ├── WindowController.h ├── WindowController.m ├── en.lproj │ └── InfoPlist.strings └── main.m ├── Icon.icns └── README.md /Game Frame.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6922EA1918CE47D900971641 /* mask.png in Resources */ = {isa = PBXBuildFile; fileRef = 6922EA1818CE47D900971641 /* mask.png */; }; 11 | 6922EA1F18CE538600971641 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 6922EA1E18CE538600971641 /* Icon.icns */; }; 12 | 69E2DBBB18CFEC1D00C6AF0F /* frame.png in Resources */ = {isa = PBXBuildFile; fileRef = 69E2DBBA18CFEC1D00C6AF0F /* frame.png */; }; 13 | 69FE029F18CD367900608133 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 69FE029E18CD367900608133 /* Cocoa.framework */; }; 14 | 69FE02A918CD367900608133 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 69FE02A718CD367900608133 /* InfoPlist.strings */; }; 15 | 69FE02AB18CD367900608133 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 69FE02AA18CD367900608133 /* main.m */; }; 16 | 69FE02B218CD367900608133 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 69FE02B118CD367900608133 /* AppDelegate.m */; }; 17 | 69FE02B518CD367900608133 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 69FE02B318CD367900608133 /* MainMenu.xib */; }; 18 | 69FE02D418CD369900608133 /* View.m in Sources */ = {isa = PBXBuildFile; fileRef = 69FE02D318CD369900608133 /* View.m */; }; 19 | 69FE031A18CD3CD900608133 /* WindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 69FE031918CD3CD900608133 /* WindowController.m */; }; 20 | 69FE031C18CD3CEC00608133 /* Window.xib in Resources */ = {isa = PBXBuildFile; fileRef = 69FE031B18CD3CEC00608133 /* Window.xib */; }; 21 | 69FE031F18CD44D100608133 /* Util.m in Sources */ = {isa = PBXBuildFile; fileRef = 69FE031E18CD44D100608133 /* Util.m */; }; 22 | 69FE034318CD4BC000608133 /* Watcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 69FE034218CD4BC000608133 /* Watcher.m */; }; 23 | 69FE034518CD4F4E00608133 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 69FE034418CD4F4E00608133 /* CoreServices.framework */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 6922EA1818CE47D900971641 /* mask.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mask.png; sourceTree = ""; }; 28 | 6922EA1E18CE538600971641 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; 29 | 69E2DBBA18CFEC1D00C6AF0F /* frame.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = frame.png; sourceTree = ""; }; 30 | 69FE029B18CD367900608133 /* Game Frame.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Game Frame.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 69FE029E18CD367900608133 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 32 | 69FE02A118CD367900608133 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 33 | 69FE02A218CD367900608133 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 34 | 69FE02A318CD367900608133 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 35 | 69FE02A618CD367900608133 /* Game Frame-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Game Frame-Info.plist"; sourceTree = ""; }; 36 | 69FE02A818CD367900608133 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 37 | 69FE02AA18CD367900608133 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 38 | 69FE02AC18CD367900608133 /* Game Frame-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Game Frame-Prefix.pch"; sourceTree = ""; }; 39 | 69FE02B018CD367900608133 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 40 | 69FE02B118CD367900608133 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 41 | 69FE02B418CD367900608133 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 42 | 69FE02D218CD369900608133 /* View.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = View.h; sourceTree = ""; }; 43 | 69FE02D318CD369900608133 /* View.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = View.m; sourceTree = ""; }; 44 | 69FE031818CD3CD900608133 /* WindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowController.h; sourceTree = ""; }; 45 | 69FE031918CD3CD900608133 /* WindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WindowController.m; sourceTree = ""; }; 46 | 69FE031B18CD3CEC00608133 /* Window.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Window.xib; sourceTree = ""; }; 47 | 69FE031D18CD44D100608133 /* Util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Util.h; sourceTree = ""; }; 48 | 69FE031E18CD44D100608133 /* Util.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Util.m; sourceTree = ""; }; 49 | 69FE034118CD4BC000608133 /* Watcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Watcher.h; sourceTree = ""; }; 50 | 69FE034218CD4BC000608133 /* Watcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Watcher.m; sourceTree = ""; }; 51 | 69FE034418CD4F4E00608133 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 69FE029818CD367900608133 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | 69FE034518CD4F4E00608133 /* CoreServices.framework in Frameworks */, 60 | 69FE029F18CD367900608133 /* Cocoa.framework in Frameworks */, 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXFrameworksBuildPhase section */ 65 | 66 | /* Begin PBXGroup section */ 67 | 6922EA1718CE47D900971641 /* Resources */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 69E2DBBA18CFEC1D00C6AF0F /* frame.png */, 71 | 6922EA1818CE47D900971641 /* mask.png */, 72 | ); 73 | path = Resources; 74 | sourceTree = ""; 75 | }; 76 | 69FE029218CD367900608133 = { 77 | isa = PBXGroup; 78 | children = ( 79 | 6922EA1E18CE538600971641 /* Icon.icns */, 80 | 69FE02A418CD367900608133 /* Game Frame */, 81 | 69FE029D18CD367900608133 /* Frameworks */, 82 | 69FE029C18CD367900608133 /* Products */, 83 | ); 84 | sourceTree = ""; 85 | }; 86 | 69FE029C18CD367900608133 /* Products */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 69FE029B18CD367900608133 /* Game Frame.app */, 90 | ); 91 | name = Products; 92 | sourceTree = ""; 93 | }; 94 | 69FE029D18CD367900608133 /* Frameworks */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 69FE034418CD4F4E00608133 /* CoreServices.framework */, 98 | 69FE029E18CD367900608133 /* Cocoa.framework */, 99 | 69FE02A018CD367900608133 /* Other Frameworks */, 100 | ); 101 | name = Frameworks; 102 | sourceTree = ""; 103 | }; 104 | 69FE02A018CD367900608133 /* Other Frameworks */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 69FE02A118CD367900608133 /* AppKit.framework */, 108 | 69FE02A218CD367900608133 /* CoreData.framework */, 109 | 69FE02A318CD367900608133 /* Foundation.framework */, 110 | ); 111 | name = "Other Frameworks"; 112 | sourceTree = ""; 113 | }; 114 | 69FE02A418CD367900608133 /* Game Frame */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 69FE02B018CD367900608133 /* AppDelegate.h */, 118 | 69FE02B118CD367900608133 /* AppDelegate.m */, 119 | 69FE02B318CD367900608133 /* MainMenu.xib */, 120 | 6922EA1718CE47D900971641 /* Resources */, 121 | 69FE02A518CD367900608133 /* Supporting Files */, 122 | 69FE031D18CD44D100608133 /* Util.h */, 123 | 69FE031E18CD44D100608133 /* Util.m */, 124 | 69FE02D218CD369900608133 /* View.h */, 125 | 69FE02D318CD369900608133 /* View.m */, 126 | 69FE034118CD4BC000608133 /* Watcher.h */, 127 | 69FE034218CD4BC000608133 /* Watcher.m */, 128 | 69FE031B18CD3CEC00608133 /* Window.xib */, 129 | 69FE031818CD3CD900608133 /* WindowController.h */, 130 | 69FE031918CD3CD900608133 /* WindowController.m */, 131 | ); 132 | path = "Game Frame"; 133 | sourceTree = ""; 134 | }; 135 | 69FE02A518CD367900608133 /* Supporting Files */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 69FE02A618CD367900608133 /* Game Frame-Info.plist */, 139 | 69FE02A718CD367900608133 /* InfoPlist.strings */, 140 | 69FE02AA18CD367900608133 /* main.m */, 141 | 69FE02AC18CD367900608133 /* Game Frame-Prefix.pch */, 142 | ); 143 | name = "Supporting Files"; 144 | sourceTree = ""; 145 | }; 146 | /* End PBXGroup section */ 147 | 148 | /* Begin PBXNativeTarget section */ 149 | 69FE029A18CD367900608133 /* Game Frame */ = { 150 | isa = PBXNativeTarget; 151 | buildConfigurationList = 69FE02CC18CD367A00608133 /* Build configuration list for PBXNativeTarget "Game Frame" */; 152 | buildPhases = ( 153 | 69FE029718CD367900608133 /* Sources */, 154 | 69FE029818CD367900608133 /* Frameworks */, 155 | 69FE029918CD367900608133 /* Resources */, 156 | ); 157 | buildRules = ( 158 | ); 159 | dependencies = ( 160 | ); 161 | name = "Game Frame"; 162 | productName = "Game Frame"; 163 | productReference = 69FE029B18CD367900608133 /* Game Frame.app */; 164 | productType = "com.apple.product-type.application"; 165 | }; 166 | /* End PBXNativeTarget section */ 167 | 168 | /* Begin PBXProject section */ 169 | 69FE029318CD367900608133 /* Project object */ = { 170 | isa = PBXProject; 171 | attributes = { 172 | LastUpgradeCheck = 0500; 173 | ORGANIZATIONNAME = "Michael Fogleman"; 174 | TargetAttributes = { 175 | 69FE029A18CD367900608133 = { 176 | DevelopmentTeam = KZZ8LRJP2K; 177 | SystemCapabilities = { 178 | com.apple.Sandbox = { 179 | enabled = 0; 180 | }; 181 | }; 182 | }; 183 | }; 184 | }; 185 | buildConfigurationList = 69FE029618CD367900608133 /* Build configuration list for PBXProject "Game Frame" */; 186 | compatibilityVersion = "Xcode 3.2"; 187 | developmentRegion = English; 188 | hasScannedForEncodings = 0; 189 | knownRegions = ( 190 | en, 191 | Base, 192 | ); 193 | mainGroup = 69FE029218CD367900608133; 194 | productRefGroup = 69FE029C18CD367900608133 /* Products */; 195 | projectDirPath = ""; 196 | projectRoot = ""; 197 | targets = ( 198 | 69FE029A18CD367900608133 /* Game Frame */, 199 | ); 200 | }; 201 | /* End PBXProject section */ 202 | 203 | /* Begin PBXResourcesBuildPhase section */ 204 | 69FE029918CD367900608133 /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | 69FE02A918CD367900608133 /* InfoPlist.strings in Resources */, 209 | 69FE031C18CD3CEC00608133 /* Window.xib in Resources */, 210 | 6922EA1F18CE538600971641 /* Icon.icns in Resources */, 211 | 69FE02B518CD367900608133 /* MainMenu.xib in Resources */, 212 | 6922EA1918CE47D900971641 /* mask.png in Resources */, 213 | 69E2DBBB18CFEC1D00C6AF0F /* frame.png in Resources */, 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | }; 217 | /* End PBXResourcesBuildPhase section */ 218 | 219 | /* Begin PBXSourcesBuildPhase section */ 220 | 69FE029718CD367900608133 /* Sources */ = { 221 | isa = PBXSourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | 69FE034318CD4BC000608133 /* Watcher.m in Sources */, 225 | 69FE031F18CD44D100608133 /* Util.m in Sources */, 226 | 69FE02B218CD367900608133 /* AppDelegate.m in Sources */, 227 | 69FE031A18CD3CD900608133 /* WindowController.m in Sources */, 228 | 69FE02AB18CD367900608133 /* main.m in Sources */, 229 | 69FE02D418CD369900608133 /* View.m in Sources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXSourcesBuildPhase section */ 234 | 235 | /* Begin PBXVariantGroup section */ 236 | 69FE02A718CD367900608133 /* InfoPlist.strings */ = { 237 | isa = PBXVariantGroup; 238 | children = ( 239 | 69FE02A818CD367900608133 /* en */, 240 | ); 241 | name = InfoPlist.strings; 242 | sourceTree = ""; 243 | }; 244 | 69FE02B318CD367900608133 /* MainMenu.xib */ = { 245 | isa = PBXVariantGroup; 246 | children = ( 247 | 69FE02B418CD367900608133 /* Base */, 248 | ); 249 | name = MainMenu.xib; 250 | sourceTree = ""; 251 | }; 252 | /* End PBXVariantGroup section */ 253 | 254 | /* Begin XCBuildConfiguration section */ 255 | 69FE02CA18CD367A00608133 /* Debug */ = { 256 | isa = XCBuildConfiguration; 257 | buildSettings = { 258 | ALWAYS_SEARCH_USER_PATHS = NO; 259 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 260 | CLANG_CXX_LIBRARY = "libc++"; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | COPY_PHASE_STRIP = NO; 271 | GCC_C_LANGUAGE_STANDARD = gnu99; 272 | GCC_DYNAMIC_NO_PIC = NO; 273 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 274 | GCC_OPTIMIZATION_LEVEL = 0; 275 | GCC_PREPROCESSOR_DEFINITIONS = ( 276 | "DEBUG=1", 277 | "$(inherited)", 278 | ); 279 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 280 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 281 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 282 | GCC_WARN_UNDECLARED_SELECTOR = YES; 283 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 284 | GCC_WARN_UNUSED_FUNCTION = YES; 285 | GCC_WARN_UNUSED_VARIABLE = YES; 286 | MACOSX_DEPLOYMENT_TARGET = 10.8; 287 | ONLY_ACTIVE_ARCH = YES; 288 | SDKROOT = macosx; 289 | }; 290 | name = Debug; 291 | }; 292 | 69FE02CB18CD367A00608133 /* Release */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ALWAYS_SEARCH_USER_PATHS = NO; 296 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 297 | CLANG_CXX_LIBRARY = "libc++"; 298 | CLANG_ENABLE_OBJC_ARC = YES; 299 | CLANG_WARN_BOOL_CONVERSION = YES; 300 | CLANG_WARN_CONSTANT_CONVERSION = YES; 301 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 302 | CLANG_WARN_EMPTY_BODY = YES; 303 | CLANG_WARN_ENUM_CONVERSION = YES; 304 | CLANG_WARN_INT_CONVERSION = YES; 305 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 306 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 307 | COPY_PHASE_STRIP = YES; 308 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 309 | ENABLE_NS_ASSERTIONS = NO; 310 | GCC_C_LANGUAGE_STANDARD = gnu99; 311 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 312 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 313 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 314 | GCC_WARN_UNDECLARED_SELECTOR = YES; 315 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 316 | GCC_WARN_UNUSED_FUNCTION = YES; 317 | GCC_WARN_UNUSED_VARIABLE = YES; 318 | MACOSX_DEPLOYMENT_TARGET = 10.8; 319 | SDKROOT = macosx; 320 | }; 321 | name = Release; 322 | }; 323 | 69FE02CD18CD367A00608133 /* Debug */ = { 324 | isa = XCBuildConfiguration; 325 | buildSettings = { 326 | CODE_SIGN_IDENTITY = "Developer ID Application"; 327 | "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; 328 | COMBINE_HIDPI_IMAGES = YES; 329 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 330 | GCC_PREFIX_HEADER = "Game Frame/Game Frame-Prefix.pch"; 331 | INFOPLIST_FILE = "Game Frame/Game Frame-Info.plist"; 332 | PRODUCT_NAME = "$(TARGET_NAME)"; 333 | PROVISIONING_PROFILE = ""; 334 | WRAPPER_EXTENSION = app; 335 | }; 336 | name = Debug; 337 | }; 338 | 69FE02CE18CD367A00608133 /* Release */ = { 339 | isa = XCBuildConfiguration; 340 | buildSettings = { 341 | CODE_SIGN_IDENTITY = "Developer ID Application"; 342 | "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; 343 | COMBINE_HIDPI_IMAGES = YES; 344 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 345 | GCC_PREFIX_HEADER = "Game Frame/Game Frame-Prefix.pch"; 346 | INFOPLIST_FILE = "Game Frame/Game Frame-Info.plist"; 347 | PRODUCT_NAME = "$(TARGET_NAME)"; 348 | PROVISIONING_PROFILE = ""; 349 | WRAPPER_EXTENSION = app; 350 | }; 351 | name = Release; 352 | }; 353 | /* End XCBuildConfiguration section */ 354 | 355 | /* Begin XCConfigurationList section */ 356 | 69FE029618CD367900608133 /* Build configuration list for PBXProject "Game Frame" */ = { 357 | isa = XCConfigurationList; 358 | buildConfigurations = ( 359 | 69FE02CA18CD367A00608133 /* Debug */, 360 | 69FE02CB18CD367A00608133 /* Release */, 361 | ); 362 | defaultConfigurationIsVisible = 0; 363 | defaultConfigurationName = Release; 364 | }; 365 | 69FE02CC18CD367A00608133 /* Build configuration list for PBXNativeTarget "Game Frame" */ = { 366 | isa = XCConfigurationList; 367 | buildConfigurations = ( 368 | 69FE02CD18CD367A00608133 /* Debug */, 369 | 69FE02CE18CD367A00608133 /* Release */, 370 | ); 371 | defaultConfigurationIsVisible = 0; 372 | defaultConfigurationName = Release; 373 | }; 374 | /* End XCConfigurationList section */ 375 | }; 376 | rootObject = 69FE029318CD367900608133 /* Project object */; 377 | } 378 | -------------------------------------------------------------------------------- /Game Frame.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Game Frame.xcodeproj/project.xcworkspace/xcshareddata/Game Frame.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | C3E99265-B12B-4159-8B8E-E5EEF350D7FA 9 | IDESourceControlProjectName 10 | Game Frame 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 8558711C-B795-4034-9811-D12FA117519C 14 | https://github.com/fogleman/GameFrame.git 15 | 16 | IDESourceControlProjectPath 17 | Game Frame.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 8558711C-B795-4034-9811-D12FA117519C 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/fogleman/GameFrame.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 8558711C-B795-4034-9811-D12FA117519C 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 8558711C-B795-4034-9811-D12FA117519C 36 | IDESourceControlWCCName 37 | Game Frame 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Game Frame.xcodeproj/xcuserdata/fogleman.xcuserdatad/xcschemes/Game Frame.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Game Frame.xcodeproj/xcuserdata/fogleman.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Game Frame.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 69FE029A18CD367900608133 16 | 17 | primary 18 | 19 | 20 | 69FE02BB18CD367A00608133 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Game Frame/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Game Frame/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "WindowController.h" 11 | 12 | @implementation AppDelegate 13 | 14 | - (void)applicationDidFinishLaunching:(NSNotification *)notification { 15 | if (WindowController.instances.count == 0) { 16 | [self openDocument:nil]; 17 | } 18 | [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(onTimer) userInfo:nil repeats:YES]; 19 | } 20 | 21 | - (void)onTimer { 22 | [WindowController updateAll]; 23 | } 24 | 25 | - (IBAction)onShowBackground:(id)sender { 26 | for (WindowController *controller in WindowController.instances) { 27 | controller.view.showBackground = !controller.view.showBackground; 28 | [controller refresh]; 29 | } 30 | } 31 | 32 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { 33 | return NO; 34 | } 35 | 36 | - (void)openFile:(NSURL *)url { 37 | [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:url]; 38 | WindowController *controller = [[WindowController alloc] initWithURL:url]; 39 | [controller showWindow:nil]; 40 | } 41 | 42 | - (void)openDocument:(id)sender { 43 | NSOpenPanel *panel = [NSOpenPanel openPanel]; 44 | panel.title = @"Open"; 45 | panel.showsResizeIndicator = YES; 46 | panel.showsHiddenFiles = NO; 47 | panel.canChooseDirectories = YES; 48 | panel.canCreateDirectories = YES; 49 | panel.allowsMultipleSelection = YES; 50 | panel.allowedFileTypes = @[@"bmp", @"png", @"gif"]; 51 | [panel beginWithCompletionHandler:^(NSInteger result) { 52 | if (result == NSOKButton) { 53 | for (NSURL *url in panel.URLs) { 54 | [self openFile:url]; 55 | } 56 | } 57 | }]; 58 | } 59 | 60 | - (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename { 61 | [self openFile:[NSURL URLWithString:filename]]; 62 | return YES; 63 | } 64 | 65 | - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { 66 | for (NSString *filename in filenames) { 67 | [self openFile:[NSURL URLWithString:filename]]; 68 | } 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Game Frame/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | Default 523 | 524 | 525 | 526 | 527 | 528 | 529 | Left to Right 530 | 531 | 532 | 533 | 534 | 535 | 536 | Right to Left 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | Default 548 | 549 | 550 | 551 | 552 | 553 | 554 | Left to Right 555 | 556 | 557 | 558 | 559 | 560 | 561 | Right to Left 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | -------------------------------------------------------------------------------- /Game Frame/Game Frame-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeExtensions 11 | 12 | png 13 | bmp 14 | 15 | CFBundleTypeName 16 | Image 17 | CFBundleTypeRole 18 | Viewer 19 | 20 | 21 | CFBundleExecutable 22 | ${EXECUTABLE_NAME} 23 | CFBundleIconFile 24 | Icon 25 | CFBundleIdentifier 26 | com.michaelfogleman.${PRODUCT_NAME:rfc1034identifier} 27 | CFBundleInfoDictionaryVersion 28 | 6.0 29 | CFBundleName 30 | ${PRODUCT_NAME} 31 | CFBundlePackageType 32 | APPL 33 | CFBundleShortVersionString 34 | 1.0 35 | CFBundleSignature 36 | ???? 37 | CFBundleVersion 38 | 1 39 | LSApplicationCategoryType 40 | public.app-category.graphics-design 41 | LSMinimumSystemVersion 42 | ${MACOSX_DEPLOYMENT_TARGET} 43 | NSHumanReadableCopyright 44 | Copyright © 2014 Michael Fogleman. All rights reserved. 45 | NSMainNibFile 46 | MainMenu 47 | NSPrincipalClass 48 | NSApplication 49 | 50 | 51 | -------------------------------------------------------------------------------- /Game Frame/Game Frame-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /Game Frame/Resources/frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fogleman/GameFrame/af62c0940ca0051afe2c32065f4dbc0e4f7d405d/Game Frame/Resources/frame.png -------------------------------------------------------------------------------- /Game Frame/Resources/mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fogleman/GameFrame/af62c0940ca0051afe2c32065f4dbc0e4f7d405d/Game Frame/Resources/mask.png -------------------------------------------------------------------------------- /Game Frame/Util.h: -------------------------------------------------------------------------------- 1 | // 2 | // Util.h 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Util : NSObject 12 | 13 | + (NSBitmapImageRep *)loadImage:(NSURL *)url; 14 | 15 | + (BOOL)isDirectory:(NSURL *)url; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Game Frame/Util.m: -------------------------------------------------------------------------------- 1 | // 2 | // Util.m 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import "Util.h" 10 | 11 | @implementation Util 12 | 13 | + (NSImage *)generateStrip:(NSURL *)url { 14 | NSSet *extensions = [NSSet setWithObjects:@"bmp", @"png", @"gif", nil]; 15 | NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:url.path error:nil]; 16 | NSMutableArray *images = [[NSMutableArray alloc] init]; 17 | for (NSString *file in files) { 18 | if ([extensions containsObject:file.pathExtension]) { 19 | [images addObject:[url URLByAppendingPathComponent:file]]; 20 | } 21 | } 22 | NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:16 pixelsHigh:16 * images.count bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:0 bitsPerPixel:0]; 23 | [NSGraphicsContext saveGraphicsState]; 24 | [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:rep]]; 25 | for (int i = 0; i < images.count; i++) { 26 | NSImage *frame = [[NSImage alloc] initWithContentsOfURL:[images objectAtIndex:i]]; 27 | [frame drawAtPoint:NSMakePoint(0, i * 16) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; 28 | } 29 | [NSGraphicsContext restoreGraphicsState]; 30 | NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(16, 16 * images.count)]; 31 | [image addRepresentation:rep]; 32 | return image; 33 | } 34 | 35 | + (NSBitmapImageRep *)loadImage:(NSURL *)url { 36 | NSImage *image; 37 | if ([Util isDirectory:url]) { 38 | image = [Util generateStrip:url]; 39 | } 40 | else { 41 | image = [[NSImage alloc] initWithContentsOfURL:url]; 42 | } 43 | CGImageRef cgImage = [image CGImageForProposedRect:nil context:nil hints:nil]; 44 | return [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; 45 | } 46 | 47 | + (BOOL)isDirectory:(NSURL *)url { 48 | NSNumber *isDirectory; 49 | BOOL success = [url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil]; 50 | return success && [isDirectory boolValue]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Game Frame/View.h: -------------------------------------------------------------------------------- 1 | // 2 | // View.h 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface View : NSView { 12 | int offset; 13 | } 14 | 15 | - (void)update; 16 | 17 | @property (strong) NSImage *background; 18 | @property (strong) NSImage *mask; 19 | @property (strong) NSBitmapImageRep *bitmap; 20 | @property (assign) BOOL showBackground; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Game Frame/View.m: -------------------------------------------------------------------------------- 1 | // 2 | // View.m 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import "View.h" 10 | 11 | #define kSize 16 12 | #define kScale 0.75 13 | #define kScaleWithoutBackground 0.95 14 | #define kBackgroundGridSize 740 15 | #define kBackgroundCenterX 977 16 | #define kBackgroundCenterY 524 17 | 18 | @implementation View 19 | 20 | - (id)initWithFrame:(NSRect)frame { 21 | self = [super initWithFrame:frame]; 22 | if (self) { 23 | self.showBackground = YES; 24 | self.background = [NSImage imageNamed:@"frame"]; 25 | self.mask = [NSImage imageNamed:@"mask"]; 26 | } 27 | return self; 28 | } 29 | 30 | - (BOOL)isFlipped { 31 | return YES; 32 | } 33 | 34 | - (void)update { 35 | if (!self.bitmap) { 36 | return; 37 | } 38 | int previous = offset; 39 | offset = (offset + kSize) % self.bitmap.pixelsHigh; 40 | if (offset != previous) { 41 | [self setNeedsDisplay:YES]; 42 | } 43 | } 44 | 45 | - (float)getScale { 46 | return self.showBackground ? kScale : kScaleWithoutBackground; 47 | } 48 | 49 | - (void)drawRect:(NSRect)dirtyRect { 50 | [super drawRect:dirtyRect]; 51 | [[NSColor blackColor] setFill]; 52 | NSRectFill(dirtyRect); 53 | if (self.showBackground) { 54 | [self drawBackground:dirtyRect]; 55 | } 56 | [self drawLights:dirtyRect]; 57 | } 58 | 59 | - (void)drawBackground:(NSRect)dirtyRect { 60 | int ww = self.bounds.size.width; 61 | int wh = self.bounds.size.height; 62 | int frameSize = MIN(ww, wh) * [self getScale]; 63 | frameSize /= kSize; 64 | frameSize *= kSize; 65 | float scale = 1.0 * frameSize / kBackgroundGridSize; 66 | NSSize size = self.background.size; 67 | int dx = size.width / 2 - kBackgroundCenterX; 68 | int dy = size.height / 2 - kBackgroundCenterY; 69 | int x = ww / 2 - scale * size.width / 2 + scale * dx; 70 | int y = wh / 2 - scale * size.height / 2 + scale * dy; 71 | int w = scale * size.width; 72 | int h = scale * size.height; 73 | NSRect rect = NSMakeRect(x, y, w, h); 74 | [self.background drawInRect:rect]; 75 | } 76 | 77 | - (void)drawLights:(NSRect)dirtyRect { 78 | NSBitmapImageRep *bitmap = self.bitmap; 79 | int w = self.bounds.size.width; 80 | int h = self.bounds.size.height; 81 | int size = MIN(w, h) * [self getScale] / kSize; 82 | int ox = (w - size * kSize) / 2; 83 | int oy = (h - size * kSize) / 2; 84 | for (int i = 0; i < kSize; i++) { 85 | for (int j = 0; j < kSize; j++) { 86 | int x = ox + i * size; 87 | int y = oy + j * size; 88 | NSRect rect = NSMakeRect(x, y, size, size); 89 | if (!CGRectIntersectsRect(rect, dirtyRect)) { 90 | continue; 91 | } 92 | NSColor *color = [NSColor colorWithDeviceRed:0 green:0 blue:0 alpha:1]; 93 | if (bitmap) { 94 | int px = i; 95 | int py = j + offset; 96 | color = [bitmap colorAtX:px y:py]; 97 | } 98 | float brightness = MIN(1.0, color.brightnessComponent * 1.25 + 0.15); 99 | color = [NSColor colorWithHue:color.hueComponent saturation:color.saturationComponent brightness:brightness alpha:color.alphaComponent]; 100 | [color setFill]; 101 | NSRectFill(rect); 102 | [self.mask drawInRect:rect]; 103 | } 104 | } 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /Game Frame/Watcher.h: -------------------------------------------------------------------------------- 1 | // 2 | // Watcher.h 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import 10 | #include 11 | 12 | @interface Watcher : NSObject 13 | 14 | + (Watcher *)sharedWatcher; 15 | 16 | - (id)init; 17 | - (void)watchFile:(NSURL *)url; 18 | - (void)unwatchFile:(NSURL *)url; 19 | 20 | @property (strong) NSMutableDictionary *subscriptions; 21 | @property (assign) FSEventStreamRef stream; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Game Frame/Watcher.m: -------------------------------------------------------------------------------- 1 | // 2 | // Watcher.m 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import "Watcher.h" 10 | #import "WindowController.h" 11 | #import "Util.h" 12 | 13 | void fileChanged(ConstFSEventStreamRef stream, void *arg, size_t numEvents, void *eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]) 14 | { 15 | [WindowController refreshAll]; 16 | } 17 | 18 | @implementation Watcher 19 | 20 | + (Watcher *)sharedWatcher { 21 | static Watcher *watcher = nil; 22 | if (watcher == nil) { 23 | watcher = [[Watcher alloc] init]; 24 | } 25 | return watcher; 26 | } 27 | 28 | - (id)init { 29 | self = [super init]; 30 | if (self) { 31 | self.subscriptions = [[NSMutableDictionary alloc] init]; 32 | self.stream = NULL; 33 | } 34 | return self; 35 | } 36 | 37 | - (void)watchFile:(NSURL *)url { 38 | NSString *path = url.path; 39 | if (![Util isDirectory:url]) { 40 | path = [path stringByDeletingLastPathComponent]; 41 | } 42 | if ([self.subscriptions objectForKey:path] == nil) { 43 | [self.subscriptions setObject:@(1) forKey:path]; 44 | [self updateStream]; 45 | } 46 | else { 47 | int value = [[self.subscriptions objectForKey:path] intValue] + 1; 48 | [self.subscriptions setObject:@(value) forKey:path]; 49 | } 50 | } 51 | 52 | - (void)unwatchFile:(NSURL *)url { 53 | NSString *path = url.path; 54 | if (![Util isDirectory:url]) { 55 | path = [path stringByDeletingLastPathComponent]; 56 | } 57 | if ([self.subscriptions objectForKey:path] == nil) { 58 | // do nothing 59 | } 60 | else { 61 | int value = [[self.subscriptions objectForKey:path] intValue] - 1; 62 | if (value > 0) { 63 | [self.subscriptions setObject:@(value) forKey:path]; 64 | } 65 | else { 66 | [self.subscriptions removeObjectForKey:path]; 67 | [self updateStream]; 68 | } 69 | } 70 | } 71 | 72 | - (void)updateStream { 73 | FSEventStreamRef stream = self.stream; 74 | if (stream != NULL) { 75 | FSEventStreamStop(stream); 76 | FSEventStreamUnscheduleFromRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); 77 | } 78 | NSArray *paths = [self.subscriptions allKeys]; 79 | if (paths.count) { 80 | NSTimeInterval latency = 1.0; 81 | stream = FSEventStreamCreate(NULL, &fileChanged, NULL, (__bridge CFArrayRef)paths, kFSEventStreamEventIdSinceNow, (CFAbsoluteTime)latency, kFSEventStreamCreateFlagUseCFTypes); 82 | FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); 83 | FSEventStreamStart(stream); 84 | self.stream = stream; 85 | } 86 | else { 87 | self.stream = NULL; 88 | } 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /Game Frame/Window.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Game Frame/WindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WindowController.h 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "View.h" 11 | #import "Watcher.h" 12 | 13 | @interface WindowController : NSWindowController 14 | 15 | + (NSMutableArray *)instances; 16 | + (void)refreshAll; 17 | + (void)updateAll; 18 | 19 | - (id)initWithURL:(NSURL *)url; 20 | - (void)refresh; 21 | - (void)update; 22 | 23 | @property (assign) IBOutlet View *view; 24 | @property (strong) NSURL *url; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Game Frame/WindowController.m: -------------------------------------------------------------------------------- 1 | // 2 | // WindowController.m 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import "WindowController.h" 10 | #import "Util.h" 11 | 12 | @implementation WindowController 13 | 14 | + (NSMutableArray *)instances { 15 | static NSMutableArray *instances = nil; 16 | if (instances == nil) { 17 | instances = [[NSMutableArray alloc] init]; 18 | } 19 | return instances; 20 | } 21 | 22 | + (void)refreshAll { 23 | for (WindowController *controller in WindowController.instances) { 24 | [controller refresh]; 25 | } 26 | } 27 | 28 | + (void)updateAll { 29 | for (WindowController *controller in WindowController.instances) { 30 | [controller update]; 31 | } 32 | } 33 | 34 | - (id)initWithURL:(NSURL *)url { 35 | self = [super initWithWindowNibName:@"Window"]; 36 | if (self) { 37 | [WindowController.instances addObject:self]; 38 | self.url = url; 39 | [self.window setTitleWithRepresentedFilename:url.path]; 40 | self.window.delegate = self; 41 | [self refresh]; 42 | [[Watcher sharedWatcher] watchFile:url]; 43 | } 44 | return self; 45 | } 46 | 47 | - (void)refresh { 48 | self.view.bitmap = [Util loadImage:self.url]; 49 | [self.view setNeedsDisplay:YES]; 50 | } 51 | 52 | - (void)update { 53 | [self.view update]; 54 | } 55 | 56 | - (void)windowDidLoad { 57 | [super windowDidLoad]; 58 | } 59 | 60 | - (void)windowWillClose:(NSNotification *)notification { 61 | [[Watcher sharedWatcher] unwatchFile:self.url]; 62 | [WindowController.instances removeObject:self]; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Game Frame/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Game Frame/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Game Frame 4 | // 5 | // Created by Michael Fogleman on 3/9/14. 6 | // Copyright (c) 2014 Michael Fogleman. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) 12 | { 13 | return NSApplicationMain(argc, argv); 14 | } 15 | -------------------------------------------------------------------------------- /Icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fogleman/GameFrame/af62c0940ca0051afe2c32065f4dbc0e4f7d405d/Icon.icns -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Game Frame 2 | 3 | Simulates the appearance of the [Game Frame](https://www.kickstarter.com/projects/jerware/game-frame-the-art-of-pixels) 4 | while you are busy pixel editing. 5 | 6 | The application watches the files you are editing and updates whenever you save. 7 | 8 | ![Screenshot](http://i.imgur.com/pHyS6pv.gif) 9 | --------------------------------------------------------------------------------