Glad you got it sorted out. The way pyglet does it is pretty similar to 
other libraries (like SDL2), where the mouse is already continuously firing 
update events to the Window. You just need to catch them. I really do like 
pyglet's event system.



On Monday, June 27, 2016 at 9:29:44 AM UTC+9, Paulo Martins wrote:
>
>
> Thank you both for your time and nice answers :)
>
> In the next morning after writing this question I did something similar to 
> magu example code (track of the mouse positon: self.mouse = [0,0] ) and it 
> is working like a charm.
>
> I was afraid that having on_mouse_motion always writing the x and y in 
> each little mouse movement could impact performance, so I asked this 
> question, in case there were other way like global acess to the x y of the 
> mouse. But the fact is that it is something very light, did not noticed any 
> impact on the FPS at all, I overacted and lost time reading the 
> documentation for something that don't exist and is not a problem.
>
> Thank you
>
> PS: I thought that by receiving here an answear would give me 
> automatically an e-mail alert, but after all not. That is why I took too 
> long to come here, thought I had no answears. Sorry dealy.
>
>
>
>
> segunda-feira, 20 de Junho de 2016 às 23:06:36 UTC+1, Paulo Martins 
> escreveu:
>>
>> Hi,
>>
>> Imagine that I am in a "update(dt)" function doing animation stuff, and 
>> need to position some sprite according to the mouse position: is there an 
>> easy way, like a function, to get the current mouse position (x, y 
>> coordinates)?
>> Or the only way is to creat something like a global variable x and y and 
>> keep track/registe the mouse x, y inside the on_mouse_motion event each 
>> time it moves, since the start of the app?
>>
>> I am tired and sleepy, working in a hurry because of deadlines, searched 
>> but can't find an easy way - sorry if this question is stupid and has an 
>> obvious answer I am not seeing in this moment.
>>
>> Thanks, all the best 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to