frigame3 3.0.0 → 3.0.1

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.
Files changed (180) hide show
  1. package/dist/Animation.d.ts +42 -0
  2. package/dist/Animation.js +189 -0
  3. package/dist/BaseSprite.d.ts +116 -0
  4. package/dist/BaseSprite.js +518 -0
  5. package/dist/Gradient.d.ts +31 -0
  6. package/dist/Gradient.js +89 -0
  7. package/dist/Playground.d.ts +48 -0
  8. package/dist/Playground.js +167 -0
  9. package/dist/Rect.d.ts +63 -0
  10. package/dist/Rect.js +155 -0
  11. package/dist/Rectangle.d.ts +31 -0
  12. package/dist/Rectangle.js +69 -0
  13. package/dist/Renderer.d.ts +23 -0
  14. package/dist/Renderer.js +1 -0
  15. package/dist/ResourceManager.d.ts +21 -0
  16. package/dist/ResourceManager.js +100 -0
  17. package/dist/Sprite.d.ts +56 -0
  18. package/dist/Sprite.js +437 -0
  19. package/dist/SpriteGroup.d.ts +39 -0
  20. package/dist/SpriteGroup.js +176 -0
  21. package/dist/canvasRenderer/renderGroup.d.ts +15 -0
  22. package/dist/canvasRenderer/renderGroup.js +134 -0
  23. package/dist/canvasRenderer/renderPlayground.d.ts +9 -0
  24. package/dist/canvasRenderer/renderPlayground.js +67 -0
  25. package/dist/canvasRenderer/renderRectangle.d.ts +15 -0
  26. package/dist/canvasRenderer/renderRectangle.js +287 -0
  27. package/dist/canvasRenderer/renderSprite.d.ts +4 -0
  28. package/dist/canvasRenderer/renderSprite.js +93 -0
  29. package/dist/canvasRenderer.d.ts +2 -0
  30. package/dist/canvasRenderer.js +19 -0
  31. package/dist/dummyRenderer.d.ts +2 -0
  32. package/dist/dummyRenderer.js +41 -0
  33. package/dist/plugins/GamepadTracker.d.ts +15 -0
  34. package/dist/plugins/GamepadTracker.js +74 -0
  35. package/dist/plugins/Tilemap.d.ts +26 -0
  36. package/dist/plugins/Tilemap.js +85 -0
  37. package/dist/plugins/Vec2.d.ts +69 -0
  38. package/dist/plugins/Vec2.js +296 -0
  39. package/dist/plugins/fx/Shaker.d.ts +46 -0
  40. package/dist/plugins/fx/Shaker.js +190 -0
  41. package/dist/plugins/fx/Tweener.d.ts +42 -0
  42. package/dist/plugins/fx/Tweener.js +166 -0
  43. package/dist/plugins/fx/easing.d.ts +32 -0
  44. package/dist/plugins/fx/easing.js +192 -0
  45. package/dist/plugins/isometric/ISOMixin.d.ts +138 -0
  46. package/dist/plugins/isometric/ISOMixin.js +322 -0
  47. package/dist/plugins/isometric/ISORectangle.d.ts +151 -0
  48. package/dist/plugins/isometric/ISORectangle.js +127 -0
  49. package/dist/plugins/isometric/ISOSprite.d.ts +157 -0
  50. package/dist/plugins/isometric/ISOSprite.js +176 -0
  51. package/dist/plugins/isometric/ISOSpriteGroup.d.ts +151 -0
  52. package/dist/plugins/isometric/ISOSpriteGroup.js +116 -0
  53. package/dist/plugins/isometric/ISOTilemap.d.ts +24 -0
  54. package/dist/plugins/isometric/ISOTilemap.js +85 -0
  55. package/dist/plugins/isometric/utils.d.ts +2 -0
  56. package/dist/plugins/isometric/utils.js +10 -0
  57. package/dist/plugins/keyTracker.d.ts +3 -0
  58. package/dist/plugins/keyTracker.js +23 -0
  59. package/dist/plugins/mixer.d.ts +72 -0
  60. package/dist/plugins/mixer.js +396 -0
  61. package/dist/plugins/sorted/SortedAnimation.d.ts +13 -0
  62. package/dist/plugins/sorted/SortedAnimation.js +27 -0
  63. package/dist/plugins/sorted/SortedGroup.d.ts +137 -0
  64. package/dist/plugins/sorted/SortedGroup.js +61 -0
  65. package/dist/plugins/sorted/SortedMixin.d.ts +122 -0
  66. package/dist/plugins/sorted/SortedMixin.js +153 -0
  67. package/dist/plugins/sorted/SortedRectangle.d.ts +127 -0
  68. package/dist/plugins/sorted/SortedRectangle.js +17 -0
  69. package/dist/plugins/sorted/SortedSprite.d.ts +130 -0
  70. package/dist/plugins/sorted/SortedSprite.js +35 -0
  71. package/dist/utils.d.ts +11 -0
  72. package/dist/utils.js +33 -0
  73. package/package.json +6 -2
  74. package/CHANGELOG.md +0 -13
  75. package/biome.json +0 -93
  76. package/demo/package-lock.json +0 -515
  77. package/demo/package.json +0 -19
  78. package/demo/snake/index.html +0 -16
  79. package/demo/snake/index.ts +0 -110
  80. package/demo/tetris/index.html +0 -16
  81. package/demo/tetris/index.ts +0 -536
  82. package/demo/tsconfig.json +0 -53
  83. package/src/Animation.ts +0 -266
  84. package/src/BaseSprite.ts +0 -682
  85. package/src/Gradient.ts +0 -120
  86. package/src/Playground.ts +0 -247
  87. package/src/Rect.ts +0 -237
  88. package/src/Rectangle.ts +0 -108
  89. package/src/Renderer.ts +0 -28
  90. package/src/ResourceManager.ts +0 -145
  91. package/src/Sprite.ts +0 -484
  92. package/src/SpriteGroup.ts +0 -258
  93. package/src/canvasRenderer/renderGroup.ts +0 -194
  94. package/src/canvasRenderer/renderPlayground.ts +0 -103
  95. package/src/canvasRenderer/renderRectangle.ts +0 -421
  96. package/src/canvasRenderer/renderSprite.ts +0 -148
  97. package/src/canvasRenderer.ts +0 -38
  98. package/src/dummyRenderer.ts +0 -62
  99. package/src/plugins/GamepadTracker.ts +0 -97
  100. package/src/plugins/Tilemap.ts +0 -123
  101. package/src/plugins/Vec2.ts +0 -420
  102. package/src/plugins/fx/Shaker.ts +0 -293
  103. package/src/plugins/fx/Tweener.ts +0 -252
  104. package/src/plugins/fx/easing.ts +0 -276
  105. package/src/plugins/isometric/ISOMixin.ts +0 -444
  106. package/src/plugins/isometric/ISORectangle.ts +0 -183
  107. package/src/plugins/isometric/ISOSprite.ts +0 -228
  108. package/src/plugins/isometric/ISOSpriteGroup.ts +0 -155
  109. package/src/plugins/isometric/ISOTilemap.ts +0 -122
  110. package/src/plugins/isometric/utils.ts +0 -19
  111. package/src/plugins/keyTracker.ts +0 -31
  112. package/src/plugins/mixer.ts +0 -523
  113. package/src/plugins/sorted/SortedAnimation.ts +0 -53
  114. package/src/plugins/sorted/SortedGroup.ts +0 -94
  115. package/src/plugins/sorted/SortedMixin.ts +0 -203
  116. package/src/plugins/sorted/SortedRectangle.ts +0 -35
  117. package/src/plugins/sorted/SortedSprite.ts +0 -56
  118. package/src/utils.ts +0 -53
  119. package/test/animation/index.html +0 -20
  120. package/test/animation/index.ts +0 -253
  121. package/test/animation/mh.png +0 -0
  122. package/test/animation/moh.png +0 -0
  123. package/test/animation/mov.png +0 -0
  124. package/test/animation/mv.png +0 -0
  125. package/test/animation/rebound.png +0 -0
  126. package/test/animation/reboundm.png +0 -0
  127. package/test/animation/sh.png +0 -0
  128. package/test/animation/soh.png +0 -0
  129. package/test/animation/sov.png +0 -0
  130. package/test/animation/sv.png +0 -0
  131. package/test/isometric1/beach.png +0 -0
  132. package/test/isometric1/foglie.png +0 -0
  133. package/test/isometric1/grass.png +0 -0
  134. package/test/isometric1/index.html +0 -17
  135. package/test/isometric1/index.ts +0 -68
  136. package/test/isometric1/tronco.png +0 -0
  137. package/test/isometric1/untitled.tmx +0 -25
  138. package/test/isometric1/water.png +0 -0
  139. package/test/isometric2/banner.png +0 -0
  140. package/test/isometric2/books.png +0 -0
  141. package/test/isometric2/candlestick.png +0 -0
  142. package/test/isometric2/ice.png +0 -0
  143. package/test/isometric2/index.html +0 -16
  144. package/test/isometric2/index.ts +0 -129
  145. package/test/isometric2/knight_se.png +0 -0
  146. package/test/isometric2/tile.png +0 -0
  147. package/test/isometric2/untitled.tmx +0 -36
  148. package/test/isometric2/wall.png +0 -0
  149. package/test/layers/boy.png +0 -0
  150. package/test/layers/catgirl.png +0 -0
  151. package/test/layers/fri1.svg +0 -8
  152. package/test/layers/grassblock.png +0 -0
  153. package/test/layers/horngirl.png +0 -0
  154. package/test/layers/index.html +0 -17
  155. package/test/layers/index.ts +0 -191
  156. package/test/layers/pinkgirl.png +0 -0
  157. package/test/layers/render_ruler.py +0 -57
  158. package/test/layers/ruler.png +0 -0
  159. package/test/layers/sh.png +0 -0
  160. package/test/mixer/dieci.opus +0 -0
  161. package/test/mixer/dieci.wav +0 -0
  162. package/test/mixer/index.html +0 -33
  163. package/test/mixer/index.ts +0 -206
  164. package/test/mixer/news_intro.mp3 +0 -0
  165. package/test/mixer/news_intro.ogg +0 -0
  166. package/test/mixer/prova.mp3 +0 -0
  167. package/test/mixer/prova.ogg +0 -0
  168. package/test/package-lock.json +0 -515
  169. package/test/package.json +0 -19
  170. package/test/sorted/Brown Block.png +0 -0
  171. package/test/sorted/index.html +0 -16
  172. package/test/sorted/index.ts +0 -38
  173. package/test/transformation1/index.html +0 -17
  174. package/test/transformation1/index.ts +0 -51
  175. package/test/transformation1/sh.png +0 -0
  176. package/test/transformation2/index.html +0 -20
  177. package/test/transformation2/index.ts +0 -71
  178. package/test/transformation2/sh.png +0 -0
  179. package/test/tsconfig.json +0 -53
  180. package/tsconfig.json +0 -51
@@ -1,68 +0,0 @@
1
- import { canvasRenderer } from "frigame3/dist/canvasRenderer.js";
2
- import { Playground } from "frigame3/dist/Playground.js";
3
- import { ISOSpriteGroup } from "frigame3/dist/plugins/isometric/ISOSpriteGroup.js";
4
- import { ISOTilemap } from "frigame3/dist/plugins/isometric/ISOTilemap.js";
5
- import { SortedAnimation } from "frigame3/dist/plugins/sorted/SortedAnimation.js";
6
- import { ResourceManager } from "frigame3/dist/ResourceManager.js";
7
- import { SpriteGroup } from "frigame3/dist/SpriteGroup.js";
8
-
9
- void (async (): Promise<void> => {
10
- const rm = new ResourceManager();
11
-
12
- const beach = rm.addResource(
13
- new SortedAnimation({
14
- imageURL: "beach.png",
15
- originx: 50,
16
- originy: 25,
17
- }),
18
- );
19
- const grass = rm.addResource(new SortedAnimation("grass.png"));
20
- const water = rm.addResource(
21
- new SortedAnimation({
22
- imageURL: "water.png",
23
- originx: 50,
24
- originy: 25,
25
- }),
26
- );
27
-
28
- const tileDescription = {
29
- sizex: 8,
30
- sizey: 8,
31
- tileSize: 50,
32
- // biome-ignore format: reason
33
- data: [
34
- 3,1,1,1,1,1,1,2,
35
- 1,1,1,1,1,1,1,1,
36
- 1,1,1,1,1,1,1,1,
37
- 1,1,1,1,1,1,1,1,
38
- 1,1,1,1,1,1,1,1,
39
- 1,1,1,1,1,1,1,1,
40
- 1,1,1,1,1,1,1,1,
41
- 2,1,1,1,1,1,1,3,
42
- ],
43
- animationList: {
44
- 1: { animation: beach },
45
- 2: { animation: grass, originx: 50, originy: 25 },
46
- 3: { animation: water },
47
- },
48
- };
49
-
50
- await rm.preload();
51
-
52
- const playground = new Playground(canvasRenderer);
53
- const sg = playground.scenegraph;
54
-
55
- const my_group = sg.addChild(new SpriteGroup({ left: 400 }));
56
- const iso_group = my_group.addChild(
57
- new ISOSpriteGroup({
58
- referencex: 0,
59
- referencey: 0,
60
- originx: 0,
61
- originy: 0,
62
- }),
63
- );
64
- const tilemap = iso_group.addChild(new ISOTilemap(tileDescription));
65
-
66
- // biome-ignore lint/suspicious/noExplicitAny: reason
67
- (window as any).tilemap = tilemap;
68
- })();
Binary file
@@ -1,25 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <map version="1.0" orientation="isometric" width="8" height="8" tilewidth="100" tileheight="50">
3
- <tileset firstgid="1" name="beach" tilewidth="100" tileheight="50">
4
- <image source="beach.png" width="100" height="65"/>
5
- </tileset>
6
- <tileset firstgid="2" name="grass" tilewidth="100" tileheight="50">
7
- <image source="grass.png" width="100" height="65"/>
8
- </tileset>
9
- <tileset firstgid="3" name="water" tilewidth="100" tileheight="50">
10
- <image source="water.png" width="100" height="58"/>
11
- </tileset>
12
- <layer name="Tile Layer 1" width="8" height="8">
13
- <data encoding="csv">
14
- 1,0,0,0,0,0,0,3,
15
- 0,0,0,0,0,0,0,0,
16
- 0,0,0,0,0,0,0,0,
17
- 0,0,0,0,0,0,0,0,
18
- 0,0,0,0,0,0,0,0,
19
- 0,0,0,0,0,0,0,0,
20
- 0,0,0,0,0,0,0,0,
21
- 2,0,0,0,0,0,0,3
22
- </data>
23
- </layer>
24
- <objectgroup name="Livello di Oggetti 1" width="8" height="8"/>
25
- </map>
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,16 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
-
6
- <link rel="stylesheet" type="text/css" href="../../frigame.css">
7
- </head>
8
- <body style="position: relative;">
9
- <div
10
- id="playground"
11
- style="position: relative; width: 1024px; height: 640px; background: #ff00ff;"
12
- ></div>
13
-
14
- <script src="bundle.js"></script>
15
- </body>
16
- </html>
@@ -1,129 +0,0 @@
1
- import { canvasRenderer } from "frigame3/dist/canvasRenderer.js";
2
- import { Playground } from "frigame3/dist/Playground.js";
3
- import { ISOSprite } from "frigame3/dist/plugins/isometric/ISOSprite.js";
4
- import { ISOTilemap } from "frigame3/dist/plugins/isometric/ISOTilemap.js";
5
- import { gridFromScreen } from "frigame3/dist/plugins/isometric/utils.js";
6
- import { SortedAnimation } from "frigame3/dist/plugins/sorted/SortedAnimation.js";
7
- import { ResourceManager } from "frigame3/dist/ResourceManager.js";
8
- import { SpriteGroup } from "frigame3/dist/SpriteGroup.js";
9
-
10
- void (async (): Promise<void> => {
11
- const rm = new ResourceManager();
12
-
13
- const floor = rm.addResource(
14
- new SortedAnimation({
15
- imageURL: "tile.png",
16
- originx: 64,
17
- originy: 32,
18
- }),
19
- );
20
- const ice_floor = rm.addResource(
21
- new SortedAnimation({
22
- imageURL: "ice.png",
23
- originx: 64,
24
- originy: 54,
25
- }),
26
- );
27
- const block = rm.addResource(
28
- new SortedAnimation({
29
- imageURL: "tile.png",
30
- originx: 64,
31
- originy: 96,
32
- }),
33
- );
34
- const ice = rm.addResource(
35
- new SortedAnimation({
36
- imageURL: "ice.png",
37
- originx: 64,
38
- originy: 118,
39
- }),
40
- );
41
- const knight = rm.addResource(
42
- new SortedAnimation({
43
- imageURL: "knight_se.png",
44
- numberOfFrame: 8,
45
- }),
46
- );
47
-
48
- const animationList = {
49
- 1: { animation: floor },
50
- 2: { animation: ice_floor },
51
- 3: { animation: block },
52
- 4: { animation: ice, opacity: 0.8 },
53
- };
54
-
55
- const floorTiles = {
56
- sizex: 8,
57
- sizey: 8,
58
- tileSize: 64,
59
- // biome-ignore format: reason
60
- data: [
61
- 1,1,1,1,1,1,1,1,
62
- 1,1,1,1,2,2,2,1,
63
- 1,1,1,1,2,1,2,1,
64
- 1,1,1,1,1,1,2,1,
65
- 1,1,1,1,1,1,1,1,
66
- 1,1,1,1,1,1,1,1,
67
- 1,1,1,1,1,1,1,1,
68
- 1,1,1,1,1,1,1,1,
69
- ],
70
- animationList,
71
- };
72
-
73
- const objectTiles = {
74
- sizex: 8,
75
- sizey: 8,
76
- tileSize: 64,
77
- // biome-ignore format: reason
78
- data: [
79
- 4,0,0,0,0,0,0,0,
80
- 0,0,0,0,0,0,0,0,
81
- 0,0,0,0,0,3,0,0,
82
- 0,0,0,0,0,3,0,0,
83
- 0,0,0,0,0,0,0,0,
84
- 0,0,0,0,0,4,0,0,
85
- 0,0,0,0,0,0,0,0,
86
- 0,0,0,0,0,0,0,0,
87
- ],
88
- animationList,
89
- };
90
-
91
- await rm.preload();
92
-
93
- const playground = new Playground(canvasRenderer);
94
- const sg = playground.scenegraph;
95
-
96
- const my_group = sg.addChild(new SpriteGroup({ left: 512, top: 64 }));
97
-
98
- // floor_tilemap
99
- my_group.addChild(new ISOTilemap(floorTiles));
100
-
101
- const object_tilemap = my_group.addChild(new ISOTilemap(objectTiles));
102
- const iso_knight = object_tilemap.addChild(
103
- new ISOSprite({
104
- centerx: 256,
105
- centery: 256,
106
- radius: 32,
107
- animation: knight,
108
- rate: 100,
109
- }),
110
- );
111
-
112
- document.getElementById("playground")!.addEventListener("mousedown", (e) => {
113
- const box = document.getElementById("playground")!.getBoundingClientRect();
114
-
115
- const clicked_x = e.pageX - box.left;
116
- const clicked_y = e.pageY - box.top;
117
-
118
- const [iso_x, iso_y] = gridFromScreen(
119
- clicked_x - my_group.left,
120
- clicked_y - my_group.top,
121
- );
122
-
123
- iso_knight.centerx = iso_x;
124
- iso_knight.centery = iso_y;
125
- });
126
-
127
- // biome-ignore lint/suspicious/noExplicitAny: reason
128
- (window as any).object_tilemap = object_tilemap;
129
- })();
Binary file
Binary file
@@ -1,36 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <map version="1.0" orientation="isometric" width="8" height="8" tilewidth="128" tileheight="64">
3
- <tileset firstgid="1" name="tile" tilewidth="128" tileheight="64">
4
- <image source="../Work/GitHub/frigame_isometric/tests/layers/tile.png" width="128" height="128"/>
5
- </tileset>
6
- <tileset firstgid="3" name="block" tilewidth="128" tileheight="128">
7
- <image source="../Work/GitHub/frigame_isometric/tests/layers/tile.png" width="128" height="128"/>
8
- </tileset>
9
- <tileset firstgid="4" name="ice_block" tilewidth="128" tileheight="128">
10
- <image source="../Work/GitHub/frigame_isometric/tests/layers/ice.png" width="128" height="150"/>
11
- </tileset>
12
- <layer name="Tile Layer 1" width="8" height="8">
13
- <data encoding="csv">
14
- 1,1,1,1,1,1,1,1,
15
- 1,1,1,1,1,1,1,1,
16
- 1,1,1,1,1,1,1,1,
17
- 1,1,1,1,1,1,1,1,
18
- 1,1,1,1,1,1,1,1,
19
- 1,1,1,1,1,1,1,1,
20
- 1,1,1,1,1,1,1,1,
21
- 1,1,1,1,1,1,1,1
22
- </data>
23
- </layer>
24
- <layer name="Livello di Celle 2" width="8" height="8">
25
- <data encoding="csv">
26
- 4,0,0,0,0,0,0,0,
27
- 0,0,0,0,0,0,0,0,
28
- 0,0,0,0,0,0,0,0,
29
- 0,0,0,0,0,0,0,0,
30
- 0,0,0,0,0,0,0,0,
31
- 0,0,0,0,0,4,0,0,
32
- 0,0,0,0,0,0,0,0,
33
- 0,0,0,0,0,0,0,0
34
- </data>
35
- </layer>
36
- </map>
Binary file
Binary file
Binary file
@@ -1,8 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none">
2
- <defs>
3
- <clipPath id="myClip">
4
- <path d="M 0 0 L 100 0 L 100 100 L 0 0" />
5
- </clipPath>
6
- </defs>
7
- </svg>
8
-
Binary file
Binary file
@@ -1,17 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
-
6
- <link rel="stylesheet" type="text/css" href="../../frigame.css">
7
- </head>
8
- <body style="position: relative;">
9
- <h2>Movable layers:</h2>
10
- <div
11
- id="playground"
12
- style="position: relative; width: 512px; height: 512px; background: white;"
13
- ></div>
14
-
15
- <script src="bundle.js"></script>
16
- </body>
17
- </html>
@@ -1,191 +0,0 @@
1
- import { Animation } from "frigame3/dist/Animation.js";
2
- import { canvasRenderer } from "frigame3/dist/canvasRenderer.js";
3
- import { Gradient } from "frigame3/dist/Gradient.js";
4
- import { Playground } from "frigame3/dist/Playground.js";
5
- import { startKeyTracker } from "frigame3/dist/plugins/keyTracker.js";
6
- import { Rectangle } from "frigame3/dist/Rectangle.js";
7
- import { ResourceManager } from "frigame3/dist/ResourceManager.js";
8
- import { Sprite } from "frigame3/dist/Sprite.js";
9
- import { SpriteGroup } from "frigame3/dist/SpriteGroup.js";
10
- import { spriteRef } from "frigame3/dist/utils.js";
11
-
12
- void (async (): Promise<void> => {
13
- const rm = new ResourceManager();
14
-
15
- const ruler = rm.addResource(new Animation("ruler.png"));
16
- const animation = rm.addResource(
17
- new Animation({
18
- imageURL: "sh.png",
19
- type: "horizontal",
20
- numberOfFrame: 4,
21
- rate: 300,
22
- }),
23
- );
24
- const gradient = new Gradient({ r: 128 }, { b: 255, a: 0.3 }, "horizontal");
25
- const red = new Gradient({ r: 128 });
26
- const blue = new Gradient({ b: 255, a: 0.6 });
27
-
28
- // grassblock
29
- rm.addResource(new Animation("grassblock.png"));
30
-
31
- const boy = rm.addResource(new Animation("boy.png"));
32
- const catgirl = rm.addResource(new Animation("catgirl.png"));
33
- const horngirl = rm.addResource(new Animation("horngirl.png"));
34
- const pinkgirl = rm.addResource(new Animation("pinkgirl.png"));
35
-
36
- await rm.preload();
37
-
38
- const playground = new Playground(canvasRenderer);
39
- const sg = playground.scenegraph;
40
-
41
- const rectangle1 = spriteRef<Rectangle>();
42
- const sprite1 = spriteRef<Sprite>();
43
- const sprite2 = spriteRef<Sprite>();
44
- const group1 = spriteRef<SpriteGroup>();
45
- sg.addChild(
46
- new SpriteGroup({
47
- width: sg.width,
48
- height: sg.height,
49
- ref: group1,
50
- children: [
51
- new Rectangle({
52
- width: sg.width,
53
- height: sg.height,
54
- background: gradient,
55
- ref: rectangle1,
56
- }),
57
- new Sprite({
58
- animation: animation,
59
- left: 16,
60
- top: 32,
61
- ref: sprite1,
62
- }),
63
- new Sprite({
64
- animation: animation,
65
- centerx: 0,
66
- top: 192,
67
- ref: sprite2,
68
- }),
69
- ],
70
- }),
71
- );
72
-
73
- const group2 = sg.addChild(
74
- new SpriteGroup({
75
- left: 100,
76
- top: 150,
77
- width: 300,
78
- height: 200,
79
- children: [
80
- new Rectangle({ width: 300, height: 200 }),
81
- new Sprite({
82
- animation: catgirl,
83
- left: 32,
84
- top: 32,
85
- }),
86
- new Sprite({
87
- animation: horngirl,
88
- left: 48,
89
- top: 32,
90
- }),
91
- new Sprite({
92
- animation: pinkgirl,
93
- left: 64,
94
- top: 32,
95
- }),
96
- ],
97
- }),
98
- );
99
- group2.insertChild(new Sprite({ animation: boy, left: 16, top: 32 }));
100
-
101
- sg.insertChild(
102
- new SpriteGroup({
103
- width: 1,
104
- height: 1,
105
- children: [new Sprite({ animation: ruler })],
106
- }),
107
- );
108
-
109
- const rect1 = spriteRef<SpriteGroup>();
110
- sg.addChild(
111
- new SpriteGroup({
112
- left: 48,
113
- top: 48,
114
- width: 64,
115
- height: 64,
116
- children: [
117
- new Rectangle({
118
- width: 64,
119
- height: 64,
120
- background: red,
121
- borderColor: blue,
122
- borderRadius: 14,
123
- borderWidth: 12,
124
- }),
125
- new SpriteGroup({
126
- width: 64,
127
- height: 64,
128
- borderRadius: 14,
129
- ref: rect1,
130
- children: [
131
- new Sprite({
132
- animation: catgirl,
133
- left: 32,
134
- top: 32,
135
- }),
136
- ],
137
- }),
138
- ],
139
- }),
140
- );
141
-
142
- sg.addChild(
143
- new SpriteGroup({
144
- width: sg.width,
145
- height: sg.height,
146
- left: 100,
147
- top: 370,
148
- children: [
149
- new Rectangle({
150
- width: 300,
151
- height: 100,
152
- borderRadius: 20,
153
- borderColor: blue,
154
- borderWidth: 12,
155
- }),
156
- new Sprite({
157
- animation: catgirl,
158
- left: 32,
159
- top: 32,
160
- }),
161
- ],
162
- }),
163
- );
164
-
165
- sg.addChild(
166
- new Sprite({
167
- animation: animation,
168
- centerx: 304,
169
- centery: 48,
170
- transformOriginx: 12,
171
- transformOriginy: "height",
172
- scalex: 3,
173
- scaley: 2,
174
- angle: (27 * Math.PI) / 180,
175
- }),
176
- );
177
-
178
- group1.current!.left = 64;
179
- group1.current!.top = 128;
180
- group1.current!.width -= 64;
181
- group1.current!.height -= 128;
182
- rectangle1.current!.width -= 64;
183
- rectangle1.current!.height -= 128;
184
- sprite1.current!.angle = (45 * Math.PI) / 180;
185
- sprite2.current!.scale = 2;
186
- rect1.current!.crop = true;
187
-
188
- console.log(group1);
189
- console.log(rectangle1);
190
- startKeyTracker();
191
- })();
Binary file
@@ -1,57 +0,0 @@
1
- #! /usr/bin/env python
2
- # -*- coding: ascii -*-
3
-
4
- from __future__ import division
5
-
6
- import cairo
7
-
8
- DIM_RULER = 512
9
-
10
- STEP = 64
11
-
12
- def main():
13
- surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, DIM_RULER, DIM_RULER)
14
- ctx = cairo.Context(surface)
15
- ctx.set_antialias(cairo.ANTIALIAS_NONE)
16
-
17
- ctx.set_source_rgb(1, 1, 0.85)
18
- ctx.rectangle(0, 0, DIM_RULER, DIM_RULER)
19
- ctx.fill()
20
-
21
- ctx.set_line_width(1)
22
-
23
- ctx.set_source_rgb(0.33, 0.33, 0.33)
24
- for i in range(0, DIM_RULER, STEP):
25
- ctx.move_to(i, 0)
26
- ctx.line_to(i, DIM_RULER)
27
- ctx.stroke()
28
- ctx.move_to(0, i)
29
- ctx.line_to(DIM_RULER, i)
30
- ctx.stroke()
31
-
32
- ctx.set_source_rgb(0.5, 0.5, 0.5)
33
- for i in range(int(STEP // 2), DIM_RULER, STEP):
34
- ctx.move_to(i, 0)
35
- ctx.line_to(i, DIM_RULER)
36
- ctx.stroke()
37
- ctx.move_to(0, i)
38
- ctx.line_to(DIM_RULER, i)
39
- ctx.stroke()
40
-
41
- ctx.set_source_rgb(0.66, 0.66, 0.66)
42
- ctx.set_dash([2, 2])
43
- for start in (int(STEP // 4), int((STEP * 3) // 4)):
44
- for i in range(start, DIM_RULER, STEP):
45
- ctx.move_to(i, 0)
46
- ctx.line_to(i, DIM_RULER)
47
- ctx.stroke()
48
- ctx.move_to(0, i)
49
- ctx.line_to(DIM_RULER, i)
50
- ctx.stroke()
51
-
52
- surface.write_to_png('ruler.png')
53
-
54
-
55
- if __name__ == '__main__':
56
- main()
57
-
Binary file
Binary file
Binary file
Binary file
@@ -1,33 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
-
6
- <link rel="stylesheet" type="text/css" href="../../frigame.css">
7
- </head>
8
- <body style="position: relative;">
9
- <input type="button" id="start" value="Start Loading">
10
- <input type="button" id="loadmono" value="Load Mono HTML5">
11
- <input type="button" id="loadstereo" value="Load Stereo HTML5">
12
- <input type="button" id="monomp3" value="Mono (mp3)">
13
- <input type="button" id="stereomp3" value="Stereo (mp3)">
14
- <input type="button" id="monosfx" value="Mono (sfx)">
15
- <input type="button" id="stereosfx" value="Stereo (sfx)">
16
- <input type="button" id="monowebaudio" value="Mono (webaudio)">
17
- <input type="button" id="stereowebaudio" value="Stereo (webaudio)">
18
- <input type="button" id="pause" value="Pause">
19
- <input type="button" id="resume" value="Resume">
20
- <input type="button" id="monohtml5" value="Mono (html5 audio)">
21
- <input type="button" id="stereohtml5" value="Stereo (html5 audio)">
22
- <input type="button" id="panleft" value="Pan left">
23
- <input type="button" id="pancenter" value="Pan center">
24
- <input type="button" id="panright" value="Pan right">
25
- <input type="button" id="stop" value="Stop">
26
- <input type="button" id="double" value="Double">
27
- <input type="button" id="normal" value="Normal">
28
- <input type="button" id="half" value="Half">
29
- <input type="button" id="dieci" value="Dieci">
30
-
31
- <script src="bundle.js"></script>
32
- </body>
33
- </html>