1 """ Actor that takes a surface. """
3 from pgzero.actor import Actor, POS_TOPLEFT, ANCHOR_CENTER
6 class SurfActor(Actor):
7 def __init__(self, surf, pos=POS_TOPLEFT, anchor=ANCHOR_CENTER, **kwargs):
8 self._handle_unexpected_kwargs(kwargs)
11 # Initialise it at (0,0). We'll move it to the right place later
12 super(Actor, self).__init__((0, 0), self._surf.get_size())
14 self._init_position(pos, anchor, **kwargs)
16 def _update_pos(self):
18 self.width, self.height = self._surf.get_size()
24 """ The original surface displaying the actor. """
25 return self._orig_surf
29 self._orig_surf = self._surf = surf