diff options
| author | Tad Thorley <[email protected]> | 2019-09-11 22:11:32 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-09-11 22:11:32 -0600 |
| commit | d36e3241e939d0f7e67f48b56d6e650d91942ec2 (patch) | |
| tree | f0554797f504954a9e986cdfca5c5dd5e32d7c94 /deploy_template/mygame/documentation/07-mouse.md | |
| parent | 6d2b989b99ccec43f895d3fca038a2184e8bf7d5 (diff) | |
| download | dragonruby-game-toolkit-contrib-d36e3241e939d0f7e67f48b56d6e650d91942ec2.tar.gz dragonruby-game-toolkit-contrib-d36e3241e939d0f7e67f48b56d6e650d91942ec2.zip | |
Update 07-mouse.md
add documentation for the new mouse support and make the examples a little more consistent
Diffstat (limited to 'deploy_template/mygame/documentation/07-mouse.md')
| -rw-r--r-- | deploy_template/mygame/documentation/07-mouse.md | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/deploy_template/mygame/documentation/07-mouse.md b/deploy_template/mygame/documentation/07-mouse.md index cbace44..2af8854 100644 --- a/deploy_template/mygame/documentation/07-mouse.md +++ b/deploy_template/mygame/documentation/07-mouse.md @@ -12,9 +12,9 @@ Determining if the mouse has been clicked, and it's position. Note: ``` if args.inputs.mouse.click - puts args.inputs.mouse.click - puts args.inputs.mouse.click.point.x - puts args.inputs.mouse.click.point.y + puts "click: #{args.inputs.mouse.click}" + puts "x: #{args.inputs.mouse.click.point.x}" + puts "y: #{args.inputs.mouse.click.point.y}" end ``` @@ -22,8 +22,27 @@ Determining if the mouse button has been released: ``` if args.inputs.mouse.up - puts args.inputs.mouse.up - puts args.inputs.mouse.up.point.x - puts args.inputs.mouse.up.point.y + puts "up: #{args.inputs.mouse.up}" + puts "x: #{args.inputs.mouse.up.point.x}" + puts "y: #{args.inputs.mouse.up.point.y}" +end +``` + +Determine which mouse button(s) have been clicked (also works for up): +``` +if args.inputs.mouse.click + puts "left: #{args.inputs.mouse.button_left}" + puts "middle: #{args.inputs.mouse.button_middle}" + puts "right: #{args.inputs.mouse.button_right}" + puts "x1: #{args.inputs.mouse.button_x1}" + puts "x2: #{args.inputs.mouse.button_x2}" +end +``` + +Determine if the mouse wheel is being used and its values for this tick: +``` +if args.inputs.mouse.wheel + puts "The wheel moved #{args.inputs.mouse.wheel.x} left/right" + puts "The wheel moved #{args.inputs.mouse.wheel.y} up/down" end ``` |
