IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Node bindings for libui, an awesome native UI library for Unix, OSX and Windows

    shendao发表于 2016-06-12 15:37:50
    love 0

    libui-node

    libui Node.js bindings.

    libui is a simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.

    It is in early stage of development, but is evolving at great pace and is really awesome.

    It could become an awesome, lightweight alternative to Electron to develop multiplatform GUI.

    Node bindings for libui, an awesome native UI library for Unix, OSX and Windows

    Supported platform

    • Windows: Windows Vista SP2 with Platform Update or newer
    • Unix: GTK+ 3.10 or newer
    • Mac OS X: OS X 10.8 or newer

    Project status

    • All current libui API, except forthese ones are implemented.
    • I’m developing on linux , so this is the preferred platform to test. OSX should work too, but it’s not tested. Windows has yet to be configured in build scripts, but it will be supported in further releases.
    • There are very few tests developed, but they are passing in Travis thank you to @jjrv awesome work.
    • This is not yet battle-tested in a real app, but the control gallery example you saw in the screenshot above is fully working.

    Build Requirements

    • All platforms:
      • CMake 2.8.11 or newer
    • Windows: either -Microsoft Visual Studio 2013 or newer (2013 is needed for va_copy()) -MinGW-w64 (other flavors of MinGW may not work)
    • Unix: nothing else specific
    • Mac OS X: nothing else specific, so long as you can build Cocoa programs

    Installation

    We don’t publish new versions to NPM yet.

    git clone npm install

    To run the control gallery example, type:

    npm start

    Usage

    Plase look inexamples folder. We will write complete API documentation soon…

    Future directions of the project

    API

    This binding is actually implementing low-level API straight to the libui ones. We plan to add another level of API on top of it to simplify GUI building. You can get a taste of how they will be in example utils.js file .

    This new API will support transpilation from JSX to further simplify GUI building.

    These works will become in future the base for a React-Native like project.

    Publishing

    Since libui binaries are relatively small, we plan to precompile them for supported platforms and publish binaries file directly to NPM, to avoid the native build stage on install.

    Contribution & design

    • Each libui widget implementaion is written in it’s own C++ file in src folder.
    • Each widget is implemented in it’s own C++ class, each class is a simple wrapper for related libui C functions.
    • There is an header file called ui-node.h that contains all classes definitions.
    • We build the project using the awesomenbind tool, that automate the process of linking a straight C++ class to Node.js stuff…
    • All the GUI code run in the node javascript main thread. You must call libui.startLoop to start the GUI event loop. It run one step at a time, you can see inindex.js how this is implemented.

    Useful NPM scripts

    • test – run AVA tests && XO linting.
    • start – start the control gallery example
    • build – rebuild C++ sources
    • build:libui – rebuild libui sources under libui git submodule

    Related projects

    • libui – Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.
    • nbind – Magical headers that make your C++ library accessible from JavaScript

    Contributors

    Node bindings for libui, an awesome native UI library for Unix, OSX and Windows Node bindings for libui, an awesome native UI library for Unix, OSX and Windows Node bindings for libui, an awesome native UI library for Unix, OSX and Windows
    Andrea Parodi Juha Järvi Chan Guan Hao

    License

    The MIT License (MIT)

    Copyright (c) 2016 parro-it

    转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Node bindings for libui, an awesome native UI library for Unix, OSX and Windows



沪ICP备19023445号-2号
友情链接