Search code examples
user-interfacecrystal-lang

Crystal native GUI


Does Crystal possess any native GUI libraries ?

There is already a few shards that implement known libraries such as QT or SFML ( anything related to C in fact ) but i need a native library as I do not wish to have any extra downloads and keep the project light.


Solution

  • No, there aren't any GUI libraries written in Crystal. And I doubt we will see one anytime soon - or ever. These are incredibly huge and complex pieces of software. There exist only a handfull of modern general-purpose GUI libraries at all. Because it requires so much effort to create a halfway decent GUI framework, the few ones available have a broad target audience. Most of them are written in C to make them available for many languages and platforms.

    Crystal is great at interfacing C libraries and thus existing libraries can be integrated relatively easily. That still requires lots of work because of their size, but it's only a fraction of writing a new one just to have it in Crystal. Besides, there is no gain in reinventing the wheel.

    If you want to cut down runtime dependencies, you can try static compiling. There are still some glitches IIRC but it will work eventually.

    Allthough, since there exist only a few GUI libraries, they are usually available on most platforms and can be easily installed through package managers.