yhara / dxopal

Game development framework for Opal, API compatible to DXRuby

Home Page:https://yhara.github.io/dxopal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues related to mouse events

hiy opened this issue · comments

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.