-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathruntime.js
More file actions
111 lines (110 loc) · 2.56 KB
/
runtime.js
File metadata and controls
111 lines (110 loc) · 2.56 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Generated by CoffeeScript 1.8.0
(function() {
define(["exports"], function(runtime) {
runtime.ret = function(_) {
return function(a) {
return function() {
return a;
};
};
};
runtime.getCanvas = function() {
return document.getElementById('myCanvas');
};
runtime.getCtx = function(c) {
return function() {
return c.getContext('2d');
};
};
runtime.alert = function(s) {
return function() {
return alert(s);
};
};
runtime.addEventListner = function(cb) {
return function() {
return document.addEventListener('keydown', function(e) {
return cb(e)();
});
};
};
runtime.mkRef = function(_A) {
return function(v) {
return function() {
return {
ref: v
};
};
};
};
runtime.readRef = function(_A) {
return function(r) {
return function() {
return r.ref;
};
};
};
runtime.writeRef = function(_A) {
return function(r) {
return function(v) {
return function() {
return r.ref = v;
};
};
};
};
runtime.fillStyle = function(ctx) {
return function(col) {
return function() {
return ctx.fillStyle = col;
};
};
};
runtime.fillRect = function(ctx) {
return function(x) {
return function(y) {
return function(w) {
return function(h) {
return function() {
return ctx.fillRect(x, y, w, h);
};
};
};
};
};
};
runtime.setScoreText = function(s) {
return function() {
return document.getElementById('score').innerHTML = s;
};
};
runtime.pacman = function(ctx) {
return function(cx) {
return function(cy) {
return function(r) {
return function(rot) {
return function() {
ctx.beginPath();
ctx.moveTo(cx, cy);
ctx.arc(cx, cy, r, Math.PI / 6 + rot * Math.PI / 2, 2 * Math.PI - Math.PI / 6 + rot * Math.PI / 2, false);
return ctx.fill();
};
};
};
};
};
};
runtime.bind = function(_A) {
return function(_B) {
return function(a) {
return function(b) {
return function() {
return b(a())();
};
};
};
};
};
return runtime;
});
}).call(this);