Mouse position

0 views
Skip to first unread message

Daryl.Cheung

unread,
Nov 10, 2007, 5:04:19 AM11/10/07
to electro-users
Hi,

I was wondering is there a function in electro that I can use to
retrieve the position of the mouse on the electro screen. I tried
using do_point() but that only returns the coordinates when the mouse
moves. Thanks.

Daryl

John Douthat

unread,
Nov 10, 2007, 10:18:07 AM11/10/07
to electr...@googlegroups.com
quoth the documentation:

This callback is invoked whenever the mouse pointer moves within the Electro main window. Motion is reported relatively, so the pointer may move an unlimited distance in any direction. Absolute position is not reported. If absolute mouse position is necessary, then it must be tracked manually, as follows:

mouse_x = 0
mouse_y = 0

function do_point(dx, dy)
mouse_x = mouse_x + dx
mouse_y = mouse_y + dy
return true
end
if you want to bound it to the size screen, build an "ensure_range" function to or do it inline

- John Douthat

Daryl.Cheung

unread,
Nov 10, 2007, 1:54:11 PM11/10/07
to electro-users
Hi,

I want it to be something like the get_entity_position() function
call, where it returns the x,y,z coordinates of where the mouse is. I
tried using the function you mention above, but it only would return
the distances moved.

Daryl

Robert Kooima

unread,
Nov 10, 2007, 2:04:05 PM11/10/07
to electr...@googlegroups.com

As John points out, this question is answered in the documentation.
Please read and understand it.

More importantly, understand why Electro does this: the window that
Electro displays is more than just an application window, it is a
front-end interface to a clustered display of potentially unlimited
size. Electro allows you to have a mouse pointer that functions
effectively across a huge display, like the 17600x6000 one at EVL. If
the server mouse pointer is limited to the little window, then this is
impossible. Relative mouse events make it possible.

--
Bob

David Thulson

unread,
Nov 12, 2007, 10:15:57 AM11/12/07
to electro-users
One other thing you should consider is that you can hide the system
mouse cursor if you include the command line argument "-m" when you
start Electro. You will then have to drwa the cursor yourself, but
otherwise it is possible for the system cursor to get out of sync with
where you think the cursor should be. The other benefit is that you
can draw the cursor to look like whatever you want instead of just
using the system cursor.

David Thulson

Reply all
Reply to author
Forward
0 new messages