mirror of
https://github.com/workinghard/Cube4Fun.git
synced 2025-12-14 04:42:09 +00:00
a
This commit is contained in:
@@ -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 <http://www.gnu.org/licenses/>
|
||||
|
||||
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
|
||||
import Cocoa
|
||||
import Foundation
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7531" systemVersion="14D136" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7531"/>
|
||||
<plugIn identifier="com.apple.SceneKitIBPlugin" version="7531"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7702"/>
|
||||
<plugIn identifier="com.apple.SceneKitIBPlugin" version="7702"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
@@ -159,9 +159,9 @@
|
||||
<action selector="cmdPastePressed:" target="494" id="DVw-0V-wp5"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Clear All" id="202">
|
||||
<menuItem title="Clear Frame" keyEquivalent="r" id="202">
|
||||
<connections>
|
||||
<action selector="delete:" target="-1" id="235"/>
|
||||
<action selector="clearLEDs:" target="494" id="3lJ-Lc-QCa"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Select All" keyEquivalent="a" id="198">
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
|
||||
#include "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 <http://www.gnu.org/licenses/>
|
||||
|
||||
#ifndef __Cube4Fun__CubeNetwork__
|
||||
#define __Cube4Fun__CubeNetwork__
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
|
||||
import SceneKit
|
||||
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
|
||||
import SceneKit
|
||||
import QuartzCore
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
|
||||
#import "ObjCtoCPlusPlus.h"
|
||||
|
||||
#import "CubeNetwork.h"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 45 KiB |
@@ -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 <http://www.gnu.org/licenses/>
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
|
||||
import Cocoa
|
||||
import SceneKit
|
||||
|
||||
Reference in New Issue
Block a user