mouse-input.md 835 B

Mouse input

You can find this sample in the tutorial project: MenuMouse input

Explanation

This C# Beginner tutorial covers how to handle mouse input.

We can check for the existence of a mouse and then we can use various methods to check if a mouse buttons are clicked, held down or released.

We can also check for the mouse wheel (middle mouse) being clicked. We can use the mouse wheel delta to determine if the mouse wheel has been scrolled in a frame.

And finally we learn how to use the absolute mouse position to draw text at the position of the mouse on the screen.

Mouse input

[!Video https://www.youtube.com/embed/HuA80JIZ8hA]

Code

[!code-csharpEntity]