diff --git a/Cube4Fun/Animations.swift b/Cube4Fun/Animations.swift index 9da3266..4451152 100644 --- a/Cube4Fun/Animations.swift +++ b/Cube4Fun/Animations.swift @@ -2,9 +2,22 @@ // Animations.swift // Cube4Fun // -// Created by Nik on 07.04.15. -// Copyright (c) 2015 DerNik. All rights reserved. +// Created by Nikolai Rinas on 07.04.15. +// Copyright (c) 2015 Nikolai Rinas. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see + // Constants let AnimName = "AnimName" @@ -44,6 +57,8 @@ class Animations: NSObject { let minFrameSpeed = 100 // the fastest possible speed allowed let frameSpeedStep = 100 // how fast increase or decrease speed // var _playSendDelay: NSTimeInterval = 0.5 // 500 milliseconds as default + var _copyFrameBuffer: [UInt8] = [UInt8]() + override init() { super.init() @@ -53,6 +68,10 @@ class Animations: NSObject { self.addAnimation() // Set visible animation _animationSelected = 0 + // Init Buffer + for ( var i = 0; i < 64 ; ++i ) { + _copyFrameBuffer.append(255) + } } // How much animations do we have @@ -286,9 +305,21 @@ class Animations: NSObject { } func clearLEDColor() { - var myByte: [UInt8] = [255] + //var myByte: [UInt8] = [255] let myData: NSMutableData = (self.getAnimation(_animationSelected)).objectForKey(AnimFrames) as! NSMutableData myData.replaceBytesInRange(NSMakeRange((self.getAnimationFrameID()-1)*64, 64), withBytes: _emptyFrame) } + func copyDisplayedFrame() { + let myData = self.getAnimDataSelected() + var animFrameCount = (self.getAnimationFrameID()-1)*64 + for ( var i = 0 ; i < 64 ; ++i ) { + _copyFrameBuffer[i] = myData[animFrameCount] + ++animFrameCount + } + } + func pasteDisplayedFrame() { + let myData: NSMutableData = (self.getAnimation(_animationSelected)).objectForKey(AnimFrames) as! NSMutableData + myData.replaceBytesInRange(NSMakeRange((self.getAnimationFrameID()-1)*64, 64), withBytes: _copyFrameBuffer) + } } diff --git a/Cube4Fun/AnimationsController.swift b/Cube4Fun/AnimationsController.swift index 2622770..02b8c4f 100644 --- a/Cube4Fun/AnimationsController.swift +++ b/Cube4Fun/AnimationsController.swift @@ -2,9 +2,21 @@ // ProjectController.swift // Cube4Fun // -// Created by Nik on 02.04.15. -// Copyright (c) 2015 DerNik. All rights reserved. +// Created by Nikolai Rinas on 02.04.15. +// Copyright (c) 2015 Nikolai Rinas. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see import Cocoa import Foundation diff --git a/Cube4Fun/AppDelegate.swift b/Cube4Fun/AppDelegate.swift index ca5feb3..a09c1c1 100644 --- a/Cube4Fun/AppDelegate.swift +++ b/Cube4Fun/AppDelegate.swift @@ -2,9 +2,21 @@ // AppDelegate.swift // Cube4Fun // -// Created by Nik on 27.03.15. -// Copyright (c) 2015 DerNik. All rights reserved. +// Created by Nikolai Rinas on 27.03.15. +// Copyright (c) 2015 Nikolai Rinas. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see import Cocoa @@ -144,11 +156,23 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSTextFieldDelegate { } @IBAction func cmdCopyPressed(send: AnyObject) { - println("cmd c pressed") + __animations.copyDisplayedFrame() } @IBAction func cmdPastePressed(send: AnyObject) { - println("cmd v pressed") + __animations.pasteDisplayedFrame() + _gameView.updateLEDFrame() + // Send updated frame + __animations.sendFrame() + } + + @IBAction func clearLEDs(send: AnyObject) { + // Remove from Memory + __animations.clearLEDColor() + // Update visual + _gameView.updateLEDFrame() + // Update on a hardware + __animations.sendFrame() } } diff --git a/Cube4Fun/Base.lproj/MainMenu.xib b/Cube4Fun/Base.lproj/MainMenu.xib index b43e116..aba3ca2 100644 --- a/Cube4Fun/Base.lproj/MainMenu.xib +++ b/Cube4Fun/Base.lproj/MainMenu.xib @@ -1,8 +1,8 @@ - + - - + + @@ -159,9 +159,9 @@ - + - + diff --git a/Cube4Fun/CubeNetwork.cpp b/Cube4Fun/CubeNetwork.cpp index 00bbaec..219a2ff 100644 --- a/Cube4Fun/CubeNetwork.cpp +++ b/Cube4Fun/CubeNetwork.cpp @@ -2,9 +2,21 @@ // CubeNetwork.cpp // Cube4Fun // -// Created by Nik on 28.03.15. -// Copyright (c) 2015 DerNik. All rights reserved. +// Created by Nikolai Rinas on 28.03.15. +// Copyright (c) 2015 Nikolai Rinas. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see #include "CubeNetwork.h" diff --git a/Cube4Fun/CubeNetwork.h b/Cube4Fun/CubeNetwork.h index 015403a..1f78a06 100644 --- a/Cube4Fun/CubeNetwork.h +++ b/Cube4Fun/CubeNetwork.h @@ -2,9 +2,21 @@ // CubeNetwork.h // Cube4Fun // -// Created by Nik on 28.03.15. -// Copyright (c) 2015 DerNik. All rights reserved. +// Created by Nikolai Rinas on 28.03.15. +// Copyright (c) 2015 Nikolai Rinas. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see #ifndef __Cube4Fun__CubeNetwork__ #define __Cube4Fun__CubeNetwork__ diff --git a/Cube4Fun/GameView.swift b/Cube4Fun/GameView.swift index 8dd2455..a448128 100644 --- a/Cube4Fun/GameView.swift +++ b/Cube4Fun/GameView.swift @@ -2,9 +2,21 @@ // GameView.swift // Cube4Fun // -// Created by Nik on 27.03.15. -// Copyright (c) 2015 DerNik. All rights reserved. +// Created by Nikolai Rinas on 27.03.15. +// Copyright (c) 2015 Nikolai Rinas. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see import SceneKit diff --git a/Cube4Fun/GameViewController.swift b/Cube4Fun/GameViewController.swift index 4df200e..574203a 100644 --- a/Cube4Fun/GameViewController.swift +++ b/Cube4Fun/GameViewController.swift @@ -2,9 +2,21 @@ // GameViewController.swift // Cube4Fun // -// Created by Nik on 27.03.15. -// Copyright (c) 2015 DerNik. All rights reserved. +// Created by Nikolai Rinas on 27.03.15. +// Copyright (c) 2015 Nikolai Rinas. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see import SceneKit import QuartzCore diff --git a/Cube4Fun/ObjCtoCPlusPlus.h b/Cube4Fun/ObjCtoCPlusPlus.h index 69aee02..59517f0 100755 --- a/Cube4Fun/ObjCtoCPlusPlus.h +++ b/Cube4Fun/ObjCtoCPlusPlus.h @@ -1,10 +1,21 @@ // // ObjCtoCPlusPlus.h -// Performance_Console // -// Created by Gian Luigi Romita on 12/06/14. -// Copyright (c) 2014 Gian Luigi Romita. All rights reserved. +// Created by Nikolai Rinas on 02/02/2015. +// Copyright (c) 2015 Nikolai Rinas. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see #import diff --git a/Cube4Fun/ObjCtoCPlusPlus.mm b/Cube4Fun/ObjCtoCPlusPlus.mm index 7a2e7c8..cfdd196 100755 --- a/Cube4Fun/ObjCtoCPlusPlus.mm +++ b/Cube4Fun/ObjCtoCPlusPlus.mm @@ -1,3 +1,17 @@ + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see + #import "ObjCtoCPlusPlus.h" #import "CubeNetwork.h" diff --git a/Cube4Fun/Pics/Background.jpg b/Cube4Fun/Pics/Background.jpg index d5c0368..eeec5a0 100644 Binary files a/Cube4Fun/Pics/Background.jpg and b/Cube4Fun/Pics/Background.jpg differ diff --git a/Cube4Fun/Preferences.swift b/Cube4Fun/Preferences.swift index 6076e13..164ce65 100644 --- a/Cube4Fun/Preferences.swift +++ b/Cube4Fun/Preferences.swift @@ -2,9 +2,21 @@ // Preferences.swift // Cube4Fun // -// Created by Nik on 18.04.15. -// Copyright (c) 2015 DerNik. All rights reserved. +// Created by Nikolai Rinas on 18.04.15. +// Copyright (c) 2015 Nikolai Rinas. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see import Foundation diff --git a/Cube4Fun/PrimitivesScene.swift b/Cube4Fun/PrimitivesScene.swift index 228ae63..2c50b21 100644 --- a/Cube4Fun/PrimitivesScene.swift +++ b/Cube4Fun/PrimitivesScene.swift @@ -2,9 +2,21 @@ // PrimitivesScene.swift // Cube4Fun // -// Created by Nik on 27.03.15. -// Copyright (c) 2015 DerNik. All rights reserved. +// Created by Nikolai Rinas on 27.03.15. +// Copyright (c) 2015 Nikolai Rinas. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see import Cocoa import SceneKit