Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues related to mouse events #44

Closed
hiy opened this issue Dec 15, 2020 · 0 comments · Fixed by #45
Closed

Issues related to mouse events #44

hiy opened this issue Dec 15, 2020 · 0 comments · Fixed by #45

Comments

@hiy
Copy link
Contributor

hiy commented Dec 15, 2020

Hi. I wrote sample code for a mouse event like this.

require 'dxopal'
include DXOpal

Window.load_resources do
  Window.loop do
    case
    when Input.mouse_release?(M_MBUTTON)
      p 'Middle mouse release'
    when Input.mouse_down?(M_MBUTTON)
      p 'Middle mouse down'
    when Input.mouse_release?(M_LBUTTON)
      p 'Left mouse release'
    when Input.mouse_down?(M_LBUTTON)
      p 'Left mouse down'
    end
  end
end

After that, I checked the operation with a browser.

I clicked the left mouse button.
The following is displayed on the browser console.

Left mouse down
Left mouse release

I clicked the middle mouse button.

Middle mouse down
Middle mouse release

I clicked the left mouse button again.

Left mouse down
Middle mouse release  (unexpected result)

The problem seems to be that the return value of ev.buttons (lib/dxopal/input.rb) when mouseup is always 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant