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

New Mouse Events

Started by theoriginalbit, 21 December 2012 - 02:22 AM
theoriginalbit #1
Posted 21 December 2012 - 03:22 AM
I am not too sure if this is possible at all, LWJGL may not even allow for it.

But is it possible to maybe add a "mouse_down" and possibly a "mouse_up" system event, I can think of several times that this could be used, all are GUI related and one is a game. :)/>

since im asking may ask well complete the suit, what do people think about a "mouse_moved" event that can maybe be used in OS's to say draw a cursor, or say a shooting game to show a crosshair :)/>
Sebra #2
Posted 21 December 2012 - 03:36 AM
No. Bad with several users in mind.
Cloudy #3
Posted 21 December 2012 - 03:46 AM
Maybe in the future. But there is a mouse drag event.
Doyle3694 #4
Posted 21 December 2012 - 03:50 AM
Sebra, since when are you a CC dev? I think only those who actually work on CC should deny/accept a suggestion rather than a not involved user.
remiX #5
Posted 21 December 2012 - 05:57 AM
How about a "mouse_hover". To highlight specific areas on on the computer, like a button :D/>
Cranium #6
Posted 21 December 2012 - 06:03 AM
A hover event would be thrown anytime you move the mouse over anything. I think that would also be bad for a multiuser environment. Detecting a constantly changing event would be very difficult(not impossible) to do with multiplayer.
theoriginalbit #7
Posted 21 December 2012 - 11:43 AM
Cloudy: I do know that there is the drag event, the mouse_moved event was just a last thought, main 2 ideas were the down and up :)/>

RemiX: The mouse_down and mouse_up event was part of my idea for things such as buttons on GUIs
Tiin57 #8
Posted 21 December 2012 - 12:19 PM
Sebra, since when are you a CC dev? I think only those who actually work on CC should deny/accept a suggestion rather than a not involved user.
I think experienced members of the forum are allowed to voice their opinions. Also, he's right.
Sebra #9
Posted 22 December 2012 - 08:11 AM
I'm not a CC dev. I'm unable to deny/accept. But I have my opinion. And my opinion not based on the empty place.
Imho Player should be more active than just look on screen to be detected by computers.
Pharap #10
Posted 28 December 2012 - 01:36 PM
since im asking may ask well complete the suit, what do people think about a "mouse_moved" event that can maybe be used in OS's to say draw a cursor, or say a shooting game to show a crosshair :)/>

This sort of already exists. There is a mousedrag event. *was the first person to add the discovery to the wiki*
If you make a program that grabs events and prints them directly to the console then click and drag, you'll see it comes up around once a second.

I can see where you're coming from though. As an XNA developer, I would find an 'is mouse down','is mouse up' event helpful. or perhaps a 'get mouse state' with the current state of the mouse. That way, the users could write the code to determine what are mouse clicks, what are mouse moves etc.
Same for keyboards.
Cloudy #11
Posted 28 December 2012 - 02:28 PM
There's no easy way of doing that without sending unnecessary packets, or considering latency. Also imagine this in a multi user environment and it soon becomes hard/impossible.
Pharap #12
Posted 28 December 2012 - 03:11 PM
There's no easy way of doing that without sending unnecessary packets, or considering latency. Also imagine this in a multi user environment and it soon becomes hard/impossible.

2 ints and a boolean for the mouse. I can see the keyboard processing being quite large though. Only way I can see around it would be bitmapping with the keys (sending a group of bytes that have their bits mapped to the key states, ie bit set is keydown, bit clear is keyup) but that would be a good 200 extra bits. If implemented it could be combined with the 2 major mouse buttons (each button having a bit set/clear to represent its state) but then there's the question of how much processing power would it take on java to assign all the bits on the fly. After all the server would have to query every single key, or at least get an object with the state of every single key then spend processing to shrink it into the bit flag notation.

It depends on the performance of Java really, and how LWGJL handles input getting. It's either that or force certain code to be managed by the client, which again would be a massive overhaul.

Ultimately I guess it will have to remain one of those 'dreamed of' features until then. Were I more familiar with Java I'd try to make a peripheral, but sadly I'm firmly rooted in the C-likes and me and Java don't currently get on very well.

*end of musings*
martin509 #13
Posted 28 February 2013 - 12:30 PM
Why not just add a mouse.wrap() function for a single player's mouse and lock out other mice? That would solve the problem of multiplayer, and open up new uses like two-player pong with the use of their mouse wheels.
Cloudy #14
Posted 28 February 2013 - 12:45 PM
It just isn't really possible without being ugly. So not gonna happen.