L3-Bataille-Navale/source/gui/widget/FPSDisplay.py
2023-02-15 09:38:31 +01:00

22 lines
487 B
Python

from source.gui.widget.abc import Widget
from typing import TYPE_CHECKING
import pyglet
if TYPE_CHECKING:
from source.gui.scene.abc import Scene
class FPSDisplay(Widget):
"""
A widget that display the current FPS of the scene's window
"""
def __init__(self, scene: "Scene", *args, **kwargs):
super().__init__(scene)
self.fps_display = pyglet.window.FPSDisplay(scene.window, *args, **kwargs)
def draw(self):
self.fps_display.draw()