Libraryless. Click here for Pure Java version (9238L/51K).
1 | sclass DoubleFPSCounter { |
2 | new FPSCounter counter; |
3 | volatile double value; |
4 | |
5 | synchronized void inc() { |
6 | if (counter.secondsSinceStart() >= 1) { |
7 | value = counter!; |
8 | counter = new FPSCounter; |
9 | } |
10 | counter.inc(); |
11 | } |
12 | |
13 | synchronized double get() { |
14 | ret value; |
15 | } |
16 | |
17 | synchronized toString { |
18 | ret counter.isEmpty() ? "" : formatDoubleX(get(), 1) + " FPS"; |
19 | } |
20 | } |
Began life as a copy of #1033433
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033686 |
Snippet name: | DoubleFPSCounter - always shows counter for previous whole second |
Eternal ID of this version: | #1033686/9 |
Text MD5: | d48f778abd7c0882ab0483bd967030e7 |
Transpilation MD5: | 1125c720e49141e061b6e4e505a906c9 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-07-19 21:09:59 |
Source code size: | 406 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 172 / 309 |
Version history: | 8 change(s) |
Referenced in: | [show references] |