Just chiming in as I learn more. Reading through the GLWindow code and I think I understand what you're doing now and how the signals are working.
Am I correct in understand the process: Once the window is created, you use the GLFW callbacks I was mentioning, and you're providing as the second argument, a function that you have that runs an update function using the key that is provided, which then updates the appropriate signal in a dictionary full of signals. Think I'm slowly getting it, I'll have to read more on signals and their implementation, as well as more of Reactive's (and Elm's) structure and design as it's the first i've heard of the concept. If you know other implementation examples that I can read through, that'd be great! On Wednesday, May 6, 2015 at 9:59:03 PM UTC-4, Elburz Sorkhabi wrote: > > Simon, I tried GLWindow and Reactive, it works but it seems to introduce a > lot of extra complexity. Would be really interested to see if there's a way > to assign those GLFW callbacks for cursor and keyboard to variables, or > maybe I'm actually still stuck in old practices and should either consider > the GLWindow + Reactive route, or another way of thinking about it that > would align with Julia more. > > Any resources or similar would be greatly appreciated! > > On Wednesday, May 6, 2015 at 5:40:27 PM UTC-4, Elburz Sorkhabi wrote: >> >> Simon, >> >> Thanks for the reply, looking into both of your suggestions now. >> >> Was funny coincidence, I was just looking at your Events.jl package! >> >> Out of curiosity, does your recommendation to check out those packages >> infer that it's because the macro isn't returning values/that isn't how >> these callbacks are made? >> >> Thanks! >> >> On Wednesday, May 6, 2015 at 5:27:53 PM UTC-4, Simon Danisch wrote: >>> >>> Well maybe you will like https://github.com/JuliaGL/GLWindow.jl than. >>> It feeds all the values of the glfw callbacks into reactive signals. >>> Reactive is a nice event system: >>> https://github.com/JuliaLang/Reactive.jl >>> >>> >>> >>> >>> Am Mittwoch, 6. Mai 2015 22:49:00 UTC+2 schrieb Elburz Sorkhabi: >>>> >>>> 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. >>>> >>>>
