The Big Project I was working on
- Posted by Icy_Viking Jun 18, 2021
- 1227 views
Hello,
I was recently working a big project. A wrapper if you will. It was a wrapper of FTLK. I had found a C port of FLTK. I had used that as a basis for the project. However after finding some issues with it, I'm unsure if I'm able to continue with it. A lot of functions have been wrapped and there are many more that need to be wrapped.
The C port of FLTK was based on this. https://github.com/MoAlyousef/cfltk
It is not very well documented. In fact the github repo says you can follow along with the official CPlusPlus FLTK Docs. This is possible, but it is also harder to read and adjust for a more pure C code approach. Also, according to the DLL, there are over 9,000 functions.
--Snippet of some Wrapper Code public constant xFl_Window_new = define_c_func(fltk,"+Fl_Window_new",{C_INT,C_INT,C_INT,C_INT,C_POINTER},C_POINTER) public function Fl_Window_new(atom x,atom y,atom w,atom h,sequence title) atom str = allocate_wstring(title,1) return c_func(xFl_Window_new,{x,y,w,h,str}) end function public constant xFl_Window_end = define_c_proc(fltk,"+Fl_Window_end",{C_POINTER}) public procedure Fl_Window_end(atom w) c_proc(xFl_Window_end,{w}) end procedure public constant xFl_Window_show = define_c_proc(fltk,"+Fl_Window_show",{C_POINTER}) public procedure Fl_Window_show(atom w) c_proc(xFl_Window_show,{w}) end procedure public constant xFl_Button_new = define_c_func(fltk,"+Fl_Button_new",{C_INT,C_INT,C_INT,C_INT,C_POINTER},C_POINTER) public function Fl_Button_new(atom x,atom y,atom w,atom h,sequence title) atom str = allocate_string(title,1) return c_func(xFl_Button_new,{x,y,w,h,str}) end function
--Example program include std/machine.e include std/dll.e include EuFLTK.ew Fl_init_all() atom win = Fl_Window_new(100,100,600,400,"Example Win") atom bar = Fl_Box_new(0,0,600,60,"FTLK") atom btn = Fl_Button_new(600 - 100, 400 - 100, 100,20,"Hello") Fl_Box_set_box(bar,Fl_BoxType_FlatBox) Fl_Window_end(win) Fl_Window_show(win) Fl_background(255,255,255) public function Return_Fl() return Fl_run() end function Return_Fl()
AS you can see that text does not display cleary. At this point it is stuck in limbo until I decide to try to finish or abandon it. I am curious to hear what you guys think.