05-30-2012, 08:51 PM
Hi!
To celebrate the upcoming, long-expected release of the next version of murgaLua, I came up with a new toy project:
Making an FLTK interface that would allow for creating Lua programs graphically.
I got this idea from different tools, like Matlab's Simulink, vistrails visualization workflows, etc etc.
I think it might be very useful for prototyping, for education (think explaining programming to kids), visualization of data for less programatic minded people etc.
The idea would be to have a set of blocks that would have in- and output ports that can be connected with lines. This would enable passing data from one block to another if run. Each block corresponds to a Lua function.
If anyone would want to join the effort, I could put up a git repo.
Now for the problems:
I'd want to separate of the logic from the GUI stuff, as to be able to port the same logic to other frontends (Why not put those blocks in a 3D space
). This would mean keeping all blocks, links, ... in tables. But I would need to be able to get the identity of a GUI block to associate it with the logic. A quick check however pointed out that the Fl:belowmouse() returns the correct widget, but each time packed in a new userdata object. Would it be possible to make murgaLua keep userdata objects associated with the generated widgets, as to be able to store and compare them in a list?
For now I was able to move boxes without needing the ID, just using the returned widget itself, and the FL boxtype, but as the project goes on, I will certainly need to be able to keep ID's (for example selecting multiple boxes, or using different box types for different kind of blocks, ...)
You can find the code I knocked up starting from the draggable box in the Widgets Demo attached.
Current pathetic features:
- multiple draggable boxes
- snap to (invisible) grid
Edit: New version adds:
- no initial jump when starting the drag
[attachment=81]
To celebrate the upcoming, long-expected release of the next version of murgaLua, I came up with a new toy project:
Making an FLTK interface that would allow for creating Lua programs graphically.
I got this idea from different tools, like Matlab's Simulink, vistrails visualization workflows, etc etc.
I think it might be very useful for prototyping, for education (think explaining programming to kids), visualization of data for less programatic minded people etc.
The idea would be to have a set of blocks that would have in- and output ports that can be connected with lines. This would enable passing data from one block to another if run. Each block corresponds to a Lua function.
If anyone would want to join the effort, I could put up a git repo.
Now for the problems:
I'd want to separate of the logic from the GUI stuff, as to be able to port the same logic to other frontends (Why not put those blocks in a 3D space

For now I was able to move boxes without needing the ID, just using the returned widget itself, and the FL boxtype, but as the project goes on, I will certainly need to be able to keep ID's (for example selecting multiple boxes, or using different box types for different kind of blocks, ...)
You can find the code I knocked up starting from the draggable box in the Widgets Demo attached.
Current pathetic features:
- multiple draggable boxes
- snap to (invisible) grid
Edit: New version adds:
- no initial jump when starting the drag
[attachment=81]