Update changes the dipslayed text and prints to the terminal every second to report the FPS
(dt float32)
| 75 | // Update changes the dipslayed text and prints to the terminal every second |
| 76 | // to report the FPS |
| 77 | func (f *FPSSystem) Update(dt float32) { |
| 78 | f.elapsed += dt |
| 79 | text := f.DisplayString() |
| 80 | if f.elapsed >= 1 { |
| 81 | if f.Display { |
| 82 | f.entity.Drawable = Text{ |
| 83 | Font: f.Font, |
| 84 | Text: text, |
| 85 | } |
| 86 | } |
| 87 | if f.Terminal { |
| 88 | log.Println(text) |
| 89 | } |
| 90 | f.elapsed-- |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | // DisplayString returns the display string in the format FPS: 60 |
| 95 | func (f *FPSSystem) DisplayString() string { |
nothing calls this directly
no test coverage detected