X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/29dfa14e4419fb6ceb9350223f410e967e8cc4f6..73cb300f687b50db29e9054fc3a5ed5784cf0069:/src/kinect/pygamedisplay.py diff --git a/src/kinect/pygamedisplay.py b/src/kinect/pygamedisplay.py index 82621ea..fbf0b77 100755 --- a/src/kinect/pygamedisplay.py +++ b/src/kinect/pygamedisplay.py @@ -38,6 +38,24 @@ class RGB : return self.context.wait_one_update_all(self.imgGene) +class RGBSprite(pygame.sprite.DirtySprite, RGB) : + + def __init__(self, alpha=255) : + pygame.sprite.DirtySprite.__init__(self) + self.dirty = 2 # toujours dirty ! + RGB.__init__(self) + + self.image = pygame.Surface((640, 480)) + self._regular = pygame.Surface((640, 480)) + self.image.set_alpha(alpha) + self.rect = pygame.Rect((0, 0), (0, 0)) + + def update(self) : + RGB.update(self) + img = self.capture() + self._regular.blit(img, (0, 0)) + self.image.blit(pygame.transform.flip(self._regular, True, False), (0, 0)) + def main() : pygame.init()