Changeset 44

Show
Ignore:
Timestamp:
08/13/04 08:35:57 (4 years ago)
Author:
aldacron
Message:

*[DerelictSDL] added support for SDL_image via the image.d module
*[DerelictSDL] several cosmetic fixes to sdl.d
*[DerelictSDL] added the sdl_img_dist folder containing the dlls required to make use of SDL_Image
*[DerelictSDL] removed the 'lib' target in the makefile to 'sdlonly' - this builds derelictSDL.lib without SDL_Image support
*[DerelictSDL] added the targest sdl, sdlimg (which compile the sources only) liball (creates derelictSDL.lib with SDL_Image support) and all (depends upon sdl, sdlimg, and liball). The default target is now 'all'.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/DerelictSDL/Makefile

    r33 r44  
    5858    $(SDL.OBJ.DIR)\video.obj  
    5959     
     60SDLIMG.SRC.DIR = $(SDL.SRC.DIR) 
     61SDLIMG.SRC = \ 
     62    $(SDLIMG.SRC.DIR)\image.d 
     63     
     64SDLIMG.OBJ.DIR = $(SDL.OBJ.DIR) 
     65SDLIMG.OBJ = \ 
     66    $(SDLIMG.OBJ.DIR)\image.obj 
     67     
    6068SDL.LIB = $(LIB.DIR)\derelictSDL.lib 
    6169 
    62 DEFAULT: lib 
     70DEFAULT: all 
    6371     
    6472clean_obj: 
     
    7280cleanall: clean clean_lib 
    7381 
    74 lib
     82sdlonly
    7583    @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     
     87sdl: 
     88    @md $(SDL.OBJ.DIR) 
     89    @dmd $(SDL.SRC) -c $(DFLAGS) $(DINC) -od$(SDL.OBJ.DIR) 
     90     
     91sdlimg: 
     92    @md $(SDLIMG.OBJ.DIR) 
     93    @dmd $(SDLIMG.SRC) -c $(DFLAGS) $(DINC) -od$(SDLIMG.OBJ.DIR) 
     94     
     95liball: 
     96    @lib $(LIBFLAGS) $(SDL.LIB) $(SDL.OBJ) $(SDLIMG.OBJ) 
     97     
     98all: sdl sdlimg liball 
     99     
  • trunk/DerelictSDL/README

    r31 r44  
    1616symbol names (such as Microsoft Visual C++), or that aliases are used in the 
    1717DLL'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).  
     18mangle the names in such a way that DerelictSDL cannot load them (at this time). 
    1919 
    20 -------------------------------------------------------------------------------- 
     20------------------------------------------------------------------------------- 
    2121USING 
    2222-------------------------------------------------------------------------------- 
     
    5656 
    5757-------------------------------------------------------------------------------- 
     58Using SDLImage 
     59--------------------------------------------------------------------------------  
     60SDLImage is now incorporated into DerelictSDL. Because SDL_Image has a dependency 
     61upon SDL, it cannot be used in isolation. To use SDL_Image with your SDL application, 
     62you first must import the derelict.sdl.image module. 
     63 
     64++++++++++++++++++++++++++   CODE  +++++++++++++++++++++++++++++++++++++++++++++ 
     65 
     66import derelict.sdl.image;       
     67 
     68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
     69 
     70Before calling any SDL_Image functions, you need to make a call to  
     71DerelictSDLImage_Load. This will load the shared library. 
     72 
     73++++++++++++++++++++++++++   CODE  +++++++++++++++++++++++++++++++++++++++++++++ 
     74 
     75// load the shared library - the try...catch block is optional of course 
     76try 
     77{ 
     78   DerelictSDLImage_Load(); 
     79} 
     80catch(Exception e) 
     81{ 
     82   ... 
     83} 
     84 
     85++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
     86 
     87From that point you can call SDL_Image functions as normal. Don't forget to make 
     88sure that SDL_Image.dll is on the path. 
     89 
     90-------------------------------------------------------------------------------- 
    5891BUILDING 
    5992-------------------------------------------------------------------------------- 
    6093 
    61 To build DerelictSDL on Windows: 
     94To build DerelictSDL with SDL_Image support on Windows: 
    6295 
    63961) ensure that both dmd\bin and dm\bin are on your path 
    64972) from a command prompt, cd to <derelict_dir>\DerelictSDL 
    65 3) type 'make' or 'make lib' to build derelictSDL.lib     
     983) type 'make' or 'make all' to build derelictSDL.lib with SDL_Image support     
    66994) optionally type 'make clean' to delete all object files OR 
    67100   optionally type 'make cleanall' to delete all object and lib files 
     101 
     102To build DerelictSDL without SDL_Image support on Windows: 
     103 
     1041) ensure that both dmd\bin and dm\bin are on your path 
     1052) from a command prompt, cd to <derelict_dir>\DerelictSDL 
     1063) type 'make sdlonly' to build derelictSDL.lib without SDL_Image support     
     1074) 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  
    4747import derelict.sdl.video; 
    4848 
     49//============================================================================== 
     50// Types 
     51//============================================================================== 
     52const Uint32 SDL_INIT_TIMER         = 0x00000001; 
     53const Uint32 SDL_INIT_AUDIO         = 0x00000010; 
     54const Uint32 SDL_INIT_VIDEO         = 0x00000020; 
     55const Uint32 SDL_INIT_CDROM         = 0x00000100; 
     56const Uint32 SDL_INIT_JOYSTICK      = 0x00000200; 
     57const Uint32 SDL_INIT_NOPARACHUTE   = 0x00100000; 
     58const Uint32 SDL_INIT_EVENTTHREAD   = 0x00200000; 
     59const Uint32 SDL_INIT_EVERYTHING    = 0x0000FFFF; 
     60 
     61//============================================================================== 
     62// Functions 
     63//============================================================================== 
     64extern(C) 
     65{ 
     66     
     67typedef int function(Uint32) pfSDL_Init; 
     68typedef int function(Uint32) pfSDL_InitSubSystem; 
     69typedef int function(Uint32) pfSDL_QuitSubSystem; 
     70typedef int function(Uint32) pfSDL_WasInit; 
     71typedef int function() pfSDL_Quit; 
     72pfSDL_Init              SDL_Init; 
     73pfSDL_InitSubSystem     SDL_InitSubSystem; 
     74pfSDL_QuitSubSystem     SDL_QuitSubSystem; 
     75pfSDL_WasInit           SDL_WasInit; 
     76pfSDL_Quit              SDL_Quit; 
     77 
     78} 
     79 
     80//============================================================================== 
     81// Loader 
     82//============================================================================== 
    4983private HXModule hsdl; 
    5084private bit exeModuleInited = false; 
     
    5387{ 
    5488    void *symbol = ExeModule_GetSymbol(hsdl, procname); 
    55     if(null == symbol) 
    56         throw new Exception("Failed to load sdl proc address " ~ procname); 
     89    if(symbol is null) 
     90        throw new Exception("Failed to load SDL proc address " ~ procname); 
    5791    return symbol; 
    5892} 
     
    296330        ExeModule_Uninit(); 
    297331} 
    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;