Skip to content

Can't drag the sprite when the window is resized #18

Description

@happyleibniz

encountering a problem i can't drag the sprite when the window is resized
some code snippet:

    def on_mouse_motion(self, x, y, dx, dy):
        self.computer_is_hovered = (
                int(self.computer_sprite.x) < x < int(self.computer_sprite.x) + self.computer_sprite.width
                and self.computer_sprite.y < y < self.computer_sprite.y + self.computer_sprite.height
        )
        self.installer_is_hovered = (
                int(self.installer_sprite.x) < x < int(self.installer_sprite.x) + self.installer_sprite.width
                and self.installer_sprite.y < y < self.installer_sprite.y + self.installer_sprite.height
        )

    def on_mouse_press(self, x, y, button, modifiers):
        self.login_button.on_mouse_press(x, y, button, modifiers)
        if self.computer_is_hovered and button == pyglet.window.mouse.LEFT:
            if hasattr(self, 'last_mouse_release'):
                if (x, y, button) == self.last_mouse_release[:-1]:
                    if time.time() - self.last_mouse_release[-1] < 0.2:
                        print("computer.double_click")
    def on_resize(self, width, height):
        gl.glViewport(0, 0, width, height)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions