mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2026-01-06 19:22:38 +01:00
Show FPS counter on F2
This commit is contained in:
parent
0dcb183812
commit
337446fba7
@ -177,7 +177,6 @@ object UiHandler extends Logging {
|
||||
|
||||
Display.update()
|
||||
fpsCalculator.tick()
|
||||
windowTitle = s"Ocelot Desktop [FPS: ${fpsCalculator.fps}]"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,12 +30,14 @@ class RootWidget extends Widget {
|
||||
|
||||
children :+= statusBar
|
||||
|
||||
|
||||
private var isDebugViewVisible = false
|
||||
private var isFPSVisible = false
|
||||
|
||||
eventHandlers += {
|
||||
case KeyEvent(KeyEvent.State.Release, Keyboard.KEY_F1, _) =>
|
||||
isDebugViewVisible = !isDebugViewVisible
|
||||
case KeyEvent(KeyEvent.State.Release, Keyboard.KEY_F2, _) =>
|
||||
isFPSVisible = !isFPSVisible
|
||||
}
|
||||
|
||||
override def draw(g: Graphics): Unit = {
|
||||
@ -54,4 +56,13 @@ class RootWidget extends Widget {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override def update(): Unit = {
|
||||
super.update()
|
||||
|
||||
if (isFPSVisible)
|
||||
UiHandler.windowTitle = s"Ocelot Desktop [FPS: ${UiHandler.fps}]"
|
||||
else
|
||||
UiHandler.windowTitle = "Ocelot Desktop"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user