FPSDisplay
(window)¶Display of a window’s framerate.
This is a convenience class to aid in profiling and debugging. Typical usage is to create an FPSDisplay for each window, and draw the display at the end of the windows’ on_draw event handler:
window = pyglet.window.Window()
fps_display = FPSDisplay(window)
@window.event
def on_draw():
# ... perform ordinary window drawing operations ...
fps_display.draw()
The style and position of the display can be modified via the label attribute. Different text can be substituted by overriding the set_fps method. The display can be set to update more or less often by setting the update_period attribute.
Variables: | label – The text label displaying the framerate. |
---|
Constructor:
__init__
(window)¶Methods:
Attributes:
update_period
Time in seconds between updates.
FPSDisplay.
draw
()¶Draw the label.
The OpenGL state is assumed to be at default values, except that the MODELVIEW and PROJECTION matrices are ignored. At the return of this method the matrix mode will be MODELVIEW.
FPSDisplay.
set_fps
(fps)¶Set the label text for the given FPS estimation.
Called by update every update_period seconds.
Parameters: | fps (float) – Estimated framerate of the window. |
---|
FPSDisplay.
update
()¶Records a new data point at the current time. This method is called automatically when the window buffer is flipped.