Cellular automata in GLSL+PyQT. Various rulesets can be found by checking out individual commits. http://hut.pm/cellmade_gallery.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

18 lines
580 B

import time
class FPSCounter(object):
def __init__(self, callback=None):
self._fpsLastSecond = time.time()
self._fpsFrameCount = 0
self.fps = 1
self.callback = callback
def count(self):
self._fpsFrameCount += 1
currentTime = time.time()
if currentTime - 0.1 > self._fpsLastSecond:
self.fps = self._fpsFrameCount / (currentTime - self._fpsLastSecond)
self._fpsLastSecond = currentTime
self._fpsFrameCount = 0
if self.callback:
self.callback(self.fps)