FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Adding new libraries

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
randomZ



Joined: 04 Dec 2004
Posts: 31
Location: Tuebingen, Germany

PostPosted: Thu Dec 16, 2004 4:26 pm    Post subject: Adding new libraries Reply with quote

Hi,

for something I'm working on, I'd like to port SDL_ttf to D. Am I right in thinking I need to do the following:

- Get SDL_ttf to compile with DMC
- Convert the SDL_ttf headers to D

Any tips you could give me beforehand?

Thanks,
Sebastian


EDIT: Crap, that means I also have to compile freetype, doesn't it? Sad Sad
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Fri Dec 17, 2004 5:22 am    Post subject: Re: Adding new libraries Reply with quote

randomZ wrote:
Hi,
- Get SDL_ttf to compile with DMC



This is not really necessary. If you look at the source to the various Derelict packages, you will see that I am loading the shared libraries explicitly via std.loader. What this means is that you do not need to link to any static link libraries. Derelict gets a handle to each shared library, then loads all exported functions and data manually.

Going by the title of this post, I assume you would like to add this to Derelict. If that is the case, then I will not accept any ports that load the shared libraries implicitly (i.e. by linking to the DLL's static link library). That's what separated Derelict from some of the other bindings around.

But if you were to create a binding that loaded the shared lib implicitly, you still would not need to compile SDL_ttf with DMC. All you would need to do is use the tool 'coff2omf' (or whatever it's called - the DigitalMars version, not the Borland version, as DMC's OMF and Borland's OMF seem not to be compatible) to convert the COFF version of the static link library (the format used by MSVC++) the OMF format used by DMC and D.

Quote:

- Convert the SDL_ttf headers to D


This, unfortunately, is a necessity. And if you are doing it the Derelict way you will need to declare function pointer types in place of the normal function declarartions along with the actual function pointer variables, then load everything from the shared lib.

Quote:

Any tips you could give me beforehand?


This can be a lot of work depending upon the size of the library (Python is killing me) and complexity of the headers (I gave up on libpng). I haven't looked at SDL_ttf, but if it is anything like SDL_image or SDL_mixer, then it should be a snap. I suggest you look at DerelictSDLMixer and DerelictSDLImage in the current svn trunk and use those as a guide.

Quote:

EDIT: Crap, that means I also have to compile freetype, doesn't it? Sad Sad


Actually, no it doesn't.
Back to top
View user's profile Send private message Send e-mail
xicesky



Joined: 19 Dec 2004
Posts: 6

PostPosted: Sun Dec 19, 2004 2:59 pm    Post subject: Reply with quote

SDL_ttf support for derelict would be great!! (SDL_net may be useful too, i think SDL supports more systems than phobos at the moment...)

Derelict is great anyway, i'm using it to create a tetris clone for my girlfriend atm. I'll release it under GPL if its ready to play...

Thanks for Derelict, keep up the great work!
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Mon Dec 20, 2004 10:34 am    Post subject: Reply with quote

xicesky wrote:
SDL_ttf support for derelict would be great!! (SDL_net may be useful too, i think SDL supports more systems than phobos at the moment...)

Derelict is great anyway, i'm using it to create a tetris clone for my girlfriend atm. I'll release it under GPL if its ready to play...

Thanks for Derelict, keep up the great work!


I'm happy to hear you find it useful Smile SDL_net will make it in there eventually.
Back to top
View user's profile Send private message Send e-mail
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Sat Dec 25, 2004 6:50 pm    Post subject: Reply with quote

Derelict is usefull, indeed Razz Good work! SDL net is a good library to add, I third that! Good luck, have a fun relaxing holiday, don't work too hard.
Back to top
View user's profile Send private message AIM Address
randomZ



Joined: 04 Dec 2004
Posts: 31
Location: Tuebingen, Germany

PostPosted: Sun Dec 26, 2004 2:54 pm    Post subject: Reply with quote

It was an hour of brain-numbing work, but I think I succeeded. At least I could get a test program to display some text. I haven't tested every single function.

Where should I send it for inclusion in derelict?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sun Dec 26, 2004 7:50 pm    Post subject: Reply with quote

randomZ wrote:

Where should I send it for inclusion in derelict?


You can email it to me (same handle as here) at gmail.com.
Back to top
View user's profile Send private message Send e-mail
barrett9h



Joined: 02 May 2005
Posts: 26
Location: Brazil

PostPosted: Sun May 15, 2005 8:07 am    Post subject: SDL_gfx Reply with quote

I'm starting to try with SDL_gfx.
Wish me luck.
Back to top
View user's profile Send private message MSN Messenger
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Sun May 22, 2005 2:40 pm    Post subject: Reply with quote

here's a tip: take a look at the SDL image derelict file for reference, and copy/paste is your friend : )
Back to top
View user's profile Send private message AIM Address
barrett9h



Joined: 02 May 2005
Posts: 26
Location: Brazil

PostPosted: Mon May 23, 2005 7:12 am    Post subject: my own Reply with quote

Ok, I have SDL_gfxprimitives (the most important part, for me, of the SDL_gfx library suite) working now.
It was not that hard. Many vi tricks with advanced regexp search/replace.. :)
I even ported the test program that cames with it, and it worked flawlessly (but a bit slower than with plain C).

Now I want to port a library of my own, that I used in a game I wrote that I want to port to D. I did the same, but when I try to run I get:
Error: Failed to load shared library Failed to load shared library libflush.so.1

Sadly, I have had little spare time at best, but I'll get back at this someday..
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group