diff --git a/Cube4Fun.xcodeproj/project.pbxproj b/Cube4Fun.xcodeproj/project.pbxproj index ce9a18d..ebf42fa 100644 --- a/Cube4Fun.xcodeproj/project.pbxproj +++ b/Cube4Fun.xcodeproj/project.pbxproj @@ -231,7 +231,9 @@ ADCB864D1AC6471C00E300C7 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0620; + LastSwiftMigration = 0700; + LastSwiftUpdateCheck = 0700; + LastUpgradeCheck = 0700; ORGANIZATIONNAME = "Nikolai Rinas"; TargetAttributes = { ADCB86541AC6471C00E300C7 = { @@ -335,6 +337,7 @@ CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -407,6 +410,7 @@ "$(PROJECT_DIR)", "$(PROJECT_DIR)/Cube4Fun/Poco", ); + PRODUCT_BUNDLE_IDENTIFIER = "nikolairinas.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Cube4Fun/src/Cube4Fun-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -429,6 +433,7 @@ "$(PROJECT_DIR)", "$(PROJECT_DIR)/Cube4Fun/Poco", ); + PRODUCT_BUNDLE_IDENTIFIER = "nikolairinas.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Cube4Fun/src/Cube4Fun-Bridging-Header.h"; USER_HEADER_SEARCH_PATHS = /opt/local/include; diff --git a/Cube4Fun.xcodeproj/xcuserdata/nrinas.xcuserdatad/xcschemes/Cube4Fun.xcscheme b/Cube4Fun.xcodeproj/xcuserdata/nrinas.xcuserdatad/xcschemes/Cube4Fun.xcscheme index 5b83085..9efc293 100644 --- a/Cube4Fun.xcodeproj/xcuserdata/nrinas.xcuserdatad/xcschemes/Cube4Fun.xcscheme +++ b/Cube4Fun.xcodeproj/xcuserdata/nrinas.xcuserdatad/xcschemes/Cube4Fun.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -62,15 +62,18 @@ ReferencedContainer = "container:Cube4Fun.xcodeproj"> + + @@ -86,10 +89,10 @@ diff --git a/Cube4Fun/Info.plist b/Cube4Fun/Info.plist index d7934d2..fcb7211 100644 --- a/Cube4Fun/Info.plist +++ b/Cube4Fun/Info.plist @@ -9,7 +9,7 @@ CFBundleIconFile CFBundleIdentifier - nikolairinas.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Cube4Fun/src/Animations.swift b/Cube4Fun/src/Animations.swift index 7fbd272..c4e1570 100644 --- a/Cube4Fun/src/Animations.swift +++ b/Cube4Fun/src/Animations.swift @@ -206,14 +206,14 @@ class Animations: NSObject { func addAnimation() { _animationArray.append(self.newAnimation()) - println("append Animation. count: \(_animationArray.count)") + print("append Animation. count: \(_animationArray.count)") } func newAnimation() -> (NSMutableDictionary) { - println("create new animation") + print("create new animation") return [AnimName: "Animation1", AnimKey: "1=anim1", AnimDuration: 10, AnimSpeed: 500, AnimFrames: self.newFrame()] } func newFrame() -> (NSMutableData) { - println("create new frame") + print("create new frame") return NSMutableData(bytes: _emptyFrame, length: 64) } func addFrame() { @@ -232,18 +232,18 @@ class Animations: NSObject { // Insert empty frame at the current position // Get Array - var myData: NSMutableData = (self.getAnimation(_animationSelected)).objectForKey(AnimFrames) as! NSMutableData - var myDataBytes = self.getAnimDataSelected() + let myData: NSMutableData = (self.getAnimation(_animationSelected)).objectForKey(AnimFrames) as! NSMutableData + let myDataBytes = self.getAnimDataSelected() // Get startPositions of the selected frame - var frameStartPos = (self.getAnimationFrameID()-1)*64 + let frameStartPos = (self.getAnimationFrameID()-1)*64 // Append one empty frame at the end self.addFrame() var lastArrPos: Int = myData.length - 1 - println("Framestart: \(frameStartPos)") - println("Framelength: \(lastArrPos)") + print("Framestart: \(frameStartPos)") + print("Framelength: \(lastArrPos)") // copy frames while ( lastArrPos >= frameStartPos + 64) { @@ -260,18 +260,18 @@ class Animations: NSObject { func deleteDisplFrame() { - println("delete frame") + print("delete frame") // Get Array - var myData: NSMutableData = (self.getAnimation(_animationSelected)).objectForKey(AnimFrames) as! NSMutableData - var myDataBytes = self.getAnimDataSelected() + let myData: NSMutableData = (self.getAnimation(_animationSelected)).objectForKey(AnimFrames) as! NSMutableData + let myDataBytes = self.getAnimDataSelected() // Get startPositions of the selected frame var frameStartPos = (self.getAnimationFrameID()-1)*64 - var lastArrPos: Int = myData.length - 1 - 64 - println("Framestart: \(frameStartPos)") - println("Framelength: \(lastArrPos)") + let lastArrPos: Int = myData.length - 1 - 64 + print("Framestart: \(frameStartPos)") + print("Framelength: \(lastArrPos)") // copy frames (fill deleted frame) while ( frameStartPos <= lastArrPos ) { @@ -352,7 +352,7 @@ class Animations: NSObject { func setLEDColor(color: UInt8, led: Int) { //println("Led pressed: \(led)") - var myByte: [UInt8] = [color] + let myByte: [UInt8] = [color] let myData: NSMutableData = (self.getAnimation(_animationSelected)).objectForKey(AnimFrames) as! NSMutableData let bytePosition = NSMakeRange(((self.getAnimationFrameID()-1)*64)+led, 1) myData.replaceBytesInRange(bytePosition, withBytes: myByte) diff --git a/Cube4Fun/src/AnimationsController.swift b/Cube4Fun/src/AnimationsController.swift index 5a163af..09a1cfb 100644 --- a/Cube4Fun/src/AnimationsController.swift +++ b/Cube4Fun/src/AnimationsController.swift @@ -87,7 +87,7 @@ class AnimationsController: NSObject, NSTableViewDataSource, NSTableViewDelegate func tableViewSelectionDidChange(notification: NSNotification) { let view: NSTableView = notification.object as! NSTableView - println("klicked \(view.selectedRow)") + print("klicked \(view.selectedRow)") __animations.setSelectedAnimationID(view.selectedRow) _gameView.resetView() @@ -97,7 +97,7 @@ class AnimationsController: NSObject, NSTableViewDataSource, NSTableViewDelegate //_selectedAnimation = view.selectedRow - println("klicked \(view.selectedRow)") + print("klicked \(view.selectedRow)") } func tableView(tableView: NSTableView, setObjectValue object: AnyObject?, forTableColumn tableColumn: NSTableColumn?, row: Int) { @@ -174,7 +174,7 @@ class AnimationsController: NSObject, NSTableViewDataSource, NSTableViewDelegate @IBAction func exportAnimations(send: AnyObject) { var sendData: [UInt8] = [UInt8]() - println("Import button pressed") + print("Import button pressed") // for each animation for ( var i = 0; i < __animations.count(); ++i ) { diff --git a/Cube4Fun/src/AppDelegate.swift b/Cube4Fun/src/AppDelegate.swift index 9093d57..5e02ef9 100644 --- a/Cube4Fun/src/AppDelegate.swift +++ b/Cube4Fun/src/AppDelegate.swift @@ -77,7 +77,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSTextFieldDelegate { // probably doesn't have a createPDF() method. self.createPDF(exportedFileURL) } } // End block - println("save pressed") + print("save pressed") } @IBAction func openDocument(sender: AnyObject) { @@ -144,13 +144,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSTextFieldDelegate { if myField.identifier == "IPADDR_FIELD" { if validIPAddress(myField.stringValue) { __prefData.setIPAddr(myField.stringValue) - println("Changing ip address field") + print("Changing ip address field") } } if myField.identifier == "PORTNR_FIELD" { if validPortNr(myField.integerValue) { __prefData.setPortNr(myField.integerValue) - println("Changing port number") + print("Changing port number") } } } diff --git a/Cube4Fun/src/GameView.swift b/Cube4Fun/src/GameView.swift index 68cb434..3df431f 100644 --- a/Cube4Fun/src/GameView.swift +++ b/Cube4Fun/src/GameView.swift @@ -42,7 +42,7 @@ class GameView: SCNView { } func resetView() { - println("Reset view") + Swift.print("Reset view") // goto first frame self.firstButtonPressed() @@ -105,7 +105,7 @@ class GameView: SCNView { if let rootNode = self.scene?.rootNode { for childNode in rootNode.childNodes { - let buttonNode: SCNNode = childNode as! SCNNode + let buttonNode: SCNNode = childNode if buttonNode.name == "myNextFrameButton" { buttonNode.hidden = !nextFrame; } @@ -277,7 +277,7 @@ class GameView: SCNView { func updateSpeedText() { if let rootNode = self.scene?.rootNode { for childNode in rootNode.childNodes { - let buttonNode: SCNNode = childNode as! SCNNode + let buttonNode: SCNNode = childNode if buttonNode.name == "mySpeedText" { let geometry:SCNText = buttonNode.geometry as! SCNText geometry.string = "Speed: \(__animations.animationSpeedInt()) ms" @@ -320,7 +320,8 @@ class GameView: SCNView { override func rightMouseDown(theEvent: NSEvent) { let p = self.convertPoint(theEvent.locationInWindow, fromView: nil) - if let hitResults = self.hitTest(p, options: nil) { + let hitResults = self.hitTest(p, options: nil) +// if let hitResults = self.hitTest(p, options: nil) { // check that we clicked on at least one object if hitResults.count > 0 { // retrieved the first clicked object @@ -345,7 +346,7 @@ class GameView: SCNView { } } } - } + // } } override func mouseDown(theEvent: NSEvent) { @@ -357,7 +358,8 @@ class GameView: SCNView { // check what nodes are clicked let p = self.convertPoint(theEvent.locationInWindow, fromView: nil) - if let hitResults = self.hitTest(p, options: nil) { + let hitResults = self.hitTest(p, options: nil) +// if let hitResults = self.hitTest(p, options: nil) { // check that we clicked on at least one object if hitResults.count > 0 { // retrieved the first clicked object @@ -415,7 +417,7 @@ class GameView: SCNView { klickedColor = 253 // Maximum value }else{ klickedColor = UInt8(colorInt) - println(klickedColor) + Swift.print(klickedColor) } } // Move arrows to the clicked position @@ -513,7 +515,7 @@ class GameView: SCNView { } } - } +// } super.mouseDown(theEvent) } @@ -528,7 +530,7 @@ class GameView: SCNView { SCNTransaction.commit() } - func rotateCamera(var x: CGFloat, var y: CGFloat) { + func rotateCamera(x: CGFloat, y: CGFloat) { // Save the angle for reset startAngle = startAngle + y @@ -614,7 +616,7 @@ class GameView: SCNView { super.keyDown(theEvent) } - println(theEvent.keyCode); + Swift.print(theEvent.keyCode); //super.keyDown(theEvent) diff --git a/Cube4Fun/src/GameViewController.swift b/Cube4Fun/src/GameViewController.swift index 574203a..92ede06 100644 --- a/Cube4Fun/src/GameViewController.swift +++ b/Cube4Fun/src/GameViewController.swift @@ -124,9 +124,9 @@ class GameViewController: NSViewController { // SCNSceneRendererDelegate // Open connection to the LED cube let established = CubeNetworkObj.openConnection(__prefData.ipAddr(), port: UInt32(__prefData.portNR())) if established { - println("connection established") + print("connection established") }else{ - println("connection failed") + print("connection failed") } __animations.sendFrame() @@ -153,7 +153,7 @@ class GameViewController: NSViewController { // SCNSceneRendererDelegate scene.rootNode.addChildNode(cameraNode) // place the camera - var newAngle = (CGFloat)(20.0)*(CGFloat)(M_PI)/180.0 + let newAngle = (CGFloat)(20.0)*(CGFloat)(M_PI)/180.0 //newAngle += currentAngle // cameraNode.transform = SCNMatrix4MakeRotation(-0.5, 0, 0, 1) diff --git a/Cube4Fun/src/PrimitivesScene.swift b/Cube4Fun/src/PrimitivesScene.swift index 2c50b21..7028aa6 100644 --- a/Cube4Fun/src/PrimitivesScene.swift +++ b/Cube4Fun/src/PrimitivesScene.swift @@ -169,7 +169,7 @@ class PrimitivesScene: SCNScene { override init() { super.init() - var radius:CGFloat = 1.0 + let radius:CGFloat = 1.0 let yCount = 4 let zCount = 4 @@ -239,11 +239,11 @@ class PrimitivesScene: SCNScene { var y:CGFloat = edgePosY - for row in 0..