Beispiel #1
0
    def __init__(self, window, cursor, hotspot, *, batch=None, group=None):
        mouse_group = pyglet.graphics.OrderedGroup(1, parent=group)
        gui_group = pyglet.graphics.OrderedGroup(0, parent=group)

        super().__init__(window, batch=batch, group=gui_group)
        window.set_exclusive_mouse(True)

        # Where the mouse is.  Because mouse exclusivity is enabled, we have to
        # keep track of this ourselves.
        self.mouse = self.territory.center

        # Where the mouse would be, if it wasn't confined to the window.  The
        # difference between `self.mouse` and `self.shadow_mouse` gives the
        # direction of each ``on_mouse_pan`` event that gets fired.
        self.shadow_mouse = None

        # Because mouse exclusivity is enabled, we have to provide an image for
        # the cursor.
        hotspot = vecrec.cast_anything_to_vector(hotspot)
        cursor.anchor_x = hotspot.x
        cursor.anchor_y = hotspot.y

        self.cursor = pyglet.sprite.Sprite(cursor,
                                           batch=self.batch,
                                           group=mouse_group)
Beispiel #2
0
 def __init__(self, player, type, xyw):
     super().__init__()
     self._player = player
     self._type = type
     self._xyw = cast_anything_to_vector(xyw)
     self._current_move = None
     self._current_pattern = None
Beispiel #3
0
    def __init__(self, window, cursor, hotspot, batch=None, group=None):
        mouse_group = pyglet.graphics.OrderedGroup(1, parent=group)
        gui_group = pyglet.graphics.OrderedGroup(0, parent=group)

        super().__init__(window, batch, gui_group)
        window.set_exclusive_mouse(True)

        hotspot = vecrec.cast_anything_to_vector(hotspot)
        cursor.anchor_x = hotspot.x
        cursor.anchor_y = hotspot.y

        self.mouse = self.rect.center
        self.shadow_mouse = None
        self.cursor = pyglet.sprite.Sprite(
                cursor, batch=batch, group=mouse_group)
Beispiel #4
0
    def __init__(self, window, cursor, hotspot, *, batch=None, group=None):
        mouse_group = pyglet.graphics.OrderedGroup(1, parent=group)
        gui_group = pyglet.graphics.OrderedGroup(0, parent=group)

        super().__init__(window, batch=batch, group=gui_group)
        window.set_exclusive_mouse(True)

        # Where the mouse is.  Because mouse exclusivity is enabled, we have to 
        # keep track of this ourselves.
        self.mouse = self.territory.center

        # Where the mouse would be, if it wasn't confined to the window.  The 
        # difference between `self.mouse` and `self.shadow_mouse` gives the 
        # direction of each ``on_mouse_pan`` event that gets fired.
        self.shadow_mouse = None

        # Because mouse exclusivity is enabled, we have to provide an image for 
        # the cursor.
        hotspot = vecrec.cast_anything_to_vector(hotspot)
        cursor.anchor_x = hotspot.x
        cursor.anchor_y = hotspot.y

        self.cursor = pyglet.sprite.Sprite(
                cursor, batch=self.batch, group=mouse_group)
Beispiel #5
0
 def __init__(self, origin, heading, color):
     super().__init__()
     self._origin = cast_anything_to_vector(origin)
     self._heading = cast_anything_to_vector(heading)
     self._color = color
     self._pieces = []
Beispiel #6
0
 def velocity(self):
     return cast_anything_to_vector(self.body.velocity)
Beispiel #7
0
 def position(self):
     return cast_anything_to_vector(self.body.position)