diff --git a/src/Swarm/TUI/Controller.hs b/src/Swarm/TUI/Controller.hs index 8dfec1082..0b4f05844 100644 --- a/src/Swarm/TUI/Controller.hs +++ b/src/Swarm/TUI/Controller.hs @@ -13,6 +13,7 @@ module Swarm.TUI.Controller ( -- ** Handling 'Frame' events runFrameUI, runFrame, + ticksPerFrameCap, runFrameTicks, runGameTickUI, runGameTick, diff --git a/src/Swarm/TUI/View.hs b/src/Swarm/TUI/View.hs index 88a695385..9afb74741 100644 --- a/src/Swarm/TUI/View.hs +++ b/src/Swarm/TUI/View.hs @@ -94,6 +94,7 @@ import Swarm.Language.Syntax import Swarm.Language.Typecheck (inferConst) import Swarm.TUI.Attr import Swarm.TUI.Border +import Swarm.TUI.Controller (ticksPerFrameCap) import Swarm.TUI.Editor.Model import Swarm.TUI.Editor.View qualified as EV import Swarm.TUI.Inventory.Sorting (renderSortMethod) @@ -534,7 +535,9 @@ drawTPS s = hBox (tpsInfo : rateInfo) rateInfo | s ^. uiState . uiShowFPS = [ txt " (" - , str (printf "%0.1f" (s ^. uiState . uiTPF)) + , let tpf = s ^. uiState . uiTPF + in (if tpf >= fromIntegral ticksPerFrameCap then withAttr redAttr else id) + (str (printf "%0.1f" tpf)) , txt " tpf, " , str (printf "%0.1f" (s ^. uiState . uiFPS)) , txt " fps)"