Murga-Projects Forums

Full Version: Fluid to lua converter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey folks,

I thought you might be interested in this little fluid file (.fl) to Lua script (.lua) converter I made.
You can download it here: http://www.igame3d.de/fluid_parser.zip

Build and run instructions are included.

The advantage is that you won't need to export .cxx and .h files from fluid anymore and don't have to use the cxx to murga converter script. It's just one step less but worth it.

Please post your comments Wink

Tobi
There's a bug with textcolor at the moment
May be other bugs where the translator doesn't write the file
Ok, added textcolor, selection_color and labelfont.

When the parser does not recognize an attribute, it will put that a comment in the lua file and might break at that point.

New parser online at same link

iGame3D Wrote:
There's a bug with textcolor at the  moment
May be other bugs where the translator doesn't write the file

Hi...

Im trying to compile but...i got some errors

Code:
C:\>cd f2l

C:\f2l>gcc lex.yy.c -o fluidtolua.exe
In file included from fluid.l:20:
y.tab.c:6: error: syntax error before string constant
y.tab.c:6: warning: data definition has no type or storage class

C:\f2l>


if i coment the line 6 on y.tab.c it compile but when i execute it gime errors...
its the line

Code:
3 | #if 0
4 | static char yysccsid[] = "@(#)yaccpar    1.9 (Berkeley) 02/21/93";
5 | #else
6 | //__IDSTRING(yyrcsid, "$NetBSD: skeleton.c,v 1.14 1997/10/20 03:41:16 lukem Exp $");
7 | #endif


curiously, my GCC compiler doesnt have the cdefs.h header on its include folder
so i copy one where i found on koders site
i dont know what to do...its my first C compilation ! Smile

Some stuffs...
Win xp sp2, mingw 5.1.3, GCC 3.4.5

Thx in advanced...sorry for my poor inglish

Tobi will try to provide a binary, there's probably an issue between mac and pc gcc.
Or he might come up with a fix. Be patient.

If you really can't wait, try checking iGame3D out from SVN.
In theory you should be able to drag and drop to convert fluids to lua
Instructions for Checkout

If drag and drop doesn't work, open the app, hit control T to get the console, and dofile with the path to the fluid, that should get you where you need to be.
OK, I tried compiling it on another windows machine with MSYS and got the same erros, dunno why it worked on that other machine but whatever, it's now fixed.

The source is updated now and a windows executable is now shipping with it as well.

You can find the fluid to lua converter here:

http://www.igame3d.de/fluid_parser.zip

Greetings,

Tobi
There's a new version with windows and mac binary.
It now handles groups correctly!
Link is still: http://www.igame3d.de/fluid_parser.zip

Tobi
Jan. 05 2008
Labelcolor support in the parser is fixed.
Free C Source Code Updated.

http://www.igame3d.de/fluid_parser.zip
Hi,

I was playing with the fluid_parser and I was wondering how easy it would be to change it so that it is able to cope with menu entries, as murgaLua 0.6 can now has all the same functionality as FLTK.

The same is true for images, which fluid embeds by default, and can now be mime encoded and then decoded for use in FL_Image creation.

Also, why does fluidtolua define so many variables at the start ?

Anyway, what would be REALLY cool would be to be able to integrate this into murgaLua in a way that you could do something like :

Code:
-- Loads .fl file, converts to lua and runs it (without the show/run)
  murgaLua.loadFluidGUI("test.fl")
  -- Assign callbacks to be used
  myFirstButton:callback(something) -- myFirstButton is name from .fl file.
  window:show()
  Fl:run()


Then, when developing an app you could just change the layout of your window without having to change your code ... Separating presentation from application logic :-)

What do you think ?

Cheers
JohnM

JohnMurga Wrote:
Hi,

I was playing with the fluid_parser and I was wondering how easy it would be to change it so that it is able to cope with menu entries, as murgaLua 0.6 can now has all the same functionality as FLTK.


Oh, it's easy to do that. I thought it already works, but now it turns out that Fluid does widgets of type "MenuItem" which the fluid converter tries to build. There is no widget type MenuItem though, menu items need to be done with menu:add()...
Should be quite straightforward to fix.

Quote:
The same is true for images, which fluid embeds by default, and can now be mime encoded and then decoded for use in FL_Image creation.

Also, why does fluidtolua define so many variables at the start ?


I haven't tried images yet, but it should be quite simple to put in as well.
All those variables in the start are used because fluid saves symbolic names of widget and property types to the .fl files that need to be mapped to integer constants to use in fltk or murgalua. The .cxx export handles the mapping but when we work on .fl files directly we need to take care of that ourselves. These variables do this mapping. In future versions we could as well get rid of the variables and do the symbol to integer resolution in the parser itself.

Quote:
Anyway, what would be REALLY cool would be to be able to integrate this into murgaLua in a way that you could do something like :

Code:
  -- Loads .fl file, converts to lua and runs it (without the show/run)
  murgaLua.loadFluidGUI("test.fl")
  -- Assign callbacks to be used
  myFirstButton:callback(something) -- myFirstButton is name from .fl file.
  window:show()
  Fl:run()


Then, when developing an app you could just change the layout of your window without having to change your code ... Separating presentation from application logic :-)

What do you think ?

Cheers
JohnM



Sounds really cool! It's also easy for the parser to remember the windows in a fluid file and show them after creation. Adding Fl:run() is trivial Wink

There's quite some exams stress at the moment, I think we can take care of that after February, 17th Big Grin

Keep up the good work,

Tobi

Pages: 1 2
Reference URL's