Jump to content


Photo

Lua experiments

lua

  • Please log in to reply
3 replies to this topic

#1 diabol

diabol

    Lazyass

  • Validating
  • 236 posts

Posted 04 January 2015 - 02:23 AM

After dodging the topic for a long time now I've decided it's about time to add some proper Lua support to bb.
Or at least to play around with Lua.
 
Considerations and limitations:


    [*]bb's plugin interface is incredibly thin
    [*]bb plugins are essentially standalone programs. integration points are: api access, broams, menus, styles, slit integration
    [*]bb's current API is horrible and will get a rewrite once somebody can be bothered breaking approximately every plugin
    [*]integrating lua into bb as a plugin is straight-forward
    [*]I can't be bothered to write C code atm
    [/list]

    With all of that in mind, my rough roadmap looks like this:


      [*]Stage - Bootstrapping the SDK

        [*]get a standalone lua environment running
        [*]create a lua library for bb-specific stuff (resource files, colors, menus, etc.) - this will be the lua bb sdk
        [*]rewrite a few bb plugins as lua programs (bb8Ball, bbAnalog, bbCalendar, bbKeys, bbIconBox)
        [*]set up a rocks repository for bb specific stuff
        [/list][*]Stage - Lua into BB

          [*]create a lua pluginloader for bb
          [*]bind bb's api into the lua sdk
          [/list][*]Stage - Backporting

            [*]backport the lua bb sdk into bblib
            [*]make bb's vintage api an adapter to bb sdk
            [/list][/list]

            So far I've got https://code.google..../luaforwindows/ up and running (installation was straightforward).
            I've checked out IUP and CD (both included in the distribution) and deemed them good enough to create non-transparent graphical output (they support transparency! awesome).
             
            Next I've started work on the SDK by implementing an rc-reader: http://pastebin.com/Lv8Vp7ki
            Since I don't have a real connection to bb, I'll just fake the connection points for now (by reading bb's settings, etc), although I'm pretty sure that a lot of the API is accessible via SendMessage.
             
            Bottomline: Stuff is happening, lua is coming. Slowly, but it's coming.
            Well, actually it's crawling and it might never make it :D


  • pitkon and firewater like this

#2 pitkon

pitkon

    Administrator

  • Head Administrator
  • 1,333 posts
  • LocationAthens & Nafplio, Greece

Posted 04 January 2015 - 08:23 AM

Every luck with this, diabol! :yes:


  • diabol likes this

#3 diabol

diabol

    Lazyass

  • Validating
  • 236 posts

Posted 04 January 2015 - 09:30 AM

Things are progressing slowly.
As you can see in the screenshot below, I now have ~90% of bb8Ball's functionality ported.
I've expanded on the rc reader: it can now properly parse colors defined as #RRGGBB, #RGB, rgb:RR/GG/BB colors and all 752 X11 color literals.

Also I've had fun with stuff such as mouse events o/

Attached File  bb8Ball_wip.png   98.99KB   0 downloads
 
I've played around a little with it, so I can now safely say that IUP is a cute and sane GUI framework.
The documentation can be sparse at times, but it's complete. Also all the functions I expect from a solid framework are there and as a bonus the HWND is exposed.
 
Next big step: Porting/implementing style item parsing/rendering.
That's right, I'll be rendering the gradients and everything right in lua.
Since it's much much easier to write high-level algorithms in Lua than C, I'll use this opportunity to get the rendering code algorithmically right, feature-complete and elegant. In a later step we* can back-port it into bblib to get that extra speed.
 
[color=#808080;]*probably not me :>[/color]


  • pitkon likes this

#4 diabol

diabol

    Lazyass

  • Validating
  • 236 posts

Posted 10 January 2015 - 09:14 PM

I've played around a little with it, so I can now safely say that IUP is a cute and sane GUI framework. The documentation can be sparse at times, but it's complete. Also all the functions I expect from a solid framework are there and as a bonus the HWND is exposed.

 

Well, I'll back off from that. It's been ages since IUP last saw an update, there doesn't seem to be a simple way to draw to a pixel-based framebuffer and the community is mainly based on mailing lists. Heck, they even refer to the mailing list on StackOverflow ._.

Looking around, the situation seems to be the same for all the other Lua GUI bindings (GTK, Qt, wxWidgets, ..) - they are either inactive or immature and inactive.

 

That makes it quite hard to actually draw stuff in Lua and since that is kinda important, I'll look elsewhere.

Initially, Python seems like a good option as a scripting language - active community, good (and recent) Qt bindings and other GUI options.

 

However, I hate Python, so I'll be experimenting with ScriptCS ( http://scriptcs.net/ )






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users