[SDL] Re: DDraw -> SDL how to port ?

Santiago Romero compiler at iname.com
Sat Apr 22 02:13:43 PDT 2000


El Fri, 21 Apr 2000 17:53:29 +0100, Ben Campbell escribió:

>> Yes, thats  correct but what  I want to  do is what  LokiGames (for
>> example) does, too : The 2D  Engine is written with DirectDraw an I
>> want to port it to SDL, so  that the Engine can be used under Linux
>> or BeOS...

>As a starting point, go through each directdraw call or structure and
>look up an SDL equivalent.

>For  example,  ddraw  surfaces  can be  replaced  with  SDL_Surfaces,
>replace ddraw  blit functions with  SDL ones etc... Lots  of scanning
>though the ddraw and SDL docs is probably on the cards too :-)

 I also use an (I hope) reasonable coding style based on encapsulation.
 Try to extract all the O.S. or library dependent functions out of your
 code. Put it in external .C files and create your own MACROS and
 FUNCTIONS (depending on the overhead) such as BlitGraphics instead
 of the Win Blit or the SDL Blit. Use that BlitGraphics on all your
 code (maybe it's just a macro and there is no overhead, or maybe
 is a function but the PUSH/CALL/RET takes no overhead compared to
 the code executed into the function). The results? You can change
 ALL the code by just changing the macro/function and recompile: this
 avoids to scan ALL the code: just edit the graphics C file containing
 the encapsulated functions and structures and change them. You can
 also (of course :) reuse that encapsulation scheme on future programs.
 You can too have different encapsulation files for each O.S. or
 library, you know what I mean.

 CU!
-- 

 Salu2!

Error de Windows 98- Se ha encontrado un rutina correcta!!

 ------------------------------------------------------------ __ ----
|  NoP / Compiler          --      compiler @ iname,com |    /oo\    |
|-------------------------------------------------------|    (\/)    |
|  POWERED BY - Linux RedHat 6.0  -  Reg. User #74.821  |   / __ \   |
|             http://www.ctv.es/USERS/sromero           |  |\    /|  |
|                                                       |__OO __ OO__|
 --------------------------------------------------------------------



More information about the SDL mailing list