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

SDL_gfx into Derelict?

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



Joined: 26 Dec 2005
Posts: 21
Location: Finland

PostPosted: Tue Jun 27, 2006 2:16 pm    Post subject: SDL_gfx into Derelict? Reply with quote

I've made an impromptu port of SDL_gfx in the Derelict format, since it doesn't seem to have been done yet, and I'm wondering if it could be put into the queue for getting added into Derelict sooner or later.

The files:
However, they're not quite ready for packaging in their current state. Explanations and some queries follow.

The problem with SDL_gfx is that there's no single unification point: all five (or four, gfxprimitives_font is just some data) parts of the library are separate, but it's still one single library. Hence, where should the Derelict loader code be put?

  • Creating a "sdlgfx.d" is inconsistent with the original library.
  • Putting a separate loader in each .d is:

    • Inconsistent with other Derelict libraries, which only need to be loaded once.
    • Possibly inefficient, since each loader would load from the same DLL/.so separately, instead of loading everything at once. (Not sure about this one.)

For now I've left a "private void load(SharedLib)" function in each module, but there's no GenericLoader, which I suppose would look like the following, anywhere:
Code:
alias GenericLoader!("SDL_gfx.dll",
                     "libSDL_gfx.so, libSDL_gfx.so.13, libSDL_gfx.so.13.0.0",
                     "",
                     load)
      DerelictSDLGfx;

Other issues:

  • M_PI duplication (it's both in gfxprimitives.d and rotozoom.d), as well as its inclusion in the first place, worries me. It's wrapped around #ifndef M_PI #endif, too - in case it's not in <math.h>, evidently. Strictly speaking it should be left as it is, but I'm not certain: we have PI in std.math already, and to a greater precision.
  • gfxprimitives_font.h isn't stated as being a "component of the SDL_gfx library" on the homepage, yet it is included in the devel package. Hence I ported it as well, although I'm not quite certain whether it's meant to be used by user code. There's not much to it, it's just a big array, although the .d file had to be converted to UTF-8 since it was using ISO-8859-15 in its comments.
  • I changed (unsigned) char to (u)byte in all cases. Is that sensible? I think it is, since char is, after all, meant to hold UTF-8 code units, and SDL_gfx appears to use ISO-8859-15.

Also, I haven't yet tested it beyond asserting that each module compiles into an object file. If I get the time tomorrow, I will see about testing it properly (using Derelict to load the functions from the DLL), unless somebody else does first.
Back to top
View user's profile Send private message
aldacron



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

PostPosted: Tue Jun 27, 2006 2:29 pm    Post subject: Reply with quote

I appreciate the work you've done, but this is one of those libraries that I don't see getting added to the Derelict trunk right now. I've got some loose criteria that I try to follow (they are laid out in the docs on the front page) and SDL_gfx just doesn't meet them.

Feel free to distribute the library yourself, as a Derelict addon.
Back to top
View user's profile Send private message Send e-mail
Deewiant



Joined: 26 Dec 2005
Posts: 21
Location: Finland

PostPosted: Wed Jun 28, 2006 5:14 am    Post subject: Reply with quote

aldacron wrote:
I appreciate the work you've done, but this is one of those libraries that I don't see getting added to the Derelict trunk right now. I've got some loose criteria that I try to follow (they are laid out in the docs on the front page) and SDL_gfx just doesn't meet them.

Feel free to distribute the library yourself, as a Derelict addon.

Fine by me. Let me know if you change your mind. Wink

I'll keep the sources at where I linked to, for anyone other than myself willing to use them. I've added the files gfx.d, gfx.brf, and derelictsdlgfx.txt to make the package work properly and to hopefully make it somewhat easier to install and understand. I've tested it now, and it seems to work, at least under Windows: the DLL loads, and those functions that I've tested are called correctly and do what they should.

I made a ZIP archive with all the relevant files, too: DerelictSDLGfx.zip.

Can I still call it "DerelictSDLGfx" and package it under derelict.sdl (since I'll be using the Derelict loader), or is that in violation of the license?


Last edited by Deewiant on Thu Jun 29, 2006 11:28 am; edited 1 time in total
Back to top
View user's profile Send private message
aldacron



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

PostPosted: Wed Jun 28, 2006 8:19 am    Post subject: Reply with quote

Deewiant wrote:
Can I still call it "DerelictSDLGfx" and package it under derelict.sdl (since I'll be using the Derelict loader), or is that in violation of the license?


I have no problem with that. You might want to make clear in a readme or something that it is an addon and not part of the official distribution, just to avoid confusion.
Back to top
View user's profile Send private message Send e-mail
Deewiant



Joined: 26 Dec 2005
Posts: 21
Location: Finland

PostPosted: Wed Jun 28, 2006 8:47 am    Post subject: Reply with quote

aldacron wrote:
Deewiant wrote:
Can I still call it "DerelictSDLGfx" and package it under derelict.sdl (since I'll be using the Derelict loader), or is that in violation of the license?


I have no problem with that. You might want to make clear in a readme or something that it is an addon and not part of the official distribution, just to avoid confusion.

Good point. Thanks and done.
Back to top
View user's profile Send private message
asmanian



Joined: 02 Apr 2007
Posts: 3

PostPosted: Mon Apr 07, 2008 10:25 am    Post subject: Reply with quote

Out of frustration with bud and gdc on x86_64, once ago I dropped derelict in favor of a static linking.

Maybe now its time to give the whole thing second chance and your sdl_gfx binding is a critical piece to that goal Wink

Unfortunately the link seems down. Could you upload it again somewhere?

TIA,
Henning
Back to top
View user's profile Send private message
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