| 1 |
================================================================================ |
|---|
| 2 |
DerelictSDL |
|---|
| 3 |
================================================================================ |
|---|
| 4 |
DerelictSDL is a D package which allows you to use SDL in your D programs |
|---|
| 5 |
without the need to link to an import library. This gives you control over how |
|---|
| 6 |
to handle the case where the SDL shared library is not available on the |
|---|
| 7 |
user's machine. |
|---|
| 8 |
|
|---|
| 9 |
Please note that the Linux version is not yet implemented. Anyone who would like |
|---|
| 10 |
to do so please let me know in the forum! |
|---|
| 11 |
|
|---|
| 12 |
Additionally, when distributing applications built with DerelictSDL on Windows, |
|---|
| 13 |
it is a good idea to use the DLL in the DerelictSDL\sdl_dist directory. If you |
|---|
| 14 |
absolutely must distribute a different version of the DLL, please ensure that |
|---|
| 15 |
it is compiled with a compiler that does not mangle the exported DLL funtion |
|---|
| 16 |
symbol names (such as Microsoft Visual C++), or that aliases are used in the |
|---|
| 17 |
DLL's .def file to get around the mangling. Some compilers (such as MingW) will |
|---|
| 18 |
mangle the names in such a way that DerelictSDL cannot load them (at this time). |
|---|
| 19 |
|
|---|
| 20 |
-------------------------------------------------------------------------------- |
|---|
| 21 |
USING |
|---|
| 22 |
-------------------------------------------------------------------------------- |
|---|
| 23 |
You can use DerelictSDL in your project by first adding the Derelict source path |
|---|
| 24 |
to your compile command line with the -I switch (-I<derelict_dir>/DerelictSDL) and |
|---|
| 25 |
either by adding all the source/obj files to your makefile, or by building and |
|---|
| 26 |
linking with derelictSDL.lib (see the section entitled 'BUILDING' below for build |
|---|
| 27 |
instructions). |
|---|
| 28 |
|
|---|
| 29 |
In your code, you need to import the derelict.sdl.sdl module. |
|---|
| 30 |
|
|---|
| 31 |
++++++++++++++++++++++++++ CODE +++++++++++++++++++++++++++++++++++++++++++++ |
|---|
| 32 |
|
|---|
| 33 |
import derelict.sdl.sdl; |
|---|
| 34 |
|
|---|
| 35 |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|---|
| 36 |
|
|---|
| 37 |
During initialization of your application, you need to make a call to |
|---|
| 38 |
DSDL_Load. This will load the shared library. |
|---|
| 39 |
|
|---|
| 40 |
++++++++++++++++++++++++++ CODE +++++++++++++++++++++++++++++++++++++++++++++ |
|---|
| 41 |
|
|---|
| 42 |
// load the shared library |
|---|
| 43 |
DSDL_Load(); |
|---|
| 44 |
|
|---|
| 45 |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|---|
| 46 |
|
|---|
| 47 |
From that point you can call SDL functions as normal. |
|---|
| 48 |
|
|---|
| 49 |
-------------------------------------------------------------------------------- |
|---|
| 50 |
BUILDING |
|---|
| 51 |
-------------------------------------------------------------------------------- |
|---|
| 52 |
|
|---|
| 53 |
To build DerelictSDL on Windows: |
|---|
| 54 |
|
|---|
| 55 |
1) ensure that both dmd\bin and dm\bin are on your path |
|---|
| 56 |
2) from a command prompt, cd to <derelict_dir>\src\derelict\sdl |
|---|
| 57 |
3) type 'make' or 'make lib' to build derelictSDL.lib |
|---|
| 58 |
4) optionally type 'make clean' to delete all object files OR |
|---|
| 59 |
optionally type 'make cleanall' to delete all object, lib and bak files |
|---|