Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: SDL 2.0 for Pascal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    SDL 2.0 for Pascal

    I'm writing Pascal-Headers for SDL 2.0, this is my repo:

    https://github.com/ev1313/Pascal-SDL-2-Headers/

    Actually I've translated:


    • "sdl.h",
    • "sdl_main.h",
    • "sdltype_s.h",
    • "sdl_stdinc.h",
    • "sdl_events.h",
    • "sdl_keyboard.h",
    • "sdl_keycode.h",
    • "sdl_scancode.h",
    • "sdl_mouse.h",
    • "sdl_video.h",
    • "sdl_pixels.h",
    • "sdl_surface.h",
    • "sdl_rwops.h",
    • "sdl_blendmode.h",
    • "sdl_rect.h",
    • "sdl_joystick.h",
    • "sdl_touch.h",
    • "sdl_gesture.h",
    • "sdl_error.h",
    • "sdl_version.h",
    • "sdl_render.h"


    I'll not translate the headerfiles:

    • "sdl_opengl.h",
    • "sdl_opengles.h"
    • "sdl_opengles2.h"

    Because you should use the dglopengl.pas from delphigl.com:

    http://wiki.delphigl.com/index.php/Archiv:dglOpenGL

    It supports all OpenGL Versions (1.0 to 4.4 30.07.2013) and is updated if there's a new Version.

  2. #2
    Will you implement statically linking in your headers? I think this is one of the most benefits of SDL2 over SDL1.2 ...

    EDIT: Maybe I do something wrong but I got this errors on Linux:
    fpc "sdl2.pas" -Sd (im Verzeichnis: /home/markus/Projekte/SDL2Pas/Pascal-SDL-2-Headers-master)Kompilierung fehlgeschlagen.
    Free Pascal Compiler version 2.6.2 [2013/02/16] for i386
    Copyright (c) 1993-2012 by Florian Klaempfl and others
    Target OS: Linux for i386
    Compiling sdl2.pas
    sdl2.pas(5555,26) Error: Identifier not found "TXEvent"
    sdl2.pas(5555,26) Error: Error in type definition
    sdl2.pas(5582,27) Error: Identifier not found "PDisplay"
    sdl2.pas(5582,27) Error: Error in type definition
    sdl2.pas(5583,25) Error: Identifier not found "TWindow"
    sdl2.pas(5583,25) Error: Error in type definition
    sdl2.pas(5593,27) Error: Identifier not found "TWindow"
    sdl2.pas(5593,27) Error: Error in type definition
    sdl2.pas(5594,27) Error: Identifier not found "TWindow"
    sdl2.pas(5594,27) Error: Error in type definition
    sdl2.pas(5927,1) Fatal: There were 10 errors compiling module, stopping
    Fatal: Compilation aborted
    Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
    Must I include X11?

    EDIT2: Yes, that helps:
    Code:
    {$IFDEF LINUX}    
      uses  X,xlib;
       {$ENDIF}
    Last edited by Cybermonkey; 31-07-2013 at 10:25 AM. Reason: Answered my own question ...
    Best regards,
    Cybermonkey

    Pulsar2D framework:
    http://pulsar2d.org

  3. #3
    thanks for this hint with linux, i fixed this. But everything else is working? would be good to know (since my linux vm was destroyed by a virus ;( ).

    Sorry, but i don't know how to implement statically linking. May you can help me?

  4. #4
    Hi, it's me again. I have one suggestion with SDL2_image:
    I had to change line 56 from
    Code:
       IMG_LibName = 'libSDL_image-2.so';
    to
    Code:
       IMG_LibName = 'libSDL_image.so';
    that it works on Linux. I don't know if that's an issue with (K)Ubuntu only. I also comiled SDL2 and SDL2_image from source maybe that's the crux of the matter.
    Anyway, thanks for your work with the Pascal SDL2 headers. I am now porting my Lua interpreter to SDL2 using your headers. When can we expect SDL2_net?
    Best regards,
    Cybermonkey

    Pulsar2D framework:
    http://pulsar2d.org

  5. #5
    Another thing to mention is that it's rather difficult to use SDL_GetKeyboardState with Pascal (since it needs an array). I looked into the old JEDI headers and they had a helper TYPE for that. I used it the same way:
    Code:
    type PKeyStateArr = ^TKeyStateArr;  
    TKeyStateArr = array[0..65000] of UInt8;
    My keyboard handling function now looks like that:
    Code:
    function keystate (key:integer):boolean;
    var state:pkeystatearr;
    begin
      SDL_Pumpevents();
      state:=pkeyStateArr(SDL_Getkeyboardstate(nil));
      if state[key]<>0 then
      begin
      Result:=True;
      end
      else
      Result:=False;
    end;
    If one checks a key one has to use the SDL scancodes.
    For example
    Code:
    if keystate (SDL_SCANCODE_RIGHT) then begin
            inc (x);
        end;
    Maybe that's also interesting for Jarrod ...
    Best regards,
    Cybermonkey

    Pulsar2D framework:
    http://pulsar2d.org

  6. #6
    @Cybermonkey
    Very cool. I will use your implementation, thanks.
    Last edited by drezgames; 02-11-2013 at 12:16 PM.

  7. #7
    Hi,

    sorry for not answering, i'm working on it

    I'll add your changes to my repository.

    Thanks.

  8. #8
    Ah, thanks! I even registered at the DGL community and wanted to ask you there. Any chance of iOS/Android support soon?
    Best regards,
    Cybermonkey

    Pulsar2D framework:
    http://pulsar2d.org

  9. #9
    Quote Originally Posted by Cybermonkey View Post
    Ah, thanks! I even registered at the DGL community and wanted to ask you there. Any chance of iOS/Android support soon?
    If i get the time. I even have a Android Handy now

    But DGL is good, there i'm way more active ^^.

  10. #10
    That would be nice. I've got a tablet and want to play my own games on it ...
    Best regards,
    Cybermonkey

    Pulsar2D framework:
    http://pulsar2d.org

Page 1 of 2 12 LastLast

Tags for this Thread

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
  •  
Comodo SSL