An on-going port of D.J.Peters's FLTK C for FreeBasic, which is a binding for the FLTK, Fast Light Toolkit, GUI library by using dynamic library, to [http://nimlang.org](nim lang)
-
No OpenGL code has been ported, so
Fl_Glut01_no
can't run -
I don't know how to use
Fl_Shared_ImageImages
, soFl_Shared_Image02_no
~Fl_Shared_Image05_no
can't run -
I don't know how to pass nim array to C function, so
Fl_Menu_Bar02_no
andFl_Menu_Bar03_no
can't runBTW, is it possible to let nim judge the dimension of array? I mean
int balance[] = {12, 13, 16};
in C or ``Dim as integer balance(...) = {12, 13, 16}in FreeBasic, as you can find that there is no
3` is given
-
Download
fltk_c.nim
,fltk_main.nim
,fltk_tools.nim
-
Download:
fltk-c-1.3.3.zip Jan 09, 2017
from D.J.Peters's FLTK C for FreeBasic
2.1 Extract *.dll. Why? because I use windows and know nothing about Linux and MacOSX, so please join my work to write lines of code for Linux/MacOSX
2.2 Some example needs the directory and contents of media
- The simplest code with callback
import fltk_main
proc ButtonClick (button: ptr FL_WIDGET, arg: pointer):cint {.cdecl.} =
Fl_WidgetCopyLabel(button, "do it again")
var Win = Fl_WindowNew(320, 200, "What a shiny Window :-)")
var Btn = Fl_ButtonNew(10, 10, 120, 32, "click me")
Fl_WidgetSetCallback(Btn, ButtonClick)
Fl_WindowShow(Win)
Fl_Run()
- Yes, other
*.nim
are examples which I translate from D.J.Peters's FreeBasic code. However,*_no.nim
needs more works. Some can't be compiled; some runs and crashes; some does not function as expected; and some does run as expected but to be compared to the original FreeBasic's code, it needs more code which I don't like, so I think more work shoud be done infltk_main.nim
- Anymore? Yes, D.J.Peters gives ~360 examples. Please help translating more into nimlang
- Erco's FLTK Cheat Page supplied many demos in CPP, so it will need time to port to nim
- Pointer always hurts me
- I am a nimlang newbie
- Please fire issure and fix it
-
FreeBasic? because I need to handle many text in my work, but I hate to write such in any BASIC
-
nfltk. because I can't compile it in my MSYS2+MingW64 on Windows 7
-
wxWidgets? because I can't compile it in my MSYS2+MingW32 on Windows 7
-
QT? because I don't know how to compile it in my MSYS2+MingW64/32 on Windows 7
-
ui? because I needs widgets to write spreedsheet app
-
web engine and HTML/js? I don't know how to do that. But I do find http://tabulator.info is pretty
-
Python + QT/wxWidgets? Yes I do use them. But I find that some app built with py2exe/pyinstaller does not run on any Windows version.
-
two space for indentation? Well, this project is opensourced, please give you effort to it
Most of D.J.Peters's FreeBasic examples produce an EXE file of ~70 kbytes, only FB_Image_2_FL_Image01.exe
and FB_Image_2_FL_Image02.exe
are ~160 kbytes if I compile them by using FreeBASIC-1.05.0-win64
fbc -w pedantic test.bas
As for nim,
nim c -r -d:release --opt:size --passL:-s test.nim
can be used to compile smaller EXE files
I don't know how to do that in nimlang and FreeBasic. Do we need to supply another binding?
BTW, static link
is allowed by FLTK, and you do not need to opensource your code.
In fact, I don't mean to do so which has distracted me tremendously. However I can't find a ready-to-use binding.
On the other hand, I can learn something during testing/binding, but the work is actually repetitive injury. I wrote some scripts in Python but they can't cover everything.
I choose FLTK's lincense. But a note in your appliaction such as "FLTK_nim is used" is appreciated.