Hey there, about a week into Julia now and really enjoying it. 

I have a quick question that I feel is pretty simple but I can't seem to 
find any good examples in the docs or by looking through other peoples 
code, and I'm quite new to programming callbacks in general.

I'm trying to get keyboard and mouse inputs from this GLFW.jl saved into a 
variable:

https://github.com/JuliaGL/GLFW.jl/blob/master/examples/callbacks.jl

In this example callbacks are used to update and println() the values. I 
tried a few different things like replacing the println() with another 
function that would assign the values to some variables, as well as just 
assigning variables after the ->, but I must be missing something simple as 
those didn't seem to work properly. 

What I'd really like is to be able to write something like :

mouseCoordinates = GLFW.SetCursorPosCallback(window, (x, y)) 

and have a 2 element set with the x and y position easily accessible. 

For reference here is the implementation of the SetCursorPosCallback 
function (near the bottom of this page):

https://github.com/JuliaGL/GLFW.jl/blob/master/src/glfw3.jl

And what seems to be happening is that the function is being passed into a 
macro here:

https://github.com/JuliaGL/GLFW.jl/blob/master/src/util.jl

Any help even just walking me through it would be greatly appreciated. 

Reply via email to