UIng is yet another Crystal binding for libui-ng or libui-dev.
Windows | Mac | Linux |
---|---|---|
![]() |
![]() |
![]() |
crystal run download.cr
The libui project does not distribute pre-compiled binaries.
Therefore, this project uses the following sources to obtain binaries:
OS | Binary Source |
---|---|
MacOS / Linux | Builds from the kojix2/libui-ng repository (pre-build branch) |
Windows | Pre-built binaries distributed with libui-dev |
- MinGW (mingw-w64-crystal) is recommended for Windows. UCRT / Clang is not supported because libui-dev is built with MinGW64.
- MSVC (x86_64-msvc) is not recommended but can be used with some limitations. Make sure rc.exe is in the PATH.
# Add the path to the Windows Kits
$env:Path += ";C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64"
See: https://crystal-lang.org/install/#windows
The Control gallery example uses a high-level API.
crystal build examples/control_gallery.cr
./control_gallery
For more details, see examples.
The middle-level API is reasonably well-implemented, allowing users to access most of libui's functionality. Please start by using this level.
Level | Defined in | Example | Description |
---|---|---|---|
Low-Level | src/uing/lib_ui/lib_ui.cr |
UIng::LibUI.new_button , etc. |
Direct bindings to the libui. |
Middle-Level | src/uing.cr |
UIng.button_text , etc. |
Handles memory management. |
High-Level | src/uing/*.cr |
button.on_clicked { } , etc. |
Custom API or macros. |
- At the middle level, memory management tasks such as string deallocation are handled.
- The high-level API implementation is limited; the
Control
module provides amethod_missing
macro to handle undefined methods.
crystal build examples/basic_window.cr --link-flags "-mwindows"
crystal build examples/basic_window.cr --link-flags=/SUBSYSTEM:WINDOWS
Note: The program will crash if you attempt to output to the console.
🚧
UIng::LibUI
is a module dedicated to bindings.- Use crystal_lib to generate low-level bindings (manual modifications required).
- Passing a Proc to a C function: Official Documentation.
libui-ng
'smsg_box
implementation relies onTaskDialog
.TaskDialog
requires ComCtl32.dll version 6.- There are other dependencies on version 6 besides
TaskDialog
. - The standard ComCtl32 is version 5, so a manifest file is necessary.
- For
MSVC
the link flag specifies the manuf. - For
MinGW
,comctl32.res
is generated whendownload.cr
is run.
- MinGW version of gdb can be used for debugging.
You can contribute to this project by:
- ☑ Forking this repository
- ☑ Reporting bugs
- ☑ Fixing bugs and submitting pull requests
- ☑ Improving documentation
- ☑ Suggesting or adding new features
This project is licensed under the MIT License.