@antha/fps 0.1.0 → 0.1.2
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 +37 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,9 +1,43 @@
|
|
|
1
|
-
# @antha/
|
|
1
|
+
# @antha/fps
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides a pre-built [Antha game engine](https://www.npmjs.com/package/@antha/engine) mod that displays the engine's current frames per second in the top-left corner of the page.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm i @antha/
|
|
8
|
+
npm i @antha/fps
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
<!-- example-link: src/readme-examples/measuring-fps.example.ts -->
|
|
14
|
+
|
|
15
|
+
```TypeScript
|
|
16
|
+
import {AnthaEngine, defineAnthaMod} from '@antha/engine';
|
|
17
|
+
import {createAnthaFpsMod, type ShowCountersState} from '@antha/fps';
|
|
18
|
+
|
|
19
|
+
type GameState = ShowCountersState & {
|
|
20
|
+
hasFpsStutter: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const engine = new AnthaEngine<GameState>({
|
|
24
|
+
initState: {
|
|
25
|
+
hasFpsStutter: false,
|
|
26
|
+
},
|
|
27
|
+
mods: [
|
|
28
|
+
createAnthaFpsMod({
|
|
29
|
+
debugFps: true,
|
|
30
|
+
}),
|
|
31
|
+
defineAnthaMod<GameState>({
|
|
32
|
+
modName: 'game-logic',
|
|
33
|
+
execute({state}) {
|
|
34
|
+
state.hasFpsStutter = !!state.fpsStutters?.length;
|
|
35
|
+
|
|
36
|
+
return state.hasFpsStutter ? 'Frame rate is low.' : undefined;
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
engine.startLoop();
|
|
9
43
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antha/fps",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "An Antha mod for rendering FPS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vir",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@augment-vir/assert": "^32.2.2",
|
|
37
37
|
"@augment-vir/common": "^32.2.2",
|
|
38
38
|
"@electrovir/color": "^1.7.11",
|
|
39
|
-
"vira": "^31.
|
|
39
|
+
"vira": "^31.31.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@augment-vir/test": "^32.2.2",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"istanbul-smart-text-reporter": "^1.1.5"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@antha/engine": "^0.1.
|
|
50
|
+
"@antha/engine": "^0.1.2",
|
|
51
51
|
"element-vir": ">=26"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|