frigame3 0.0.0-stage → 3.0.0
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/CHANGELOG.md +13 -0
- package/LICENSE +373 -0
- package/README.md +80 -2
- package/biome.json +93 -0
- package/demo/package-lock.json +515 -0
- package/demo/package.json +19 -0
- package/demo/snake/index.html +16 -0
- package/demo/snake/index.ts +110 -0
- package/demo/tetris/index.html +16 -0
- package/demo/tetris/index.ts +536 -0
- package/demo/tsconfig.json +53 -0
- package/frigame.css +12 -0
- package/package.json +50 -4
- package/src/Animation.ts +266 -0
- package/src/BaseSprite.ts +682 -0
- package/src/Gradient.ts +120 -0
- package/src/Playground.ts +247 -0
- package/src/Rect.ts +237 -0
- package/src/Rectangle.ts +108 -0
- package/src/Renderer.ts +28 -0
- package/src/ResourceManager.ts +145 -0
- package/src/Sprite.ts +484 -0
- package/src/SpriteGroup.ts +258 -0
- package/src/canvasRenderer/renderGroup.ts +194 -0
- package/src/canvasRenderer/renderPlayground.ts +103 -0
- package/src/canvasRenderer/renderRectangle.ts +421 -0
- package/src/canvasRenderer/renderSprite.ts +148 -0
- package/src/canvasRenderer.ts +38 -0
- package/src/dummyRenderer.ts +62 -0
- package/src/plugins/GamepadTracker.ts +97 -0
- package/src/plugins/Tilemap.ts +123 -0
- package/src/plugins/Vec2.ts +420 -0
- package/src/plugins/fx/Shaker.ts +293 -0
- package/src/plugins/fx/Tweener.ts +252 -0
- package/src/plugins/fx/easing.ts +276 -0
- package/src/plugins/isometric/ISOMixin.ts +444 -0
- package/src/plugins/isometric/ISORectangle.ts +183 -0
- package/src/plugins/isometric/ISOSprite.ts +228 -0
- package/src/plugins/isometric/ISOSpriteGroup.ts +155 -0
- package/src/plugins/isometric/ISOTilemap.ts +122 -0
- package/src/plugins/isometric/utils.ts +19 -0
- package/src/plugins/keyTracker.ts +31 -0
- package/src/plugins/mixer.ts +523 -0
- package/src/plugins/sorted/SortedAnimation.ts +53 -0
- package/src/plugins/sorted/SortedGroup.ts +94 -0
- package/src/plugins/sorted/SortedMixin.ts +203 -0
- package/src/plugins/sorted/SortedRectangle.ts +35 -0
- package/src/plugins/sorted/SortedSprite.ts +56 -0
- package/src/utils.ts +53 -0
- package/test/animation/index.html +20 -0
- package/test/animation/index.ts +253 -0
- package/test/animation/mh.png +0 -0
- package/test/animation/moh.png +0 -0
- package/test/animation/mov.png +0 -0
- package/test/animation/mv.png +0 -0
- package/test/animation/rebound.png +0 -0
- package/test/animation/reboundm.png +0 -0
- package/test/animation/sh.png +0 -0
- package/test/animation/soh.png +0 -0
- package/test/animation/sov.png +0 -0
- package/test/animation/sv.png +0 -0
- package/test/isometric1/beach.png +0 -0
- package/test/isometric1/foglie.png +0 -0
- package/test/isometric1/grass.png +0 -0
- package/test/isometric1/index.html +17 -0
- package/test/isometric1/index.ts +68 -0
- package/test/isometric1/tronco.png +0 -0
- package/test/isometric1/untitled.tmx +25 -0
- package/test/isometric1/water.png +0 -0
- package/test/isometric2/banner.png +0 -0
- package/test/isometric2/books.png +0 -0
- package/test/isometric2/candlestick.png +0 -0
- package/test/isometric2/ice.png +0 -0
- package/test/isometric2/index.html +16 -0
- package/test/isometric2/index.ts +129 -0
- package/test/isometric2/knight_se.png +0 -0
- package/test/isometric2/tile.png +0 -0
- package/test/isometric2/untitled.tmx +36 -0
- package/test/isometric2/wall.png +0 -0
- package/test/layers/boy.png +0 -0
- package/test/layers/catgirl.png +0 -0
- package/test/layers/fri1.svg +8 -0
- package/test/layers/grassblock.png +0 -0
- package/test/layers/horngirl.png +0 -0
- package/test/layers/index.html +17 -0
- package/test/layers/index.ts +191 -0
- package/test/layers/pinkgirl.png +0 -0
- package/test/layers/render_ruler.py +57 -0
- package/test/layers/ruler.png +0 -0
- package/test/layers/sh.png +0 -0
- package/test/mixer/dieci.opus +0 -0
- package/test/mixer/dieci.wav +0 -0
- package/test/mixer/index.html +33 -0
- package/test/mixer/index.ts +206 -0
- package/test/mixer/news_intro.mp3 +0 -0
- package/test/mixer/news_intro.ogg +0 -0
- package/test/mixer/prova.mp3 +0 -0
- package/test/mixer/prova.ogg +0 -0
- package/test/package-lock.json +515 -0
- package/test/package.json +19 -0
- package/test/sorted/Brown Block.png +0 -0
- package/test/sorted/index.html +16 -0
- package/test/sorted/index.ts +38 -0
- package/test/transformation1/index.html +17 -0
- package/test/transformation1/index.ts +51 -0
- package/test/transformation1/sh.png +0 -0
- package/test/transformation2/index.html +20 -0
- package/test/transformation2/index.ts +71 -0
- package/test/transformation2/sh.png +0 -0
- package/test/tsconfig.json +53 -0
- package/tsconfig.json +51 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Animation } from "frigame3/dist/Animation.js";
|
|
2
|
+
import { canvasRenderer } from "frigame3/dist/canvasRenderer.js";
|
|
3
|
+
import { Playground } from "frigame3/dist/Playground.js";
|
|
4
|
+
import { ResourceManager } from "frigame3/dist/ResourceManager.js";
|
|
5
|
+
import { Sprite } from "frigame3/dist/Sprite.js";
|
|
6
|
+
|
|
7
|
+
void (async (): Promise<void> => {
|
|
8
|
+
const rm = new ResourceManager();
|
|
9
|
+
|
|
10
|
+
const animation = rm.addResource(
|
|
11
|
+
new Animation({
|
|
12
|
+
imageURL: "sh.png",
|
|
13
|
+
type: "horizontal",
|
|
14
|
+
numberOfFrame: 4,
|
|
15
|
+
rate: 300,
|
|
16
|
+
}),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
await rm.preload();
|
|
20
|
+
|
|
21
|
+
const playground = new Playground(canvasRenderer);
|
|
22
|
+
const sg = playground.scenegraph;
|
|
23
|
+
|
|
24
|
+
let angle = 45;
|
|
25
|
+
let angle_rad = (angle * Math.PI) / 180;
|
|
26
|
+
|
|
27
|
+
const aRotateScale = sg.addChild(
|
|
28
|
+
new Sprite({
|
|
29
|
+
animation: animation,
|
|
30
|
+
left: 16,
|
|
31
|
+
top: 16,
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
const scaleARotate = sg.addChild(
|
|
35
|
+
new Sprite({
|
|
36
|
+
animation: animation,
|
|
37
|
+
left: 80,
|
|
38
|
+
top: 16,
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
const rotateAScale = sg.addChild(
|
|
42
|
+
new Sprite({
|
|
43
|
+
animation: animation,
|
|
44
|
+
left: 180,
|
|
45
|
+
top: 16,
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
const aScaleRotate = sg.addChild(
|
|
49
|
+
new Sprite({
|
|
50
|
+
animation: animation,
|
|
51
|
+
left: 240,
|
|
52
|
+
top: 16,
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
playground.registerCallback(() => {
|
|
57
|
+
aRotateScale.angle = angle_rad;
|
|
58
|
+
aRotateScale.scale = 2;
|
|
59
|
+
scaleARotate.scale = 2;
|
|
60
|
+
scaleARotate.angle = -angle_rad;
|
|
61
|
+
rotateAScale.angle = Math.PI / 4;
|
|
62
|
+
rotateAScale.scale = Math.cos(angle_rad) * 2;
|
|
63
|
+
aScaleRotate.scale = -Math.cos(angle_rad) * 2;
|
|
64
|
+
aScaleRotate.angle = Math.PI / 4;
|
|
65
|
+
angle -= 1;
|
|
66
|
+
if (angle < -180) {
|
|
67
|
+
angle = 180;
|
|
68
|
+
}
|
|
69
|
+
angle_rad = (angle * Math.PI) / 180;
|
|
70
|
+
}, 30);
|
|
71
|
+
})();
|
|
Binary file
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Visit https://aka.ms/tsconfig to read more about this file
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
// File Layout
|
|
5
|
+
// "rootDir": "./src",
|
|
6
|
+
// "outDir": "./dist",
|
|
7
|
+
|
|
8
|
+
// Environment Settings
|
|
9
|
+
// See also https://aka.ms/tsconfig/module
|
|
10
|
+
"module": "nodenext",
|
|
11
|
+
"target": "esnext",
|
|
12
|
+
"types": [],
|
|
13
|
+
// For nodejs:
|
|
14
|
+
// "lib": ["esnext"],
|
|
15
|
+
// "types": ["node"],
|
|
16
|
+
// and npm install -D @types/node
|
|
17
|
+
|
|
18
|
+
// Other Outputs
|
|
19
|
+
// "sourceMap": true,
|
|
20
|
+
// "declaration": true,
|
|
21
|
+
// "declarationMap": true,
|
|
22
|
+
"noEmit": true,
|
|
23
|
+
|
|
24
|
+
// Stricter Typechecking Options
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
"exactOptionalPropertyTypes": true,
|
|
27
|
+
|
|
28
|
+
// Style Options
|
|
29
|
+
"noImplicitReturns": true,
|
|
30
|
+
"noImplicitOverride": true,
|
|
31
|
+
"noUnusedLocals": true,
|
|
32
|
+
"noUnusedParameters": true,
|
|
33
|
+
"noFallthroughCasesInSwitch": true,
|
|
34
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
35
|
+
|
|
36
|
+
// Recommended Options
|
|
37
|
+
"strict": true,
|
|
38
|
+
"jsx": "react-jsx",
|
|
39
|
+
"verbatimModuleSyntax": true,
|
|
40
|
+
"isolatedModules": true,
|
|
41
|
+
"noUncheckedSideEffectImports": true,
|
|
42
|
+
"moduleDetection": "force",
|
|
43
|
+
"skipLibCheck": true,
|
|
44
|
+
|
|
45
|
+
// Customizations
|
|
46
|
+
"allowUnreachableCode": false,
|
|
47
|
+
"allowUnusedLabels": false,
|
|
48
|
+
"erasableSyntaxOnly": true,
|
|
49
|
+
// "isolatedDeclarations": true,
|
|
50
|
+
},
|
|
51
|
+
"include": ["./**/*"],
|
|
52
|
+
"exclude": ["node_modules"]
|
|
53
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Visit https://aka.ms/tsconfig to read more about this file
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
// File Layout
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
|
|
8
|
+
// Environment Settings
|
|
9
|
+
// See also https://aka.ms/tsconfig/module
|
|
10
|
+
"module": "nodenext",
|
|
11
|
+
"target": "esnext",
|
|
12
|
+
"types": [],
|
|
13
|
+
// For nodejs:
|
|
14
|
+
// "lib": ["esnext"],
|
|
15
|
+
// "types": ["node"],
|
|
16
|
+
// and npm install -D @types/node
|
|
17
|
+
|
|
18
|
+
// Other Outputs
|
|
19
|
+
// "sourceMap": true,
|
|
20
|
+
"declaration": true,
|
|
21
|
+
// "declarationMap": true,
|
|
22
|
+
|
|
23
|
+
// Stricter Typechecking Options
|
|
24
|
+
"noUncheckedIndexedAccess": true,
|
|
25
|
+
"exactOptionalPropertyTypes": true,
|
|
26
|
+
|
|
27
|
+
// Style Options
|
|
28
|
+
"noImplicitReturns": true,
|
|
29
|
+
"noImplicitOverride": true,
|
|
30
|
+
"noUnusedLocals": true,
|
|
31
|
+
"noUnusedParameters": true,
|
|
32
|
+
"noFallthroughCasesInSwitch": true,
|
|
33
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
34
|
+
|
|
35
|
+
// Recommended Options
|
|
36
|
+
"strict": true,
|
|
37
|
+
"jsx": "react-jsx",
|
|
38
|
+
"verbatimModuleSyntax": true,
|
|
39
|
+
"isolatedModules": true,
|
|
40
|
+
"noUncheckedSideEffectImports": true,
|
|
41
|
+
"moduleDetection": "force",
|
|
42
|
+
"skipLibCheck": true,
|
|
43
|
+
|
|
44
|
+
// Customizations
|
|
45
|
+
"allowUnreachableCode": false,
|
|
46
|
+
"allowUnusedLabels": false,
|
|
47
|
+
"erasableSyntaxOnly": true
|
|
48
|
+
// "isolatedDeclarations": true,
|
|
49
|
+
},
|
|
50
|
+
"include": ["src/**/*"]
|
|
51
|
+
}
|