Changeset 161
- Timestamp:
- 06/29/06 17:50:59 (2 years ago)
- Files:
-
- trunk/DerelictAL/derelict/openal/alctypes.d (modified) (1 diff)
- trunk/DerelictAL/derelict/openal/almanual.d (modified) (2 diffs)
- trunk/DerelictAL/derelict/openal/alstatic.d (modified) (1 diff)
- trunk/DerelictFT/derelict/freetype/ftfuncs.d (modified) (2 diffs)
- trunk/DerelictGL/derelict/opengl/gl.d (modified) (1 diff)
- trunk/DerelictGLFW/derelict/glfw/glfw.d (modified) (3 diffs)
- trunk/DerelictGLU/derelict/opengl/glu.d (modified) (1 diff)
- trunk/DerelictIL/derelict/devil/ilfuncs.d (modified) (1 diff)
- trunk/DerelictILU/derelict/devil/ilufuncs.d (modified) (1 diff)
- trunk/DerelictILUT/derelict/devil/ilutfuncs.d (modified) (1 diff)
- trunk/DerelictOgg/derelict/ogg/ogg.d (modified) (1 diff)
- trunk/DerelictSDL/derelict/sdl/sdl.d (modified) (1 diff)
- trunk/DerelictSDLImage/derelict/sdl/image.d (modified) (1 diff)
- trunk/DerelictSDLMixer/derelict/sdl/mixer.d (modified) (1 diff)
- trunk/DerelictSDLNet/derelict/sdl/net.d (modified) (1 diff)
- trunk/DerelictSDLttf/derelict/sdl/ttf.d (modified) (1 diff)
- trunk/DerelictUtil/derelict/util/loader.d (modified) (3 diffs)
- trunk/DerelictVorbis/derelict/ogg/vorbiscodec.d (modified) (1 diff)
- trunk/DerelictVorbis/derelict/ogg/vorbisfile.d (modified) (1 diff)
- trunk/examples/sdl_ex1.d (modified) (1 diff)
- trunk/examples/vorbisfile_example.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/DerelictAL/derelict/openal/alctypes.d
r153 r161 37 37 else 38 38 { 39 struct ALCdevice {}40 alias void ALCcontext; 39 /+ struct ALCdevice {} 40 alias void ALCcontext;+/ 41 41 } 42 42 trunk/DerelictAL/derelict/openal/almanual.d
r153 r161 127 127 } 128 128 129 alias GenericLoader!("OpenAL32.dll", "libal.so, libAL.so, libopenal.so, libopenal.so.0", "", loadAL) DerelictAL;130 131 129 132 130 public void loadALU(SharedLib lib) … … 148 146 149 147 150 alias GenericDependentLoader!(DerelictAL, loadALU) DerelictALU; 148 GenericLoader DerelictAL; 149 GenericDependentLoader DerelictALU; 150 static this() { 151 DerelictAL.setup( 152 "OpenAL32.dll", 153 "libal.so, libAL.so, libopenal.so, libopenal.so.0", 154 "", 155 &loadAL 156 ); 157 DerelictALU.setup(&DerelictAL, &loadALU); 158 } 151 159 152 160 trunk/DerelictAL/derelict/openal/alstatic.d
r154 r161 42 42 } 43 43 44 alias GenericStaticLoader!() DerelictAL; 45 alias GenericStaticLoader!() DerelictALU; 44 GenericStaticLoader DerelictAL; 45 GenericStaticLoader DerelictALU; 46 47 static this() { 48 DerelictAL.setup(); 49 DerelictALU.setup(); 50 } 46 51 47 52 /* version(Windows) trunk/DerelictFT/derelict/freetype/ftfuncs.d
r149 r161 39 39 } 40 40 41 alias GenericStaticLoader!() DerelictFT; 41 GenericStaticLoader DerelictFT; 42 43 static this() { 44 DerelictFT.setup(); 45 } 42 46 } 43 47 else … … 301 305 } 302 306 303 alias GenericLoader!("freetype.dll", "libfreetype.so", "", loadFT, "2.1.10") DerelictFT; 307 GenericLoader DerelictFT; 308 static this() { 309 DerelictFT.setup( 310 "freetype.dll", 311 "libfreetype.so", 312 "", 313 &loadFT, 314 "2.1.10" 315 ); 316 } 304 317 305 318 trunk/DerelictGL/derelict/opengl/gl.d
r149 r161 56 56 57 57 58 alias GenericLoader!( "opengl32.dll", 59 "libGL.so", 60 "", 61 loadAll) 62 DerelictGL; 58 59 GenericLoader DerelictGL; 60 static this () { 61 DerelictGL.setup ( 62 "opengl32.dll", 63 "libGL.so", 64 "", 65 &loadAll 66 ); 67 } 68 trunk/DerelictGLFW/derelict/glfw/glfw.d
r152 r161 303 303 pfglfwLoadTexture2D loadTexture2D; 304 304 305 private void load(SharedLib lib)305 private extern(D) void load(SharedLib lib) 306 306 { 307 307 bindFunc(init)("init", lib); … … 449 449 pfglfwLoadTexture2D glfwLoadTexture2D; 450 450 451 private void load(SharedLib lib)451 private extern(D) void load(SharedLib lib) 452 452 { 453 453 bindFunc(glfwInit)("glfwInit", lib); … … 525 525 526 526 527 alias GenericLoader!("glfw.dll", "libglfw.so", "", load) DerelictGLFW; 527 GenericLoader DerelictGLFW; 528 static this() { 529 DerelictGLFW.setup( 530 "glfw.dll", 531 "libglfw.so", 532 "", 533 &load 534 ); 535 } 528 536 529 537 trunk/DerelictGLU/derelict/opengl/glu.d
r149 r161 104 104 105 105 106 alias GenericLoader!("glu32.dll", "libGLU.so", "", load) DerelictGLU; 106 GenericLoader DerelictGLU; 107 static this() { 108 DerelictGLU.setup( 109 "glu32.dll", 110 "libGLU.so", 111 "", 112 &load 113 ); 114 } 107 115 108 116 //============================================================================== trunk/DerelictIL/derelict/devil/ilfuncs.d
r149 r161 131 131 132 132 133 alias GenericLoader!("devil.dll", "libIL.so", "", loadIL) DerelictIL; 133 GenericLoader DerelictIL; 134 static this() { 135 DerelictIL.setup( 136 "devil.dll", 137 "libIL.so", 138 "", 139 &loadIL 140 ); 141 } 134 142 135 143 trunk/DerelictILU/derelict/devil/ilufuncs.d
r149 r161 90 90 91 91 92 alias GenericLoader!("ilu.dll", "libILU.so", "", loadILU) DerelictILU; 92 GenericLoader DerelictILU; 93 static this() { 94 DerelictILU.setup( 95 "ilu.dll", 96 "libILU.so", 97 "", 98 &loadILU 99 ); 100 } 93 101 94 102 trunk/DerelictILUT/derelict/devil/ilutfuncs.d
r149 r161 91 91 92 92 93 alias GenericLoader!("ilut.dll", "libILUT.so", "", loadILUT) DerelictILUT; 93 GenericLoader DerelictILUT; 94 static this() { 95 DerelictILUT.setup( 96 "ilut.dll", 97 "libILUT.so", 98 "", 99 &loadILUT 100 ); 101 } 94 102 95 103 trunk/DerelictOgg/derelict/ogg/ogg.d
r149 r161 123 123 124 124 125 alias GenericLoader!( "ogg.dll", 126 "libogg.so, libogg.so.0", 127 "", 128 loadOgg) 129 DerelictOgg; 125 GenericLoader DerelictOgg; 126 static this() { 127 DerelictOgg.setup( 128 "ogg.dll", 129 "libogg.so, libogg.so.0", 130 "", 131 &loadOgg 132 ); 133 } 130 134 131 135 trunk/DerelictSDL/derelict/sdl/sdl.d
r149 r161 305 305 306 306 307 alias GenericLoader!( "sdl.dll", 308 "libSDL.so, libSDL.so.0, libSDL-1.2.so, libSDL-1.2.so.0", 309 "", 310 load) 311 DerelictSDL; 307 GenericLoader DerelictSDL; 308 static this() { 309 DerelictSDL.setup( 310 "sdl.dll", 311 "libSDL.so, libSDL.so.0, libSDL-1.2.so, libSDL-1.2.so.0", 312 "", 313 &load 314 ); 315 } trunk/DerelictSDLImage/derelict/sdl/image.d
r149 r161 140 140 141 141 142 alias GenericLoader!( "SDL_image.dll", 143 "libSDL_image.so, libSDL_image-1.2.so, libSDL_image-1.2.so.0", 144 "", 145 load) 146 DerelictSDLImage; 142 GenericLoader DerelictSDLImage; 143 static this() { 144 DerelictSDLImage.setup( 145 "SDL_image.dll", 146 "libSDL_image.so, libSDL_image-1.2.so, libSDL_image-1.2.so.0", 147 "", 148 &load 149 ); 150 } 147 151 trunk/DerelictSDLMixer/derelict/sdl/mixer.d
r149 r161 340 340 341 341 342 alias GenericLoader!( "SDL_mixer.dll", 343 "libSDL_mixer.so, libSDL_mixer-1.2.so, libSDL_mixer-1.2.so.0", 344 "", 345 load) 346 DerelictSDLMixer; 347 342 GenericLoader DerelictSDLMixer; 343 static this() { 344 DerelictSDLMixer.setup( 345 "SDL_mixer.dll", 346 "libSDL_mixer.so, libSDL_mixer-1.2.so, libSDL_mixer-1.2.so.0", 347 "", 348 &load 349 ); 350 } trunk/DerelictSDLNet/derelict/sdl/net.d
r149 r161 262 262 263 263 264 alias GenericLoader!( "SDL_net.dll", 265 "libSDL_net.so, libSDL_net-1.2.so, libSDL_net-1.2.so.0", 266 "", 267 load) 268 DerelictSDLNet; 269 264 GenericLoader DerelictSDLNet; 265 static this() { 266 DerelictSDLNet.setup( 267 "SDL_net.dll", 268 "libSDL_net.so, libSDL_net-1.2.so, libSDL_net-1.2.so.0", 269 "", 270 &load 271 ); 272 } trunk/DerelictSDLttf/derelict/sdl/ttf.d
r149 r161 211 211 212 212 213 alias GenericLoader!( "SDL_ttf.dll", 214 "libSDL_ttf.so, libSDL_ttf-2.0.so, libSDL_ttf-2.0.so.0", 215 "", 216 load) 217 DerelictSDLttf; 218 213 GenericLoader DerelictSDLttf; 214 static this() { 215 DerelictSDLttf.setup( 216 "SDL_ttf.dll", 217 "libSDL_ttf.so, libSDL_ttf-2.0.so, libSDL_ttf-2.0.so.0", 218 "", 219 &load 220 ); 221 } trunk/DerelictUtil/derelict/util/loader.d
r149 r161 217 217 //============================================================================== 218 218 219 package final class GenericLoader(char[] winLibs, char[] linLibs, char[] macLibs, alias userLoad, char[] versionStr = "") { 220 private import std.string; 221 222 public static void load(char[] libNameString = null) 219 struct GenericLoader { 220 void setup(char[] winLibs, char[] linLibs, char[] macLibs, void function(SharedLib) userLoad, char[] versionStr = "") { 221 assert (userLoad !is null); 222 this.winLibs = winLibs; 223 this.linLibs = linLibs; 224 this.macLibs = macLibs; 225 this.userLoad = userLoad; 226 this.versionStr = versionStr; 227 } 228 229 void load(char[] libNameString = null) 223 230 { 224 231 if (myLib !is null) { 225 232 return; 226 233 } 234 235 // make sure the lib will be unloaded at progam termination 236 registeredLoaders ~= this; 237 227 238 228 239 if (libNameString is null) { … … 244 255 } 245 256 246 public staticchar[] versionString()257 char[] versionString() 247 258 { 248 259 return versionStr; 249 260 } 250 261 251 public static void unload() 252 { 253 Derelict_UnloadSharedLib(myLib); 262 void unload() 263 { 264 if (myLib !is null) { 265 Derelict_UnloadSharedLib(myLib); 266 myLib = null; 267 } 254 268 } 255 269 256 270 static ~this() 257 271 { 258 unload(); 259 } 260 261 private this() 262 { 263 // don't create me ! 264 } 265 266 private static SharedLib myLib; 267 } 268 269 //============================================================================== 270 271 package final class GenericDependentLoader(alias dependence, alias userLoad) { 272 private static SharedLib myLib() { 272 foreach (x; registeredLoaders) { 273 x.unload(); 274 } 275 } 276 277 private { 278 static GenericLoader*[] registeredLoaders; 279 280 SharedLib myLib; 281 char[] winLibs; 282 char[] linLibs; 283 char[] macLibs; 284 char[] versionStr = ""; 285 286 void function(SharedLib) userLoad; 287 } 288 } 289 290 //============================================================================== 291 292 struct GenericDependentLoader { 293 void setup(GenericLoader* dependence, void function(SharedLib) userLoad) { 294 assert (dependence !is null); 295 assert (userLoad !is null); 296 297 this.dependence = dependence; 298 this.userLoad = userLoad; 299 } 300 301 private SharedLib myLib() { 273 302 return dependence.myLib; 274 303 } 275 304 276 public staticvoid load()305 void load() 277 306 { 278 307 assert (myLib !is null); … … 280 309 } 281 310 282 public staticchar[] versionString()311 char[] versionString() 283 312 { 284 313 return dependence.versionString; 285 314 } 286 315 287 public static void unload() 288 { 289 } 290 291 static ~this() 292 { 293 unload(); 294 } 295 296 private this() 297 { 298 // don't create me ! 299 } 300 } 301 302 //============================================================================== 303 304 private void noLoader() {} 305 306 package final class GenericStaticLoader(alias userLoad = noLoader, char[] versionStr = "") { 307 private import std.string; 308 309 public static void load(char[] libNameString = null) 310 { 311 userLoad(); 312 } 313 314 public static char[] versionString() 315 { 316 return versionStr; 317 } 318 319 public static void unload() 320 { 321 } 322 323 static ~this() 324 { 325 unload(); 326 } 327 328 private this() 329 { 330 // don't create me ! 331 } 332 } 316 void unload() 317 { 318 } 319 320 private { 321 GenericLoader* dependence; 322 void function(SharedLib) userLoad; 323 } 324 } 325 326 //============================================================================== 327 328 struct GenericStaticLoader { 329 void setup(void function() userLoad = null, char[] versionStr = "") { 330 this.userLoad = userLoad; 331 this.versionStr = versionStr; 332 } 333 334 void load() 335 { 336 if (userLoad !is null) { 337 userLoad(); 338 } 339 } 340 341 char[] versionString() 342 { 343 return versionString; 344 } 345 346 void unload() 347 { 348 } 349 350 private { 351 char[] versionStr; 352 void function() userLoad; 353 } 354 } 355 333 356 334 357 //============================================================================== trunk/DerelictVorbis/derelict/ogg/vorbiscodec.d
r151 r161 89 89 } // loadVorbis() 90 90 91 alias GenericLoader!( "vorbis.dll", 92 "libvorbis.so, libvorbis.so.0, libvorbis.so.0.3.0", 93 "", 94 loadVorbis) 95 DerelictVorbis; 91 92 GenericLoader DerelictVorbis; 93 static this() { 94 DerelictVorbis.setup( 95 "vorbis.dll", 96 "libvorbis.so, libvorbis.so.0, libvorbis.so.0.3.0", 97 "", 98 &loadVorbis 99 ); 100 } 96 101 97 102 trunk/DerelictVorbis/derelict/ogg/vorbisfile.d
r149 r161 97 97 98 98 99 alias GenericLoader!( "vorbisfile.dll", 100 "libvorbisfile.so, libvorbisfile.so.3, libvorbisfile.so.3.1.0", 101 "", 102 loadVorbisFile) 103 DerelictVorbisFile; 104 99 GenericLoader DerelictVorbisFile; 100 static this() { 101 DerelictVorbisFile.setup( 102 "vorbisfile.dll", 103 "libvorbisfile.so, libvorbisfile.so.3, libvorbisfile.so.3.1.0", 104 "", 105 &loadVorbisFile 106 ); 107 } 105 108 106 109 trunk/examples/sdl_ex1.d
r114 r161 73 73 { 74 74 // load the SDL shared library 75 DerelictSDL _Load();75 DerelictSDL.load(); 76 76 77 77 // Initialize SDL trunk/examples/vorbisfile_example.d
r149 r161 8 8 import std.c.stdio; 9 9 import std.file; 10 import derelict.vorbis.vorbisfile; 10 import derelict.ogg.vorbisfile; 11 import derelict.ogg.vorbistypes; 11 12 12 13 // take 4k out of the data segment, not the stack … … 17 18 18 19 // Init 19 DerelictVorbis _LoadVorbisFile();20 DerelictVorbisFile.load(); 20 21 21 22 OggVorbis_File vf;
