Results 1 to 9 of 9

Thread: SDL on Delphi XE2

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    The problem might be unicode-releated. You pass strings as PChars, but since XE2 is unicode, a char now has a size of 2 Bytes (codepage + char) instead of 1 Byte that it had in earlier versions. So try to pass the filenames different, e.g. cast as ansistring or some type where char size is 1, which SDL obviously expects.

    Some more explanation : Since a Char in Uncide now has two bytes, for SDL your filename will look like this : "M Y F I" instead of "MyFile" due to codepages being stored with each char.

    So you'll e.g. have to do something like this : Graphic := SDL_LoadBMP(PAnsiChar(sFile)), depending how sFile is declared.

  2. #2
    I solve it

    I change all PChar(xxx) for PChar(AnsiString(xxx)) and now work Ok.

    Thanks.
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

  3. #3
    Hi again.

    Now I can compile my projects in Win32 and Win64, but I like port to iOS and MacOSx.

    Mac OSx
    When I active Platform OSx I have this error in SDL.pas:
    Code:
    [DCC Fatal Error] sdl.pas(318): F1026 File not found: 'Windows.dcu'
    
    317 {$IFDEF WINDOWS}
    318   Windows;
    319 {$ENDIF}
    I'm compile for platform OSx but compiler think I'm compile to Windows.
    How I can tell compiler that I am compiling for Mac OSx and not for Windows ?


    iOS

    When you select iOS and export to Xcode, game is compiled for Xcode in Mac by FPC 2.6.0 and I need SDL.pas in Mac.
    When install in Mac "fpc-2.6.0.intel-macosx.pkg" from "FireMonkey-iOS.dmg" image, JEDI-SDL has installed in:
    Code:
    /Developer/Embarcadero/fpc/packages/sdl
    but I do not know how add library path to use it when compile with Xcode.
    Is there something like "Library" of Delphi where you can indicate paths for search *. pas ?

    For test, I copy SDL.pas from "/Developer/Embarcadero/fpc/packages/sdl/src/SDL.pas" to my project folder but I have next error:
    Code:
    Target OS: Darwin/iPhoneSim fro i386
    Compiling /Users/...../Naves.pas
    Compiling /Users/...../sdl.pas
    Fatal: Can't find unit x used by sdl
    Fatal: Compilation aborted
    I think problem is at line 311 of sdl.pas:
    Code:
    300{$IFDEF UNIX}
    301  {$IFDEF FPC}
    302  pthreads,
    303  unixtype,
    304  baseunix,
    305  {$IFNDEF GP2X}    
    306  unix,
    307  {$ELSE}
    308  unix;
    309  {$ENDIF}
    310  {$IFNDEF GP2X}
    311  x,
    312  xlib;
    313  {$ENDIF}
    314  {$ELSE}
    315  Libc,
    316  Xlib;
    317  {$ENDIF}
    318{$ENDIF}

    Compiler think I'm compile for GP2x ?
    How I can tell compiler that I am compiling for iOS and not for GP2X ?

    Thanks.
    Last edited by kotai; 11-06-2012 at 12:03 PM.
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

  4. #4
    The SDL headers are not really optimized for Delphi XE2 and I think for it to work on Mac OS X, you will to tweak a few compiler conditions in JEDI-SDL.inc. If I remember correctly, if compiled with Delphi on desktop machines, it assumes Windows is used as its platform.

    With SDL 1.2 on iOS you have two problems:
    - SDL 1.2 does not work on iOS, you need SDL 1.3/2.0 (try these headers: https://github.com/Stoney-FD/sdl13-pascal <-- They worked for me in the past (Disclaimer: I wrote them), but are pretty much alpha, if not pre-alpha)
    - You can't link against dynamic libraries
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  5. #5
    Thanks for reply.

    ¿ SDL in iOS can't link against dynamic libraries ?
    I download by mercurial SDL2.0 from
    http://hg.libsdl.org/SDL and I build in xcode file library "libSDL2.a"
    ¿ I can't work like windows and put in project folder the library "libSDL2.a" ?

    If I can't complile for MacOS, no problem, but I like port my games to iOS.

    Have you a small example in free pascal for test SDL in iOS ?

    Thanks.
    www.kotai.es
    www.remakesonline.com -> Nemesis Online & Bubble Bobble Online & Castlevania Online & Penguin Adventure Online
    www.miniracingonline.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •