Thread overview
Req: Link to D modules for SDL, SDL_Mixer, OpenGL
Feb 01, 2006
Chris
Feb 01, 2006
Tom S
Feb 15, 2006
Muta
Feb 01, 2006
k.inaba
Feb 01, 2006
Chris
February 01, 2006
Can anyone provide a new link to the D modules for SDL, SDL_mixer and OpenGL? The site that used to be located here:

http://user.ecc.u-tokyo.ac.jp/~s31552/wp/d/porting.html

has since been removed and I haven't found SDL_Mixer or a decent SDL/OpenGL port anywhere else.

Thanks,
Chris


P.S. sorry if this message doesn't belong here, I've looked all over and this seemed like a good place to ask.


February 01, 2006
Chris wrote:
> Can anyone provide a new link to the D modules for SDL, SDL_mixer and OpenGL?
> The site that used to be located here:
> 
> http://user.ecc.u-tokyo.ac.jp/~s31552/wp/d/porting.html
> 
> has since been removed and I haven't found SDL_Mixer or a decent SDL/OpenGL port
> anywhere else.

Try Derelict:
http://dsource.org/projects/derelict/

It supports a lot of good libraries and soon is going to add more :)

Look at the forum for some info.
You can download its docs or browse them online:
http://svn.dsource.org/projects/derelict/trunk/docs/index.html


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y
------END GEEK CODE BLOCK------

Tomasz Stachowiak  /+ a.k.a. h3r3tic +/
February 01, 2006
The site has moved to:
http://shinh.skr.jp/d/porting.html


In article <drp1er$2a7i$1@digitaldaemon.com>, Chris says...
>
>Can anyone provide a new link to the D modules for SDL, SDL_mixer and OpenGL? The site that used to be located here:
>
>http://user.ecc.u-tokyo.ac.jp/~s31552/wp/d/porting.html
>
>has since been removed and I haven't found SDL_Mixer or a decent SDL/OpenGL port anywhere else.
>
>Thanks,
>Chris
>
>
>P.S. sorry if this message doesn't belong here, I've looked all over and this seemed like a good place to ask.
>
>


February 01, 2006
Tom S wrote:

>> Can anyone provide a new link to the D modules for SDL, SDL_mixer and OpenGL?
>> The site that used to be located here:
>>
>> http://user.ecc.u-tokyo.ac.jp/~s31552/wp/d/porting.html
>>
>> has since been removed and I haven't found SDL_Mixer or a decent SDL/OpenGL port
>> anywhere else.
> 
> Try Derelict:
> http://dsource.org/projects/derelict/
> 
> It supports a lot of good libraries and soon is going to add more :)
> 
> Look at the forum for some info.
> You can download its docs or browse them online:
> http://svn.dsource.org/projects/derelict/trunk/docs/index.html

Derelict uses a lot of function pointers and does runtime loading,
which is not always what you want (and doesn't work everywhere)

I instead just used the C headers and did a translation into D,
similar to the old D modules but updated and from new headers.


Since trying to get new modules, such as SDL or GL, into Phobos
has proven futile, I hosted my updated versions at my own site:

http://www.algonet.se/~afb/d/

* SDL 1.2.8
* SDL_image 1.2.4

* OpenGL 1.2.1
* GLUT 3.7.6

They're implemented as D modules named: sdl.sdl and opengl.gl
All open source. (SDL is under the LGPL, and OpenGL under SGI)

There is example code there too, like: testbitmap.d or gears.d

--anders


PS.
I mostly did them for use with GDC on Mac, since most of the other
projects are Windows/Linux centric. These should work everywhere...

Will move them to http://gdcmac.sourceforge.net/, when updated.
(Or perhaps a new project, if the mixed licensing requires it ?)
February 01, 2006
Thank you very much, this is exactly what I was looking for!

-Chris


In article <drpa8e$2juh$1@digitaldaemon.com>, k.inaba says...
>
>
>The site has moved to:
>http://shinh.skr.jp/d/porting.html
>
>
>In article <drp1er$2a7i$1@digitaldaemon.com>, Chris says...
>>
>>Can anyone provide a new link to the D modules for SDL, SDL_mixer and OpenGL? The site that used to be located here:
>>
>>http://user.ecc.u-tokyo.ac.jp/~s31552/wp/d/porting.html
>>
>>has since been removed and I haven't found SDL_Mixer or a decent SDL/OpenGL port anywhere else.
>>
>>Thanks,
>>Chris
>>
>>
>>P.S. sorry if this message doesn't belong here, I've looked all over and this seemed like a good place to ask.
>>
>>
>
>


February 15, 2006
Anders F Björklund wrote:

> I instead just used the C headers and did a translation into D, similar to the old D modules but updated and from new headers.
> 
> 
> Since trying to get new modules, such as SDL or GL, into Phobos has proven futile, I hosted my updated versions at my own site:
> 
> http://www.algonet.se/~afb/d/
> 
> * SDL 1.2.8

I tried those on linux, with SDL 1.2.9 (there doesn't seems to be many changes in the API), and ended with those linking errors:

dmd -L"-lSDL" test_sdl.d
gcc test_sdl.o -o test_sdl -lphobos -lpthread -lm -Xlinker -lSDL
test_sdl.o:(.data+0x54): undefined reference to `_ModuleInfo_3sdl3sdl'
test_sdl.o: In function `_Dmain':
test_sdl.d:(.gnu.linkonce.t_Dmain+0x8e): undefined reference to
`_init_6events9SDL_Event'
collect2: ld returned 1 exit status

The second one appears when I try to use SDL_Event. I don't have any clue about what could possibly cause these two linking errors. The source follows, I got it on a japanese D tutorial page:

import sdl.sdl;

int main()
{
        if (SDL_Init(SDL_INIT_VIDEO) < 0)
                return 1;

        SDL_Surface* screen;
        SDL_Surface* image;
        try
        {
                screen = SDL_SetVideoMode(128, 128, 16, SDL_SWSURFACE);
                if(!screen) return 1;
                //              image  = SDL_LoadBMP("coffee.bmp");
                image = SDL_LoadBMP_RW(SDL_RWFromFile("coffee.bmp", "rb"), 1);
                if(!image) return 1;

                while(true)
                {
                        SDL_Event event;
                        while (SDL_PollEvent(&event))
                                if (event.type == SDL_QUIT)
                                        return 1;

                        static SDL_Rect dest = {x:0, y:0};
                        SDL_UpperBlit(image, null, screen, &dest);
                        SDL_UpdateRect(screen, 0, 0, image.w, image.h);
                }
        }
        finally
        {
                if(image)
                        SDL_FreeSurface(image);
                SDL_Quit();
        }
        return 0;
}

February 18, 2006
Muta wrote:
>>Since trying to get new modules, such as SDL or GL, into Phobos
>>has proven futile, I hosted my updated versions at my own site:
>>
>>http://www.algonet.se/~afb/d/
> 
> I tried those on linux, with SDL 1.2.9 (there doesn't seems to be many
> changes in the API), and ended with those linking errors:

There are some newer versions in my CVS repository (link above),
which shows some example SDL/GL programs and how to link them...

Some of the C headers now generate code, when translated to D.
(if you don't like libraries, including sdl/*.d should work...)

--anders