Welcome, Guest. Please login or register.
February 05, 2012, 10:08:29 PM
Home Help Search Login Register
News: A significant upgrade to OpenCL Studio 1.1 has been released including new OpenCL library elements, addtions to the scripting interface and various bug fixes.

+  opencldev.com
|-+  OpenCL Studio
| |-+  Development Environment
| | |-+  Mouse input
« previous next »
Pages: [1] Print
Author Topic: Mouse input  (Read 470 times)
raistlin969
Newbie
*
Posts: 13


« on: February 10, 2011, 01:47:49 PM »

Is there a way to get mouse coordinate information through an event handler.  For instance, if I have a canvas hosted in a window, can I get the x,y values of where the mouse button was pressed in the window.  I saw that there are keyboard sensors, but I could not find anything for the mouse. I am kind of slow so maybe I am just missing something obvious.  Thanks.
Logged
opencldev
Administrator
Jr. Member
*****
Posts: 59


« Reply #1 on: February 10, 2011, 02:17:00 PM »

You can use the sio (system io) package. For example in the OnMouseDownLeft handler of the canvas you can write:

sio.getMouseX(event)

to get the mouse x-coordinate with respect to the lower left corner of the canvas. You can also pass any other GUI object or nil to get coordinate in screen space. This package is not yet properly documented but you can also get mousewheel and keyboard state from there.
Logged
raistlin969
Newbie
*
Posts: 13


« Reply #2 on: February 10, 2011, 02:36:51 PM »

Great, that is what I will do.  Thanks for the quick reply.
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!