Saturday, March 27, 2010

Sometimes you have to use a bigger hammer...

This evening I spent awhile trying to hammer the SWIG'ed c# wrapper into something usable and less ugly. I've fixed all the "known" issues with the wrapper not wrapping some modules or functionality. The reduction in ugliness is related to the C-style enum and data type names. Things such as:
  • TCOD_BKGND_NONE
  • TCOD_key_status_t
  • TCOD_NOISE_MAX_OCTAVES
While for C users there is nothing wrong with them, users of higher level languages expect identifiers with less capital letters and underscores. After spending an hour or two trying to do it "nicely", I finally settled with adding somewhere around 200 lines like:

%rename (NoiseMaxOctaves) TCOD_NOISE_MAX_OCTAVES;

While a few VIM macros made this less painful that first glace would suggest, it still took awhile. It isn't a very elegant solution it works.

Now that I can type the constants without wanting to cry, I'm working on converting the C# libtcod-net demo program to use the new API. It started with about 400 compiler errors and I still have 230 to go, so it will take a while. It also means converting magecrawl (and by extension all the users of libtcod-net) will take awhile.

2 comments:

Tom said...

Greetings,

not sure if you get emails for older posts. So I hijacked this one. I tried the lua demo and it told me :

To run this demo, you must first install one of the following versions of the .NET framework: v4.0.30128

Contact your application publisher for instructions about obtaining the appropriate version of the .NET framework.

So, Hereby I consider you contacted ;}

donblas said...

My only guess of what is going on is that since i built the demo on a machine with visual studio 2010 installed, your getting issues with missing runtime libraries. Why this is showing up as a .net framework issue makes no sense. I'm installing visual studio 2008 now, so if you want, you can e-mail me a chris dot hamons at gmail dot com and I'll send you a build when it is done, or you can wait a few more days for the more official builds when I finish.