Update on nw and call to action

  • Hi everyone!

    As some of you may know, right now I'm working on nw, a SDL-like lib which covers Windows, OSX and Linux. The difference is that it's written entirely in Lua and as a result the code is smaller and more readable, for which the latest line counts can attest:

    • Windows: 2200 LOC
    • OSX: 2700 LOC
    • X11: 1700 LOC
    • frontend: 2000 LOC

    That includes the comments, which there are plenty of since this is by definition a bag of hacks in order to make 3 horrible APIs namely WinAPI, Cocoa and X11 behave in a somewhat sane and consistent way without losing much functionality in the process.

    To be fair, we should also count the backend libraries, since it's all written on top of platform bindings which publish their own Lua APIs and can thus be used standalone:

    • winapi: 19,600 LOC (though nw uses only a subset of that)
    • objc: 2300 LOC
    • xlib: 1600 LOC

    These libs are also written in Lua so it's Lua all the way down the stack trace.

    It already has more features than SDL (menus, notification icons, views), though some features are still missing and there's a long way to go to achieve the SDL2 quality level. But anyway, that's not what I wanted to talk about. I'd like to try an experiment, see if it's possible to do open development on this project at this stage since the code is in pretty stable shape by now and basically just needs fill-ins with the missing features. So here's what I did so far to that effect: I translated my TODO list into github issues, labeled them thoroughly and organized them into 3 milestones, and on top of that I installed ZenHub which creates a SCRUM-type backlog with all the issues and I started tracking my progress through that. The next step will be to start making smaller and more focused commits (currently I'm doing the lazy man's one-commit-at-the-end-of-the-day thing) and more verbose commit messages correlated with the issues.

    TBH part of this is to help myself since the project is by now above the threshold where I can keep it all in my head. But since it's all on github anyway and the collab tools have gone a long way there, I figured why not make the process fully open maybe I find other people interested in hacking on this thing.

    So if you're like me, tired of the old choice between slow-to-write C and slow-to-run Python, feel that coding in C is like piling up chairs to go to the moon but chairs is all you've got, or just dreaming of that elusive LuaJIT platform for the desktop, well, this is an opportunity to start building that platform. LuaJIT can be much more than the secret weapon of some companies, it can be a powerful weapon for everyone, so let's start putting that together.

  • 7
    Log in to reply

  • Btw, criticism of the API, bug reports etc. are also welcome :)

    A bunch of tests and demos can be discovered by running nw_test.lua and I'm also working on cloning the look'n'feel of google chrome in nw_demo.lua as an all-in-one demo for custom-framed transparent windows.

  • Hi,

    I'm going to be spending some time with 'nw' this week. I'm still getting up to speed on the whole LP process, but as someone who has used Luvit and OpenResty to build server side applications for the last couple years (coronium.io is a free cloud stack in Lua), what you have here is nothing short of amazing. I will evangelize the project heavily once I am a little more comfortable with the process since I only just started last week.

    Anyway, I'll be posting some 'getting started' info on my blog. You've got an amazing tool here. I have a number of questions, but will start them as separate topics.


    Chris | develephant.com | coronium.io | Follow

  • Hi develephant (I still chuckle when I say that),

    Thank you for the kind words, appreciated! Remember that the process is not set in stone and we can always add different ways to do things and we can talk about them here, so feel free to talk about anything you want around here.

  • Hi Cosmin,
    have you "planned" something about controls/widgets on nw or is it mean to be done with something else ?
    actually many things should be possible via winapi ('winapi_demo.lua' already show several of them), but I don't really know what's possible on Linux or OSX (didn't see something about controls or widgets in 'objc' or 'xlib').
    actually I'm only on Windows, so I can go through winapi for my actual small needs, but that's just to know what could be done later..

  • Hi Fred,

    I am actually planning on writing a custom UI lib based on abstract input and rendering APIs and then hook it up to nw for input and then give it cairo and OpenGL rendering backends. All written in Lua of course.

    The most complex widget of this set is a business-grade grid/tree-list, something that Delphi had since 15 years ago (do a google image search for "devexpress treelist"). This is something that I wanted to write for a long time and Lua is the perfect language for that. The only hurdle is shopping for, building and binding one of the many cassowary constraint libs out there, and I'm a bit burned out on doing all that at the moment.

    In any case if you want to wet your feet in UI programming, there's a whole bunch of IMGUI-style widges in the cplayer folder (I think cplayer_demo presents some of them but not all) -- if you never heard of IMGUI before, you'll probably be shocked at how little code it takes to implement widgets that way (the UI lib that I wanna make will probably be a retained-mode/immediate-mode hybrid).

  • ok, sounds great.. thanks.

Log in to reply

Internal error.

Oops! Looks like something went wrong!