Yet another crystal binding for libui-ng.
See examples.
- Notes:
- On Windows, libui-ng's msg_box implementation uses TaskDialog. ComCtl32.dll version6 is required to call TaskDialog. The standard ComCtl32 is version 5, so a manifest file is required.
- A function pointer in C is a Proc in Crystal.
- If data can be passed as an argument, it can be a closure, but not always; if data cannot be passed, it works only if the Proc is not a closure.
- Low-level bindings are located in
src/uing/lib_ui/lib_ui.cr
.
UIng::LibUI.new_window
,UIng::LibUI::AreaHandler.new
, etc.
- Middle-level bindings are located in
src/uing.cr
.UIng.new_window
etc.
UIng::Window.new
,UIng::AreaHandler.new
,UIng::AreaDrawParams.new(ref_ptr)
, etc.
- High-level object-oriented bindings are not yet implemented, and parhaps never will be, but they should be found in
src/uing/*.cr
.
-
Window = UIng::Window.new
,window.on_closing { |w| ... }
, etc. -
Enums are defined under
UIng
module. Both low-level and high-level bindings use them. -
The Crystal object corresponding to a C structure may have a reference pointer, or it may have the structure. Crystal objects have structure if it is necessary to allocate memory for the structure on the Crystal side. Otherwise, it should hold the reference.
-
History: https://forum.crystal-lang.org/t/6361
-
Rules:
UIng::LibUI
is a module for binding.- Use crystal_lib to create low-level bindings. You will need to modify the generated code.
- Passing a Proc to a C function
- Fork this repository
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
MIT