Tracking a mouse's co-ordinates inside a jit.window

Apr 30, 2008 at 4:55pm

Tracking a mouse's co-ordinates inside a jit.window

I thought i had this nailed and then i hit fullscreen mode and whoosh new problems

Neways i was wondering if there is anyway of tracking a mouse’s x and y values within a jit.window and only in that jit.window as well as having the x and y values not changing in fullscreen mode or on diffrent monitors.

I know its a bit of a tall order but there must be some sort of way round this problem

Thanks for any help you can give guys

#37417
Apr 30, 2008 at 5:55pm

> I thought i had this nailed and then i hit fullscreen mode and whoosh new problems
>
>

Are you using the mouse output from jit.window?

> Neways i was wondering if there is anyway of tracking a mouse’s x and y values within a jit.window and only in that jit.window as well as having the x and y values not changing in fullscreen mode or on diffrent monitors.
>

You’ll have to at least scale them according to windows size.
jit.window outputs window coordinates

wes

#129305
May 1, 2008 at 4:21pm

Yes.
This works fine on a small window.
But when i go to fullscreen the x and y values shoot up.
Obviously due to the increased screen size.
But is there any way to stop that at all

#129306
May 1, 2008 at 6:22pm

yes, when you go to fullscreen, send the coordinates to a [scale] object to confine the output to the same min and max coordinates that you were using in the pwindow. if the x/y of the first window was 320 240, and the x/y of fullscreen is 800 600, then you’ll use two scales. for the x – [scale 0 800 0 320] y – [scale 0 600 0 240]

#129307
May 2, 2008 at 2:28am

or use a separate pwindow for your mouse interaction

#129308
May 2, 2008 at 11:34am

Quote: bryanteoh wrote on Thu, 01 May 2008 12:22
—————————————————-
> yes, when you go to fullscreen, send the coordinates to a [scale] object to confine the output to the same min and max coordinates that you were using in the pwindow. if the x/y of the first window was 320 240, and the x/y of fullscreen is 800 600, then you’ll use two scales. for the x – [scale 0 800 0 320] y – [scale 0 600 0 240]
>
>
—————————————————-

ah this is true. But the problem is if i then move to say my laptop the full screen scale will be wrong. Or is there away of just cementing the fullscreen at a certain resolution.
Like it is always 800 600 at fullscreen.
Or if not a way of adjust the scale for several diffrent screen resolutions

#129309
May 2, 2008 at 1:05pm

Here is another approach

If you make any use of jit.gl.render in your patch try using the
screentoworld method and pasing the mouse window x,y coordinates as
agruments 1 and 2, then just route screentoworld out of the
jit.gl.render dump, and you’ll get normalized coordinates for your
mouse x,y (and z!) position.

JS

On 30-Apr-08, at 12:55 PM, David wrote:

>
> I thought i had this nailed and then i hit fullscreen mode and
> whoosh new problems
>
>
> Neways i was wondering if there is anyway of tracking a mouse’s x
> and y values within a jit.window and only in that jit.window as
> well as having the x and y values not changing in fullscreen mode
> or on diffrent monitors.
>
> I know its a bit of a tall order but there must be some sort of way
> round this problem
>
> Thanks for any help you can give guys

#129310
May 2, 2008 at 1:08pm

Here is another approach

If you make use of jit.gl.render in your patch try using the
screentoworld method by passing the mouse x,y coordinates from the
jit.window as agruments 1 and 2, then just route screentoworld out of
the jit.gl.render dump, and you’ll get normalized coordinates for
your mouse x,y (and z!) position.

JS

On 30-Apr-08, at 12:55 PM, David wrote:

>
> I thought i had this nailed and then i hit fullscreen mode and
> whoosh new problems
>
>
> Neways i was wondering if there is anyway of tracking a mouse’s x
> and y values within a jit.window and only in that jit.window as
> well as having the x and y values not changing in fullscreen mode
> or on diffrent monitors.
>
> I know its a bit of a tall order but there must be some sort of way
> round this problem
>
> Thanks for any help you can give guys

#129311
May 2, 2008 at 1:47pm

Something else I’ve done in the past is taken the dim from jit.display dumpout if you need to change scale items and automatically detect the settings of new computer screen to change your objects (I think you mentioned scale?). It’s also useful if you have multiple screens (such as a projector) and don’t know what the resolution is.

#129312

You must be logged in to reply to this topic.