DerelictSFMLGraphics

DerelictSFMLGraphics is a D binding to the SFML Graphics library that ships with SFML 1.6.

Building

To compile DerelictSFMLGraphics, add the DerelictSFMLGraphics make target to the command line when compiling Derelict. For example, to build DerelictSFMLGraphics on Windows with DMD, you would execute the following:

make -fwin32.mak DerelictSFMLGraphics DC=DMD
For more information on compiling Derelict libraries, see Building the Derelict Bindings.

Using

  1. Always make sure the DerelictSFML source modules are available on your import path.
  2. In modules that make use of DerelictSFMLGraphics, you will need to import the derelict.sfml.graphics and derelict.sdml.window modules.
  3. You must link your application with the DerelictSFMLSystem, DerelictSFMLWindow, DerelictSFMLGraphics and DerelictUtil libraries.
  4. Before calling any SFML Graphics functions, you need to make a call to DerelictSFMLGraphics.load. This will load the shared library.

The following is a complete program that loads DerelictSFMLGraphics:


import derelict.sfml.graphics;

void main()
{
    DerelictSFMLGraphics.load();

    // now you can call SFML Graphics functions
}

As with other Derelict bindings, DerelictSFMLGraphics will throw an exception if an error occurs while loading the shared library. For more information on Derelict exceptions, see the documentation for Using the Derelict Bindings.

Finally, the method DerelictSFMLGraphics.unload() is provided for convenience. In normal practice you do not need to call this function, as Derelict will unload the library automatically when the app exits. You generally should only use this function if you need to unload DerelictSFMLGraphics while the application is running or if you disable the automatic unloading of shared libraries (as per the documentation for the loader module).