-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResultScene.swift
46 lines (35 loc) · 1.09 KB
/
ResultScene.swift
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
//
// ResultScene.swift
// Jikoku
//
// Created by Raphaël Calabro on 24/08/2017.
// Copyright © 2017 Raphaël Calabro. All rights reserved.
//
import Foundation
import GLKit
import Melisse
class ResultScene : Scene {
var backgroundColor: Color<GLfloat> = .white
let restartZone: TouchSensitiveZone
let plane: Plane
init() {
let rectangle = Rectangle<GLfloat>(left: 10, top: 10, width: 120, height: 60)
restartZone = TouchSensitiveZone(frame: rectangle, touches: TouchController.instance.touches)
plane = Plane(capacity: 1)
var quad = plane.coloredQuadrilateral()
quad.quadrilateral = Quadrilateral(rectangle: rectangle)
quad.color = Color.green
}
func load() {
restartZone.selection = restart
}
func updateWith(_ timeSinceLastUpdate: TimeInterval) {
restartZone.update(with: TouchController.instance.touches)
}
func draw() {
plane.draw()
}
func restart(_ sender: TouchSensitiveZone) {
Director.instance!.nextScene = GameScene()
}
}