Fixed warnings.

This commit is contained in:
Vinicius Vendramini 2017-03-16 12:47:15 -03:00
parent 8fdf66bcb3
commit ee36c25e49
3 changed files with 19 additions and 17 deletions

View File

@ -58,7 +58,7 @@ import ChameleonFramework
internal func updateTargetView() {
let timeout = DispatchTime.now() + Double(1000000000) / Double(NSEC_PER_SEC)
semaphore.wait(timeout: timeout)
_ = semaphore.wait(timeout: timeout)
state = .ending
@ -143,11 +143,6 @@ import ChameleonFramework
let bytesPerRow = width * 4
let region = MTLRegionMake2D(0, 0, width, height)
// Allocate the buffer if needed
if computeContext.imageBuffer == nil {
computeContext.imageBuffer = malloc(imageByteCount)
}
// Transfer texture info into image buffer
texture.getBytes(computeContext.imageBuffer,
bytesPerRow: bytesPerRow,

View File

@ -1,6 +1,12 @@
import Darwin
infix operator ^ { associativity right precedence 131 }
precedencegroup PowerPrecedence {
higherThan: MultiplicationPrecedence
associativity: right
}
//
infix operator ^: PowerPrecedence
func ^ <T: DoubleValuable>(left: T, right: T) -> T {
return T.fromDouble(pow(left.toDouble, right.toDouble))

View File

@ -20,8 +20,9 @@ class ViewController: UIViewController, MetaballDataSource {
view.backgroundColor = UIColor.white
let recognizer = UIPanGestureRecognizer(target: self,
action: "handlePan:")
let recognizer = UIPanGestureRecognizer(
target: self,
action: #selector(ViewController.handlePan(_:)))
view.addGestureRecognizer(recognizer)
var positions = [CGPoint]()
@ -29,8 +30,8 @@ class ViewController: UIViewController, MetaballDataSource {
x: Double(screenWidth) / 2,
y: Double(screenHeight) / 2))
for i in 1...5 {
let sine = sin(Double(i) * 2 * M_PI / 5)
let cosine = cos(Double(i) * 2 * M_PI / 5)
let sine = sin(Double(i) * 2 * .pi / 5)
let cosine = cos(Double(i) * 2 * .pi / 5)
let radius: Double = 150
let x = Double(screenWidth) / 2 + sine * radius
let y = Double(screenHeight) / 2 + cosine * radius
@ -81,8 +82,8 @@ class ViewController: UIViewController, MetaballDataSource {
UIView.animate(withDuration: 1.0, delay: 0,
options: UIViewAnimationOptions(),
animations: { () -> Void in
let sine = sin(Double(i) * 2 * M_PI / 5)
let cosine = cos(Double(i) * 2 * M_PI / 5)
let sine = sin(Double(i) * 2 * .pi / 5)
let cosine = cos(Double(i) * 2 * .pi / 5)
let radius: Double = 85
let x = Double(screenWidth) / 2 + sine * radius
let y = Double(screenHeight) / 2 + cosine * radius
@ -99,8 +100,8 @@ class ViewController: UIViewController, MetaballDataSource {
initialSpringVelocity: 0,
options: UIViewAnimationOptions(),
animations: { () -> Void in
let sine = sin(Double(i) * 2 * M_PI / 5)
let cosine = cos(Double(i) * 2 * M_PI / 5)
let sine = sin(Double(i) * 2 * .pi / 5)
let cosine = cos(Double(i) * 2 * .pi / 5)
let radius: Double = 150
let x = Double(screenWidth) / 2 + sine * radius
let y = Double(screenHeight) / 2 + cosine * radius
@ -130,7 +131,7 @@ class ViewController: UIViewController, MetaballDataSource {
Timer.scheduledTimer(
timeInterval: 1.0 / 60.0,
target: self,
selector: "animateMetaballWithTimer:",
selector: #selector(ViewController.animateMetaball(withTimer:)),
userInfo: parameters,
repeats: true)
}
@ -168,7 +169,7 @@ class ViewController: UIViewController, MetaballDataSource {
Timer.scheduledTimer(
timeInterval: 1.0 / 60.0,
target: self,
selector: "animateEdgeWithTimer:",
selector: #selector(ViewController.animateEdge(withTimer:)),
userInfo: parameters,
repeats: true)
}