コード例 #1
0
ファイル: gui.py プロジェクト: lxnt/fgtestbed
class RendererPanel(HudTextPanel):
    def __init__(self):
        strs = (
            "gfps: {gfps:3.1f} afps: {anim_fps:02d} frame# {frame_no:03d} zeddown={zeddown:02d}",
            "origin: {origin.x}:{origin.y}:{origin.z} grid: {grid.w}x{grid.h} map: {map.x}x{map.y}x{map.z}",
            "pszar: {pszar.x:.2f} {pszar.y:.2f} {pszar.z};  {psz.x}x{psz.y} px",
            "map_viewport: {viewport.x:02d} {viewport.y:02d} {viewport.w:d} {viewport.h:d}",
            "fbo_size={fbosize.w:d}:{fbosize.h:d} win_size={winsize.w:d}:{winsize.h:d}",
            "{showhidden}", 
        )
        self.active = True
        dummy = Coord3(999,999,999)
        longest_str = strs[1].format(origin=dummy, grid=Size2(999,999), map=dummy)
        self.rtime = EmaFilter(alpha=0.05, nseed=5)

        super(RendererPanel, self).__init__(strs, longest_str)
    
    def update(self, win, map_viewport, show_hidden, **kwargs):
        self._data = kwargs
        rtime = self.rtime.value(kwargs['loop_time'])
        self._data['gfps'] = 1000/rtime if rtime else 0
        self._data['viewport'] = map_viewport
        self._data['showhidden'] = '[show_hidden]' if show_hidden else '             '
        self._surface_dirty = True

        # glue it to the top-right corner, observing margins.
        self.moveto(Coord2(win.w - self.margin - self.rect.w, win.h - self.margin - self.rect.h))

    @property
    def data(self):
        return self._data
コード例 #2
0
ファイル: gui.py プロジェクト: lxnt/fgtestbed
    def __init__(self):
        strs = (
            "gfps: {gfps:3.1f} afps: {anim_fps:02d} frame# {frame_no:03d} zeddown={zeddown:02d}",
            "origin: {origin.x}:{origin.y}:{origin.z} grid: {grid.w}x{grid.h} map: {map.x}x{map.y}x{map.z}",
            "pszar: {pszar.x:.2f} {pszar.y:.2f} {pszar.z};  {psz.x}x{psz.y} px",
            "map_viewport: {viewport.x:02d} {viewport.y:02d} {viewport.w:d} {viewport.h:d}",
            "fbo_size={fbosize.w:d}:{fbosize.h:d} win_size={winsize.w:d}:{winsize.h:d}",
            "{showhidden}", 
        )
        self.active = True
        dummy = Coord3(999,999,999)
        longest_str = strs[1].format(origin=dummy, grid=Size2(999,999), map=dummy)
        self.rtime = EmaFilter(alpha=0.05, nseed=5)

        super(RendererPanel, self).__init__(strs, longest_str)