GithubHelp home page GithubHelp logo

techscientist / libui-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from parro-it/libui-node

0.0 1.0 0.0 136 KB

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

License: MIT License

Python 2.54% JavaScript 19.09% C++ 78.38%

libui-node's Introduction

libui-node

libui Node.js bindings.

Travis Build Status NPM module NPM downloads

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.

Linux

OSX

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

Node version requirement

The project run on any node version > 0.12. However, some example in examples folder uses ES6 syntax. We will soon configure babel transpilation for them. Meanwhile, if you are testing the project on Node.js < 6, you can check examples/core-api.js that use Es5 syntax.

Project status

  • All current libui API, except for these 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. When we will, we are planning to download libui binaries directly from its github repo. See some details here.

Meanwhile, you have to build libui on your machine. This require the use of CMake 2.8.11 or newer.

Install cmake on OSX:

brew install cmake

Install cmake on Debian base Linux distro:

apt-get install cmake

You also need to pull the libui git submodule to grab it's sources.

git clone https://github.com/parro-it/libui-node.git
git submodule init
git submodule update
npm install

To run the control gallery example, type:

npm start

Note: There is some problem with then control gallery example on OSX. We are investigating it, if you are affected, you can meanwhile try the core-api example:

npm run start-core

Usage

Plase look in examples 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 src/ui-node.h that contains all classes definitions.
  • Widget events does not follow node convention: if you attach an handler to an event, previous one will be overwritten and never be called. This will be resolved on future high-level API repo, where each widget will be an EventEmitter instance.
  • We build the project using the awesome nbind 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 in index.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

Andrea Parodi Juha Järvi Chan Guan Hao
Andrea Parodi Juha Järvi Chan Guan Hao

License

The MIT License (MIT)

Copyright (c) 2016 parro-it

libui-node's People

Contributors

parro-it avatar jjrv avatar

Watchers

Subhash Ramesh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.