struct CrystGLFW::MouseButton
- CrystGLFW::MouseButton
- Struct
- Value
- Object
Overview
A MouseButton represents a button on a mouse.
Defined in:
crystglfw/mouse_button.crInstance Method Summary
- #code : Int32
-
#is?(*labels : Symbol) : Bool
Returns true if the mouse button's label matches the given label.
Instance Method Detail
def is?(*labels : Symbol) : Bool
#
Returns true if the mouse button's label matches the given label. False otherwise.
window.on_mouse_button do |event|
mouse_button = event.mouse_button
if mouse_button.is? :mouse_button_left
puts "the left mouse button was clicked."
end
end
Also accepts multiple labels and returns true if the mouse button's label matches any of them.
window.on_mouse_button do |event|
mouse_button = event.mouse_button
if mouse_button.is? :mouse_buton_left, :mouse_button_middle, :mouse_button_right
puts "The mouse button is standard."
else
puts "This must be one of those crazy mice with 100 buttons."
end
end
This method accepts the following arguments:
- *labels, any number of labels against which the mouse button will be checked.