extra-game-loop 0.3.1 → 0.3.3

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/README.md CHANGED
@@ -19,7 +19,7 @@ const gameLoop = new GameLoop({
19
19
  , fixedUpdate(deltaTime: number): void {
20
20
  // ...
21
21
  }
22
- , lateUpdate(dletaTime: number): void {
22
+ , lateUpdate(deltaTime: number, alpha: number): void {
23
23
  // ...
24
24
  }
25
25
  , render(alpha: number): void {
@@ -39,13 +39,17 @@ class GameLoop<FixedDeltaTime extends number = number> {
39
39
  maximumDeltaTime: number /* ms */
40
40
  update: (deltaTime: number /* ms */) => void
41
41
  fixedUpdate: (deltaTime: FixedDeltaTime /* ms */) => void
42
- lateUpdate: (deltaTime: number /* ms */) => void
42
+ lateUpdate: (deltaTime: number /* ms */, alpha: number) => void
43
43
  render: (alpha: number /* [0, 1) */) => void
44
44
  })
45
45
 
46
46
  start(): void
47
47
  stop(): void
48
-
49
48
  getFramesOfSecond(): number
49
+
50
+ /**
51
+ * This method allows you to manually advance to the next frame.
52
+ */
53
+ nextFrame(deltaTime: number): void
50
54
  }
51
55
  ```
@@ -3,7 +3,7 @@ interface IGameLoopOptions<FixedDeltaTime extends number = number> {
3
3
  maximumDeltaTime: number;
4
4
  update: (deltaTime: number) => void;
5
5
  fixedUpdate: (deltaTime: FixedDeltaTime) => void;
6
- lateUpdate: (deltaTime: number) => void;
6
+ lateUpdate: (deltaTime: number, alpha: number) => void;
7
7
  render: (alpha: number) => void;
8
8
  }
9
9
  export declare class GameLoop<FixedDeltaTime extends number> {
@@ -23,6 +23,6 @@ export declare class GameLoop<FixedDeltaTime extends number> {
23
23
  stop(): void;
24
24
  getFramesOfSecond(): number;
25
25
  private loop;
26
- private nextFrame;
26
+ nextFrame(deltaTime: number): void;
27
27
  }
28
28
  export {};
@@ -62,8 +62,8 @@ class GameLoop {
62
62
  this.fixedUpdate(this.fixedDeltaTime);
63
63
  this.deltaTimeAccumulator -= this.fixedDeltaTime;
64
64
  }
65
- this.lateUpdate(deltaTime);
66
65
  const alpha = this.deltaTimeAccumulator / this.fixedDeltaTime;
66
+ this.lateUpdate(deltaTime, alpha);
67
67
  this.render(alpha);
68
68
  }
69
69
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game-loop.js","sourceRoot":"","sources":["../src/game-loop.ts"],"names":[],"mappings":";;;AAAA,yCAAyE;AACzE,iDAA4C;AAwC5C,IAAK,KAGJ;AAHD,WAAK,KAAK;IACR,4BAAmB,CAAA;IACnB,4BAAmB,CAAA;AACrB,CAAC,EAHI,KAAK,KAAL,KAAK,QAGT;AAMD,MAAM,MAAM,GAA4C;IACtD,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE;IACzC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE;CACzC,CAAA;AAED,MAAa,QAAQ;IAanB,YAAY,OAAyC;QAZpC,QAAG,GAAG,IAAI,8BAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;QAS5D,yBAAoB,GAAG,CAAC,CAAA;QACxB,kBAAa,GAAG,CAAC,CAAA;QA2CjB,SAAI,GAAG,GAAS,EAAE;YAIxB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;YACnC,MAAM,SAAS,GAAG,SAAS,GAAG,IAAI,CAAC,aAAc,CAAA;YACjD,IAAI,CAAC,aAAa,GAAG,SAAS,CAAA;YAC9B,IAAI,CAAC,aAAa,GAAG,SAAS,CAAA;YAE9B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;YAEzB,IAAI,CAAC,QAAQ,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClD,CAAC,CAAA;QApDC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;QAC5C,IAAI,CA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C,MAAM,CAAC,SAAS,CAAC,CAAA;QAEtB,OAAO,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,cAAc,EAAE;YACvD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YACrC,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,cAAc,CAAA;SACjD;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAA;QAC7D,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;CACF;AA5FD,4BA4FC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B"}
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "extra-game-loop",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "files": [
7
- "lib",
8
- "dist"
7
+ "lib"
9
8
  ],
10
- "main": "lib/es2018/index.js",
11
- "types": "lib/es2018/index.d.ts",
9
+ "main": "lib/index.js",
10
+ "types": "lib/index.d.ts",
12
11
  "sideEffects": false,
13
12
  "repository": "git@github.com:BlackGlory/extra-game-loop.git",
14
13
  "author": "BlackGlory <woshenmedoubuzhidao@blackglory.me>",
@@ -18,18 +17,11 @@
18
17
  "test": "jest --runInBand --config jest.config.js",
19
18
  "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
20
19
  "test:coverage": "jest --coverage --config jest.config.js",
21
- "prepublishOnly": "run-s clean build bundle",
22
- "clean": "run-p clean:*",
23
- "clean:build": "rimraf lib",
24
- "clean:bundle": "rimraf dist",
25
- "build": "run-p build:*",
26
- "build:es2015": "run-s build:es2015:*",
27
- "build:es2015:compile": "tsc --project tsconfig.build.json --module commonjs --target es2015 --outDir lib/es2015",
28
- "build:es2015:patch": "tscpaths -p tsconfig.build.json -s ./src -o ./lib/es2015",
29
- "build:es2018": "run-s build:es2018:*",
30
- "build:es2018:compile": "tsc --project tsconfig.build.json --module commonjs --target es2018 --outDir lib/es2018",
31
- "build:es2018:patch": "tscpaths -p tsconfig.build.json -s ./src -o ./lib/es2018",
32
- "bundle": "rollup --config rollup.config.js",
20
+ "prepublishOnly": "run-s clean build",
21
+ "clean": "rimraf lib",
22
+ "build": "run-s build:*",
23
+ "build:compile": "tsc --project tsconfig.build.json --module commonjs --target es2018 --outDir lib",
24
+ "build:patch": "tscpaths -p tsconfig.build.json -s ./src -o ./lib",
33
25
  "release": "standard-version"
34
26
  },
35
27
  "husky": {
@@ -39,14 +31,8 @@
39
31
  }
40
32
  },
41
33
  "devDependencies": {
42
- "@blackglory/jest-matchers": "^0.3.1",
43
34
  "@commitlint/cli": "^17.1.2",
44
35
  "@commitlint/config-conventional": "^17.1.0",
45
- "@rollup/plugin-commonjs": "^22.0.2",
46
- "@rollup/plugin-json": "^4.1.0",
47
- "@rollup/plugin-node-resolve": "^14.1.0",
48
- "@rollup/plugin-replace": "^4.0.0",
49
- "@rollup/plugin-typescript": "^8.5.0",
50
36
  "@types/jest": "^27.4.1",
51
37
  "@typescript-eslint/eslint-plugin": "^5.37.0",
52
38
  "@typescript-eslint/parser": "^5.37.0",
@@ -57,9 +43,6 @@
57
43
  "jest": "^27.5.1",
58
44
  "npm-run-all": "^4.1.5",
59
45
  "rimraf": "^3.0.2",
60
- "rollup": "^2.79.0",
61
- "rollup-plugin-analyzer": "^4.0.0",
62
- "rollup-plugin-terser": "^7.0.2",
63
46
  "standard-version": "^9.5.0",
64
47
  "ts-jest": "^27.1.4",
65
48
  "tscpaths": "^0.0.9",