Пример #1
0
 def __init__(self):
     super().__init__()
     self.player = None
     self.animations = []
     self.focus_point = Vector.null()
     self.show_fps = False
     self.fps_widget = pyglet.clock.ClockDisplay()
Пример #2
0
    def pixels_to_percent(self, pixels):
        percent = Vector.null()
        ux, uy = self.unoccupied_size
        
        if ux != 0: percent.x = pixels.x / ux
        if uy != 0: percent.y = pixels.y / uy

        return percent
Пример #3
0
    def get_position_percent(self):
        percent = Vector.null()
        ux, uy = self.unoccupied_size
        
        if ux != 0: percent.x = self.position.x / ux
        if uy != 0: percent.y = self.position.y / uy

        return percent
Пример #4
0
    def pixels_to_percent(self, pixels):
        percent = Vector.null()
        ux, uy = self.unoccupied_size

        if ux != 0: percent.x = pixels.x / ux
        if uy != 0: percent.y = pixels.y / uy

        return percent
Пример #5
0
    def get_position_percent(self):
        percent = Vector.null()
        ux, uy = self.unoccupied_size

        if ux != 0: percent.x = self.position.x / ux
        if uy != 0: percent.y = self.position.y / uy

        return percent
Пример #6
0
    def __init__(self):
        super().__init__()

        # ``child_position`` is the vector between the bottom left corner of 
        # the child's physical position (i.e. it position in it's own 
        # coordinates) and it's apparent position (i.e. the position it seems 
        # to be in after the translation is performed).
        self._child_position = Vector.null()
        self._translate_group = None
        self._expand_horz = True
        self._expand_vert = True
Пример #7
0
    def __init__(self):
        super().__init__()

        # ``child_position`` is the vector between the bottom left corner of
        # the child's physical position (i.e. it position in it's own
        # coordinates) and it's apparent position (i.e. the position it seems
        # to be in after the translation is performed).
        self._child_position = Vector.null()
        self._translate_group = None
        self._expand_horz = True
        self._expand_vert = True
Пример #8
0
    def __init__(self, sensitivity=3):
        Widget.__init__(self)
        BinMixin.__init__(self)

        # The panning_vector is the displacement between the bottom-left corner 
        # of this widget and the bottom-left corner of the child widget.

        self._panning_vector = Vector.null()
        self._deferred_center_of_view = None
        self.sensitivity = sensitivity

        # The stencil_group, mask_group, and visible_group members manage the 
        # clipping mask to make sure the child is only visible inside the 
        # viewport.  The panning_group member is used to translate the child in 
        # response to panning events.

        self.stencil_group = None
        self.mask_group = None
        self.visible_group = None
        self.panning_group = None
        self.mask_artist = None
Пример #9
0
 def on_detach_child(self, parent, child):
     self._child_position = Vector.null()
Пример #10
0
 def on_detach_child(self, parent, child):
     self._child_position = Vector.null()