| 1 |
<html lang="en"> |
|---|
| 2 |
<head> |
|---|
| 3 |
<title>DerelictSFMLGraphics</title> |
|---|
| 4 |
<link rel="stylesheet" type="text/css" href="styles.css"> |
|---|
| 5 |
</head> |
|---|
| 6 |
<body> |
|---|
| 7 |
<h2>DerelictSFMLGraphics</h2> |
|---|
| 8 |
DerelictSFMLGraphics is a D binding to the SFML Graphics library that ships with <a href="http://www.sfml-dev.org/">SFML 1.6</a>. |
|---|
| 9 |
|
|---|
| 10 |
<h3>Building</h3> |
|---|
| 11 |
To compile DerelictSFMLGraphics, add the <tt>DerelictSFMLGraphics</tt> make target to the command line when |
|---|
| 12 |
compiling Derelict. For example, to build DerelictSFMLGraphics on Windows with DMD, you would execute the following: |
|---|
| 13 |
<pre><code> |
|---|
| 14 |
make -fwin32.mak DerelictSFMLGraphics DC=DMD |
|---|
| 15 |
</code></pre> |
|---|
| 16 |
For more information on compiling Derelict libraries, see <a href="build.html">Building the |
|---|
| 17 |
Derelict Bindings</a>. |
|---|
| 18 |
|
|---|
| 19 |
<h3>Using</h3> |
|---|
| 20 |
<ol> |
|---|
| 21 |
<li>Always make sure the DerelictSFML source modules are available on your import |
|---|
| 22 |
path.</li> |
|---|
| 23 |
<li>In modules that make use of DerelictSFMLGraphics, you will need to import the |
|---|
| 24 |
<tt>derelict.sfml.graphics</tt> and <tt>derelict.sdml.window</tt> modules.</li> |
|---|
| 25 |
<li>You must link your application with the DerelictSFMLSystem, DerelictSFMLWindow, DerelictSFMLGraphics and DerelictUtil libraries.</li> |
|---|
| 26 |
<li>Before calling any SFML Graphics functions, you need to make a call to <tt>DerelictSFMLGraphics.load</tt>. |
|---|
| 27 |
This will load the shared library.</li> |
|---|
| 28 |
</ol> |
|---|
| 29 |
|
|---|
| 30 |
<p> |
|---|
| 31 |
The following is a complete program that loads DerelictSFMLGraphics: |
|---|
| 32 |
</p> |
|---|
| 33 |
|
|---|
| 34 |
<pre><code> |
|---|
| 35 |
import derelict.sfml.graphics; |
|---|
| 36 |
|
|---|
| 37 |
void main() |
|---|
| 38 |
{ |
|---|
| 39 |
DerelictSFMLGraphics.load(); |
|---|
| 40 |
|
|---|
| 41 |
// now you can call SFML Graphics functions |
|---|
| 42 |
} |
|---|
| 43 |
</code></pre> |
|---|
| 44 |
<p> |
|---|
| 45 |
As with other Derelict bindings, DerelictSFMLGraphics will throw an exception if an error |
|---|
| 46 |
occurs while loading the shared library. For more information on Derelict |
|---|
| 47 |
exceptions, see the documentation for <a href="use.html#Exceptions">Using the Derelict Bindings</a>. |
|---|
| 48 |
</p> |
|---|
| 49 |
|
|---|
| 50 |
<p> |
|---|
| 51 |
Finally, the method <tt>DerelictSFMLGraphics.unload()</tt> is provided for convenience. In normal |
|---|
| 52 |
practice you do not need to call this function, as Derelict will unload the library |
|---|
| 53 |
automatically when the app exits. You generally should only use this function if |
|---|
| 54 |
you need to unload DerelictSFMLGraphics while the application is running or if you disable the |
|---|
| 55 |
automatic unloading of shared libraries (as per <a href="util.html#Loader">the documentation for the loader module</a>). |
|---|
| 56 |
</p> |
|---|
| 57 |
|
|---|
| 58 |
</body> |
|---|
| 59 |
</html> |
|---|