Returns a linear representation of mouse button, for use with static arrays. Guaranteed to be >= 0 && <= 15
can contain emacs-like modifier prefix case-insensitive names: lmbX/leftX rmbX/rightX mmbX/middleX wheelX motion (no prefix allowed) 'X' is either "up" or "down" (or "-up"/"-down"); if omited, means "down"
See MouseButton
was it a double click? Only set on type == MouseEventType.buttonPressed
Change in X position since last report
Change in Y position since last report
See ModifierState
movement, press, release, double click. See MouseEventType
The window in which the event happened.
Current X position of the cursor when the event fired, relative to the upper-left corner of the window, reported in pixels. (0, 0) is the upper left, (window.width - 1, window.height - 1) is the lower right corner of the window.
Current Y position of the cursor when the event fired.
This will draw boxes on the window with the mouse as you hold the left button.
import arsd.simpledisplay; void main() { auto window = new SimpleWindow(); window.eventLoop(0, (MouseEvent ev) { if(ev.modifierState & ModifierState.leftButtonDown) { auto painter = window.draw(); painter.fillColor = Color.red; painter.outlineColor = Color.black; painter.drawRectangle(Point(ev.x / 16 * 16, ev.y / 16 * 16), 16, 16); } } ); }
Listen for this on your event listeners if you are interested in mouse action.
Note that button is used on mouse press and release events. If you are curious about which button is being held in during motion, use modifierState and check the bitmask for ModifierState.leftButtonDown, etc.