Some Questions Concerning LUA/C regarding GUI and Drawing

  • 1 Replies
  • 104 Views
Some Questions Concerning LUA/C regarding GUI and Drawing
« on: 04 / February / 2019, 02:47:25 »
Advertisements
As i started to make my own Script for my camera , i ran into some "pitfalls" with it, which are based by some Limitations I found. Like making more complex Guis and drawing Objects on the Screen. I think I know how I could work around that in LUA but I feel like it would be more efficient to directly into the C source (especially the drawing functions) and Populate them to LUA. As far as I understood it, the LUA implementation is some sort of "binding" to C functions that are written in the Main source Correct me if I am wrong about that. 

So what Features I'd like to add:
1. Draw more Shapes (Polygons, Curves)
2. More Userinputs (they must reside somewhere in the Code already, because they are used when you configure CHDK or a script)
3. Remove/Hide Objects from the Screen without redrawing the Entire OSD (to prevent flickering).

I know i can work my way around 1&2 in LUA, but that might become very inefficient, So I'd like to implement it into the C Source, but I'm not sure if thats maybe a waste of Time, because there are some Limitations on the Software I don't know about or maybe some other reasons that are more Hardware related. Maybe someone with more Experience can give me a little Heads on about this topic

With best regards
Adromir

*

Offline reyalp

  • ******
  • 11706
Re: Some Questions Concerning LUA/C regarding GUI and Drawing
« Reply #1 on: 11 / February / 2019, 16:20:13 »
As i started to make my own Script for my camera , i ran into some "pitfalls" with it, which are based by some Limitations I found. Like making more complex Guis and drawing Objects on the Screen. I think I know how I could work around that in LUA but I feel like it would be more efficient to directly into the C source (especially the drawing functions) and Populate them to LUA. As far as I understood it, the LUA implementation is some sort of "binding" to C functions that are written in the Main source Correct me if I am wrong about that. 
The Lua binding is in modules/luascript.c
This is compiled into a loadable module (lua.flt) so core functions must be exported to be available (see module_exportlist.c)

Quote
So what Features I'd like to add:
1. Draw more Shapes (Polygons, Curves)
This should be fairly straightforward, following the example of what is in core/gui_draw.c and how existing functions are exported to Lua.
However, for unfilled polygons I would expect a Lua implementation using lines to be sufficient. Filled polygons and curves might benefit from C implementation, but I'd be hesitant to add them to the core without a specific identified need.

Quote
2. More Userinputs (they must reside somewhere in the Code already, because they are used when you configure CHDK or a script)
You mean input controls, like what appears in the menu? This is complicated because script and UI run in different tasks (script runs in kbd_task, UI generally runs in in spytask.

Quote
3. Remove/Hide Objects from the Screen without redrawing the Entire OSD (to prevent flickering).
I do not believe this is possible to do in a general way, and the CHDK OSD would continue to flicker for other reasons in any case.
Don't forget what the H stands for.

 

Related Topics