squishjs 0.7.3 → 0.7.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +674 -21
- package/package.json +1 -1
- package/src/BaseNode.js +3 -3
- package/src/Game.js +1 -10
- package/src/GameNode.js +1 -1
- package/src/InternalGameNode.js +1 -1
- package/src/Squisher.js +47 -39
- package/src/ViewableGame.js +9 -12
- package/src/squish.js +7 -1
- package/src/squishHelpers/asset.js +14 -5
- package/src/squishHelpers/id.js +35 -2
- package/src/util/views.js +15 -12
- package/test/main.test.js +7 -6
- package/test/utils.js +1 -1
- package/oldsvgexport.js +0 -89
- package/render-tester.js +0 -120
- package/test/StateUpdates.js +0 -10
- package/testapp.html +0 -26
- package/testapp.js +0 -988
package/render-tester.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
console.log('ytoooo');
|
|
2
|
-
|
|
3
|
-
const canvas = document.getElementById('tester-canvas');
|
|
4
|
-
|
|
5
|
-
const ctx = canvas.getContext('2d');
|
|
6
|
-
|
|
7
|
-
const scaleCoordinate = ({ x, y }) => {
|
|
8
|
-
const xPercentage = x / 100;
|
|
9
|
-
const yPercentage = y / 100;
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
scaledX: xPercentage * canvas.width,
|
|
13
|
-
scaledY: yPercentage * canvas.height
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let thingToRender = [
|
|
19
|
-
[
|
|
20
|
-
3, 36, 2, 43, 3, 0, 44, 2, 52,
|
|
21
|
-
22, 5, 0, 5, 0, 95, 0, 5, 0,
|
|
22
|
-
95, 0, 95, 0, 5, 0, 95, 0, 5,
|
|
23
|
-
0, 5, 0, 53, 6, 255, 0, 0, 255
|
|
24
|
-
],
|
|
25
|
-
[
|
|
26
|
-
3, 36, 2, 43, 3, 1, 44, 2, 52,
|
|
27
|
-
22, 5, 0, 5, 0, 50, 0, 5, 0,
|
|
28
|
-
50, 0, 50, 0, 5, 0, 50, 0, 5,
|
|
29
|
-
0, 5, 0, 53, 6, 0, 0, 255, 255
|
|
30
|
-
],
|
|
31
|
-
[
|
|
32
|
-
3, 36, 2, 43, 3, 2, 44, 2, 52,
|
|
33
|
-
22, 50, 0, 5, 0, 95, 0, 5, 0,
|
|
34
|
-
95, 0, 50, 0, 50, 0, 50, 0, 50,
|
|
35
|
-
0, 5, 0, 53, 6, 0, 255, 0, 255
|
|
36
|
-
],
|
|
37
|
-
[
|
|
38
|
-
3, 36, 2, 43, 3, 3, 44, 2, 52,
|
|
39
|
-
22, 50, 0, 50, 0, 95, 0, 50, 0,
|
|
40
|
-
95, 0, 95, 0, 50, 0, 95, 0, 50,
|
|
41
|
-
0, 50, 0, 53, 6, 0, 0, 0, 255
|
|
42
|
-
],
|
|
43
|
-
[
|
|
44
|
-
3, 36, 2, 43, 3, 4, 44, 2, 52,
|
|
45
|
-
22, 5, 0, 50, 0, 50, 0, 50, 0,
|
|
46
|
-
50, 0, 95, 0, 5, 0, 95, 0, 5,
|
|
47
|
-
0, 50, 0, 53, 6, 255, 255, 255, 255
|
|
48
|
-
]
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
const drawMarker = ({ x, y, horizontal }) => {
|
|
52
|
-
const { scaledX, scaledY } = scaleCoordinate({ x, y });
|
|
53
|
-
|
|
54
|
-
if (horizontal) {
|
|
55
|
-
const lineWidth = .015 * canvas.width;
|
|
56
|
-
ctx.beginPath();
|
|
57
|
-
ctx.moveTo(scaledX, scaledY);
|
|
58
|
-
ctx.lineTo(scaledX + lineWidth, scaledY);
|
|
59
|
-
ctx.stroke();
|
|
60
|
-
} else {
|
|
61
|
-
// line is 1.5% of height
|
|
62
|
-
const lineHeight = .015 * canvas.height;
|
|
63
|
-
ctx.beginPath();
|
|
64
|
-
ctx.moveTo(scaledX, scaledY);
|
|
65
|
-
ctx.lineTo(scaledX, scaledY + lineHeight);
|
|
66
|
-
ctx.stroke();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const drawMarkers = () => {
|
|
71
|
-
const horizontalPoints = [
|
|
72
|
-
[0, 10],
|
|
73
|
-
[0, 20],
|
|
74
|
-
[0, 30],
|
|
75
|
-
[0, 40],
|
|
76
|
-
[0, 50],
|
|
77
|
-
[0, 60],
|
|
78
|
-
[0, 70],
|
|
79
|
-
[0, 80],
|
|
80
|
-
[0, 90]
|
|
81
|
-
];
|
|
82
|
-
|
|
83
|
-
const verticalPoints = [
|
|
84
|
-
[10, 0],
|
|
85
|
-
[20, 0],
|
|
86
|
-
[30, 0],
|
|
87
|
-
[40, 0],
|
|
88
|
-
[50, 0],
|
|
89
|
-
[60, 0],
|
|
90
|
-
[70, 0],
|
|
91
|
-
[80, 0],
|
|
92
|
-
[90, 0]
|
|
93
|
-
];
|
|
94
|
-
|
|
95
|
-
verticalPoints.forEach(coord => {
|
|
96
|
-
drawMarker({x: coord[0], y: coord[1], horizontal: false });
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
horizontalPoints.forEach(coord => {
|
|
100
|
-
drawMarker({x: coord[0], y: coord[1], horizontal: true });
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const drawThing = () => {
|
|
106
|
-
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const draw = () => {
|
|
110
|
-
canvas.width = window.innerWidth;
|
|
111
|
-
canvas.height = window.innerHeight;
|
|
112
|
-
|
|
113
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
114
|
-
drawMarkers();
|
|
115
|
-
drawThing();
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
draw();
|
|
119
|
-
|
|
120
|
-
window.addEventListener('resize', draw);
|
package/test/StateUpdates.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const { COLORS } = require("../src/Colors");
|
|
2
|
-
const assert = require("assert");
|
|
3
|
-
const Squisher = require('../src/Squisher');
|
|
4
|
-
const { unsquish } = require('../src/squish');
|
|
5
|
-
|
|
6
|
-
const { FakeGame, verifyArrayEquality, rectNode, polygonNode, circleNode } = require('./utils');
|
|
7
|
-
|
|
8
|
-
test("two layers - square over square", () => {
|
|
9
|
-
console.log("two layers - one square over another");
|
|
10
|
-
});
|
package/testapp.html
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE HTML>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>Homegames</title>
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<div>
|
|
9
|
-
<canvas id='tester-canvas'></canvas>
|
|
10
|
-
</div>
|
|
11
|
-
</body>
|
|
12
|
-
<script src="src/squish.js"></script>
|
|
13
|
-
<script src="render-tester.js"></script>
|
|
14
|
-
<style>
|
|
15
|
-
|
|
16
|
-
body {
|
|
17
|
-
margin: 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
canvas, body {
|
|
21
|
-
width: 100vw;
|
|
22
|
-
height: 100vh;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
</style>
|
|
26
|
-
</html>
|