root/trunk/orca/gl/demo/fps.r
| Revision 1, 433 bytes (checked in by krobillard, 3 years ago) |
|---|
| Line | |
|---|---|
| 1 | ORCA [ |
| 2 | Purpose: {Provides average frames per second counter} |
| 3 | ] |
| 4 | |
| 5 | fps: context [ |
| 6 | times: make list! 30 |
| 7 | |
| 8 | init: does [ |
| 9 | loop 30 [insert times now/time] |
| 10 | times: head times |
| 11 | ] |
| 12 | |
| 13 | ; Currently this provides the time elapsed for the last 30 frames. |
| 14 | update: func [/local t] [ |
| 15 | t: now/time |
| 16 | times: remove times |
| 17 | insert tail times t |
| 18 | t: t - first times |
| 19 | ;t / 30 |
| 20 | ] |
| 21 | ] |
| 22 | |
| 23 | ;eof |
Note: See TracBrowser
for help on using the browser.
