Changeset 44
- Timestamp:
- 08/13/04 08:35:57 (4 years ago)
- Files:
-
- trunk/DerelictSDL/Makefile (modified) (2 diffs)
- trunk/DerelictSDL/README (modified) (2 diffs)
- trunk/DerelictSDL/derelict/sdl/image.d (added)
- trunk/DerelictSDL/derelict/sdl/sdl.d (modified) (3 diffs)
- trunk/DerelictSDL/sdl_img_dist (added)
- trunk/DerelictSDL/sdl_img_dist/README.txt (added)
- trunk/DerelictSDL/sdl_img_dist/SDL_image.dll (added)
- trunk/DerelictSDL/sdl_img_dist/jpeg.dll (added)
- trunk/DerelictSDL/sdl_img_dist/libpng1.dll (added)
- trunk/DerelictSDL/sdl_img_dist/zlib.dll (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/DerelictSDL/Makefile
r33 r44 58 58 $(SDL.OBJ.DIR)\video.obj 59 59 60 SDLIMG.SRC.DIR = $(SDL.SRC.DIR) 61 SDLIMG.SRC = \ 62 $(SDLIMG.SRC.DIR)\image.d 63 64 SDLIMG.OBJ.DIR = $(SDL.OBJ.DIR) 65 SDLIMG.OBJ = \ 66 $(SDLIMG.OBJ.DIR)\image.obj 67 60 68 SDL.LIB = $(LIB.DIR)\derelictSDL.lib 61 69 62 DEFAULT: lib70 DEFAULT: all 63 71 64 72 clean_obj: … … 72 80 cleanall: clean clean_lib 73 81 74 lib:82 sdlonly: 75 83 @md $(SDL.OBJ.DIR) 76 dmd $(SDL.SRC) -c $(DFLAGS) $(DINC) -od$(SDL.OBJ.DIR) 77 lib $(LIBFLAGS) $(SDL.LIB) $(SDL.OBJ) 78 84 @dmd $(SDL.SRC) -c $(DFLAGS) $(DINC) -od$(SDL.OBJ.DIR) 85 @lib $(LIBFLAGS) $(SDL.LIB) $(SDL.OBJ) 86 87 sdl: 88 @md $(SDL.OBJ.DIR) 89 @dmd $(SDL.SRC) -c $(DFLAGS) $(DINC) -od$(SDL.OBJ.DIR) 90 91 sdlimg: 92 @md $(SDLIMG.OBJ.DIR) 93 @dmd $(SDLIMG.SRC) -c $(DFLAGS) $(DINC) -od$(SDLIMG.OBJ.DIR) 94 95 liball: 96 @lib $(LIBFLAGS) $(SDL.LIB) $(SDL.OBJ) $(SDLIMG.OBJ) 97 98 all: sdl sdlimg liball 99 trunk/DerelictSDL/README
r31 r44 16 16 symbol names (such as Microsoft Visual C++), or that aliases are used in the 17 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). 18 mangle the names in such a way that DerelictSDL cannot load them (at this time). 19 19 20 ------------------------------------------------------------------------------- -20 ------------------------------------------------------------------------------- 21 21 USING 22 22 -------------------------------------------------------------------------------- … … 56 56 57 57 -------------------------------------------------------------------------------- 58 Using SDLImage 59 -------------------------------------------------------------------------------- 60 SDLImage is now incorporated into DerelictSDL. Because SDL_Image has a dependency 61 upon SDL, it cannot be used in isolation. To use SDL_Image with your SDL application, 62 you first must import the derelict.sdl.image module. 63 64 ++++++++++++++++++++++++++ CODE +++++++++++++++++++++++++++++++++++++++++++++ 65 66 import derelict.sdl.image; 67 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 69 70 Before calling any SDL_Image functions, you need to make a call to 71 DerelictSDLImage_Load. This will load the shared library. 72 73 ++++++++++++++++++++++++++ CODE +++++++++++++++++++++++++++++++++++++++++++++ 74 75 // load the shared library - the try...catch block is optional of course 76 try 77 { 78 DerelictSDLImage_Load(); 79 } 80 catch(Exception e) 81 { 82 ... 83 } 84 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 86 87 From that point you can call SDL_Image functions as normal. Don't forget to make 88 sure that SDL_Image.dll is on the path. 89 90 -------------------------------------------------------------------------------- 58 91 BUILDING 59 92 -------------------------------------------------------------------------------- 60 93 61 To build DerelictSDL on Windows:94 To build DerelictSDL with SDL_Image support on Windows: 62 95 63 96 1) ensure that both dmd\bin and dm\bin are on your path 64 97 2) from a command prompt, cd to <derelict_dir>\DerelictSDL 65 3) type 'make' or 'make lib' to build derelictSDL.lib98 3) type 'make' or 'make all' to build derelictSDL.lib with SDL_Image support 66 99 4) optionally type 'make clean' to delete all object files OR 67 100 optionally type 'make cleanall' to delete all object and lib files 101 102 To build DerelictSDL without SDL_Image support on Windows: 103 104 1) ensure that both dmd\bin and dm\bin are on your path 105 2) from a command prompt, cd to <derelict_dir>\DerelictSDL 106 3) type 'make sdlonly' to build derelictSDL.lib without SDL_Image support 107 4) optionally type 'make clean' to delete all object files OR 108 optionally type 'make cleanall' to delete all object and lib files trunk/DerelictSDL/derelict/sdl/sdl.d
r43 r44 47 47 import derelict.sdl.video; 48 48 49 //============================================================================== 50 // Types 51 //============================================================================== 52 const Uint32 SDL_INIT_TIMER = 0x00000001; 53 const Uint32 SDL_INIT_AUDIO = 0x00000010; 54 const Uint32 SDL_INIT_VIDEO = 0x00000020; 55 const Uint32 SDL_INIT_CDROM = 0x00000100; 56 const Uint32 SDL_INIT_JOYSTICK = 0x00000200; 57 const Uint32 SDL_INIT_NOPARACHUTE = 0x00100000; 58 const Uint32 SDL_INIT_EVENTTHREAD = 0x00200000; 59 const Uint32 SDL_INIT_EVERYTHING = 0x0000FFFF; 60 61 //============================================================================== 62 // Functions 63 //============================================================================== 64 extern(C) 65 { 66 67 typedef int function(Uint32) pfSDL_Init; 68 typedef int function(Uint32) pfSDL_InitSubSystem; 69 typedef int function(Uint32) pfSDL_QuitSubSystem; 70 typedef int function(Uint32) pfSDL_WasInit; 71 typedef int function() pfSDL_Quit; 72 pfSDL_Init SDL_Init; 73 pfSDL_InitSubSystem SDL_InitSubSystem; 74 pfSDL_QuitSubSystem SDL_QuitSubSystem; 75 pfSDL_WasInit SDL_WasInit; 76 pfSDL_Quit SDL_Quit; 77 78 } 79 80 //============================================================================== 81 // Loader 82 //============================================================================== 49 83 private HXModule hsdl; 50 84 private bit exeModuleInited = false; … … 53 87 { 54 88 void *symbol = ExeModule_GetSymbol(hsdl, procname); 55 if( null == symbol)56 throw new Exception("Failed to load sdlproc address " ~ procname);89 if(symbol is null) 90 throw new Exception("Failed to load SDL proc address " ~ procname); 57 91 return symbol; 58 92 } … … 296 330 ExeModule_Uninit(); 297 331 } 298 299 const Uint32 SDL_INIT_TIMER = 0x00000001;300 const Uint32 SDL_INIT_AUDIO = 0x00000010;301 const Uint32 SDL_INIT_VIDEO = 0x00000020;302 const Uint32 SDL_INIT_CDROM = 0x00000100;303 const Uint32 SDL_INIT_JOYSTICK = 0x00000200;304 const Uint32 SDL_INIT_NOPARACHUTE = 0x00100000;305 const Uint32 SDL_INIT_EVENTTHREAD = 0x00200000;306 const Uint32 SDL_INIT_EVERYTHING = 0x0000FFFF;307 308 extern(C):309 310 typedef int function(Uint32) pfSDL_Init;311 typedef int function(Uint32) pfSDL_InitSubSystem;312 typedef int function(Uint32) pfSDL_QuitSubSystem;313 typedef int function(Uint32) pfSDL_WasInit;314 typedef int function() pfSDL_Quit;315 pfSDL_Init SDL_Init;316 pfSDL_InitSubSystem SDL_InitSubSystem;317 pfSDL_QuitSubSystem SDL_QuitSubSystem;318 pfSDL_WasInit SDL_WasInit;319 pfSDL_Quit SDL_Quit;
