Fix NaN display for FPS
This commit is contained in:
parent
f1c41864ed
commit
d43c73f780
|
@ -336,7 +336,7 @@ class HUD(object):
|
||||||
|
|
||||||
def on_world_tick(self, timestamp):
|
def on_world_tick(self, timestamp):
|
||||||
self._server_clock.tick()
|
self._server_clock.tick()
|
||||||
self.server_fps = np.nan_to_num(self._server_clock.get_fps())
|
self.server_fps = self._server_clock.get_fps()
|
||||||
self.frame_number = timestamp.frame_count
|
self.frame_number = timestamp.frame_count
|
||||||
self.simulation_time = timestamp.elapsed_seconds
|
self.simulation_time = timestamp.elapsed_seconds
|
||||||
|
|
||||||
|
@ -356,8 +356,8 @@ class HUD(object):
|
||||||
collision = [x / max_col for x in collision]
|
collision = [x / max_col for x in collision]
|
||||||
vehicles = world.world.get_actors().filter('vehicle.*')
|
vehicles = world.world.get_actors().filter('vehicle.*')
|
||||||
self._info_text = [
|
self._info_text = [
|
||||||
'Server: % 16d FPS' % self.server_fps,
|
'Server: % 16s FPS' % round(self.server_fps),
|
||||||
'Client: % 16d FPS' % clock.get_fps(),
|
'Client: % 16s FPS' % round(clock.get_fps()),
|
||||||
'',
|
'',
|
||||||
'Vehicle: % 20s' % get_actor_display_name(world.player, truncate=20),
|
'Vehicle: % 20s' % get_actor_display_name(world.player, truncate=20),
|
||||||
'Map: % 20s' % world.world.map_name,
|
'Map: % 20s' % world.world.map_name,
|
||||||
|
|
|
@ -52,11 +52,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise RuntimeError('cannot import pygame, make sure pygame package is installed')
|
raise RuntimeError('cannot import pygame, make sure pygame package is installed')
|
||||||
|
|
||||||
try:
|
|
||||||
import numpy as np
|
|
||||||
except ImportError:
|
|
||||||
raise RuntimeError('cannot import numpy, make sure numpy package is installed')
|
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# -- Constants -----------------------------------------------------------------
|
# -- Constants -----------------------------------------------------------------
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
@ -824,10 +819,10 @@ class ModuleWorld(object):
|
||||||
else:
|
else:
|
||||||
hero_mode_text = ['Hero Mode: OFF']
|
hero_mode_text = ['Hero Mode: OFF']
|
||||||
|
|
||||||
self.server_fps = np.nan_to_num(self.server_clock.get_fps())
|
self.server_fps = self.server_clock.get_fps()
|
||||||
module_info_text = [
|
module_info_text = [
|
||||||
'Server: % 16d FPS' % self.server_fps,
|
'Server: % 16s FPS' % round(self.server_fps),
|
||||||
'Client: % 16d FPS' % clock.get_fps(),
|
'Client: % 16s FPS' % round(clock.get_fps()),
|
||||||
'Map Name: %10s' % self.world.map_name,
|
'Map Name: %10s' % self.world.map_name,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue