CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
ProdigyPNP

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: ProdigyPNP/ProdigyMathGameHacking
Path: blob/master/cheatGUI/src/utils/fps.ts
Views: 723
1
import { wrapper } from "../index";
2
3
const FPSc = document.createElement("button"); // Create menu toggler
4
var enabled : boolean = false;
5
6
7
export function startFps () : void {
8
enabled = true;
9
activate();
10
}
11
12
export function stopFps () : void {
13
enabled = false;
14
document.getElementById("fps-counter")?.remove();
15
}
16
17
18
function activate () : void {
19
20
FPSc.id = "fps-counter";
21
wrapper?.prepend(FPSc);
22
23
24
setInterval(() => {
25
26
const fps : number = _.player.game.fps._framerate;
27
28
if (enabled) {
29
FPSc.innerText = fps.toFixed(2) + " FPS";
30
} else {
31
FPSc.remove();
32
return;
33
}
34
}, 300);
35
}
36