Skip to content

Conversation

RobLoach
Copy link
Contributor

@RobLoach RobLoach commented Feb 12, 2020

This adds scrollx and scrolly support to mouse() for the mouse wheel information (horizontal/vertical).

Fixes #988

The following example is taken from @StinkerB06 cart for testing....

mouse.tic.zip

-- title:  Input reader
-- author: StinkerB06
-- input: mouse
function TIC()
	local x,y,left,right,middle,scrollx,scrolly=mouse()

	print("X: "..tostring(x), 1, 40, 4, 0, 2)
	print("left: "..tostring(left), 1, 60, 4, 0, 2)
	print("ScrollX: "..tostring(scrollx), 1, 80, 4, 0, 2)
	print("ScrollY: "..tostring(scrolly), 1, 100, 4, 0, 2)
end

Once merged, I can update the wiki documentation.

@The-Beesh-Spweesh
Copy link

  1. Remember that the scroll values must be treated as two's complement numbers (-32 to +31).
  2. I think you should update the wiki's mouse() documentation when 0.80 comes out.

Copy link
Owner

@nesbox nesbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your help!

@nesbox nesbox merged commit 5a49949 into nesbox:master Feb 15, 2020
@RobLoach
Copy link
Contributor Author

Remember that the scroll values must be treated as two's complement numbers (-32 to +31).

From my investigation, it was an integer from -1 to 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add horizontal/vertical mouse wheel delta to mouse() API?
3 participants