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)
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
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)
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)
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 = []
def velocity(self): return cast_anything_to_vector(self.body.velocity)
def position(self): return cast_anything_to_vector(self.body.position)