This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Thib0704's profile picture

New way of getting mouse input.

Started by Thib0704, 02 March 2014 - 10:47 PM
Thib0704 #1
Posted 02 March 2014 - 11:47 PM
I think that having a new way of getting mouse input, would be nice!
Here is how it would work:

x,y = mouse.getPos() -- Returns the current position, nil if not on screen
isPressed = mouse.isPressed(button) -- Returns boolean pressed
Lyqyd #2
Posted 03 March 2014 - 12:13 AM
This sort of thing has been suggested repeatedly. One major issue is deciding whose mouse to return. Another issue is that you either have to poll the specific client for its current mouse position each time you call this function (which if you want it at all, you'd be calling it quite often, I'd suspect), or you have to have every client constantly sending mouse position updates to the server. This seems to me like it's even less feasible than getting keypress information. While it might be nice in some cases, I don't think this is very likely to get added.
Engineer #3
Posted 03 March 2014 - 12:25 AM
This sort of thing has been suggested repeatedly. One major issue is deciding whose mouse to return. Another issue is that you either have to poll the specific client for its current mouse position each time you call this function (which if you want it at all, you'd be calling it quite often, I'd suspect), or you have to have every client constantly sending mouse position updates to the server. This seems to me like it's even less feasible than getting keypress information. While it might be nice in some cases, I don't think this is very likely to get added.
I don't know how CC is coded and am not in the mood to deobfuscate CC, theoretically it would only be 8 bytes that get uploaded and downloaded.

Sure, then the problem arises with multiple people on one computer. Lets say if 5 people are watching somebody who is playing snake, it already costs much to send packets to all those clients to update the screen. Then if this method is called in a while loop (assuming it returns all mouse positions in a table), then it costs even more bytes!

Based on this, I agree with Lyqyd!
Though if done efficiently it is certainly feasible.
Edited on 02 March 2014 - 11:26 PM
Thib0704 #4
Posted 03 March 2014 - 12:38 AM
This sort of thing has been suggested repeatedly. One major issue is deciding whose mouse to return. Another issue is that you either have to poll the specific client for its current mouse position each time you call this function (which if you want it at all, you'd be calling it quite often, I'd suspect), or you have to have every client constantly sending mouse position updates to the server. This seems to me like it's even less feasible than getting keypress information. While it might be nice in some cases, I don't think this is very likely to get added.
This sort of thing has been suggested repeatedly. One major issue is deciding whose mouse to return. Another issue is that you either have to poll the specific client for its current mouse position each time you call this function (which if you want it at all, you'd be calling it quite often, I'd suspect), or you have to have every client constantly sending mouse position updates to the server. This seems to me like it's even less feasible than getting keypress information. While it might be nice in some cases, I don't think this is very likely to get added.
I don't know how CC is coded and am not in the mood to deobfuscate CC, theoretically it would only be 8 bytes that get uploaded and downloaded.

Sure, then the problem arises with multiple people on one computer. Lets say if 5 people are watching somebody who is playing snake, it already costs much to send packets to all those clients to update the screen. Then if this method is called in a while loop (assuming it returns all mouse positions in a table), then it costs even more bytes!

Based on this, I agree with Lyqyd!
Though if done efficiently it is certainly feasible.

Yeah, I didnt think about that…
I thought it would be nice so we could make some cool hover animations..