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?
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?
Hi, it's me again. I have one suggestion with SDL2_image:
I had to change line 56 from
toCode:IMG_LibName = 'libSDL_image-2.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.Code:IMG_LibName = 'libSDL_image.so';
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
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:
My keyboard handling function now looks like that:Code:type PKeyStateArr = ^TKeyStateArr; TKeyStateArr = array[0..65000] of UInt8;
If one checks a key one has to use the SDL scancodes.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;
For example
Maybe that's also interesting for Jarrod ...Code:if keystate (SDL_SCANCODE_RIGHT) then begin inc (x); end;
Best regards,
Cybermonkey
@Cybermonkey
Very cool. I will use your implementation, thanks.
Last edited by drezgames; 02-11-2013 at 12:16 PM.
Sorry for annoying again, but I just noticed that SDL_hints.h is not ported, yet. Anyone still working on that headers?
Best regards,
Cybermonkey
No one? So I did it myself ... Has anyone access to the github repository and can upload a file named "sdlhints.inc" ? This should be the content
You will have to include it in sdl2.pas.Code:type TSDL_Char = PChar; const SDL_HINT_FRAMEBUFFER_ACCELERATION = 'SDL_FRAMEBUFFER_ACCELERATION'; SDL_HINT_RENDER_DRIVER = 'SDL_RENDER_DRIVER'; SDL_HINT_RENDER_OPENGL_SHADERS = 'SDL_RENDER_OPENGL_SHADERS'; SDL_HINT_RENDER_SCALE_QUALITY = 'SDL_RENDER_SCALE_QUALITY'; SDL_HINT_RENDER_VSYNC = 'SDL_RENDER_VSYNC'; SDL_HINT_VIDEO_X11_XVIDMODE = 'SDL_VIDEO_X11_XVIDMODE'; SDL_HINT_VIDEO_X11_XINERAMA = 'SDL_VIDEO_X11_XINERAMA'; SDL_HINT_VIDEO_X11_XRANDR = 'SDL_VIDEO_X11_XRANDR'; SDL_HINT_GRAB_KEYBOARD = 'SDL_GRAB_KEYBOARD'; SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = 'SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS'; SDL_HINT_IDLE_TIMER_DISABLED = 'SDL_IOS_IDLE_TIMER_DISABLED'; SDL_HINT_ORIENTATIONS = 'SDL_IOS_ORIENTATIONS'; SDL_HINT_XINPUT_ENABLED = 'SDL_XINPUT_ENABLED'; SDL_HINT_GAMECONTROLLERCONFIG = 'SDL_GAMECONTROLLERCONFIG'; SDL_HINT_ALLOW_TOPMOST = 'SDL_ALLOW_TOPMOST'; SDL_HINT_DEFAULT = 0; SDL_HINT_NORMAL = SDL_HINT_DEFAULT + 1; SDL_HINT_OVERRIDE = SDL_HINT_NORMAL + 1; function SDL_SetHintWithPriority(name, value: TSDL_Char; priority: Uint32): TSDL_Bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetHintWithPriority' {$ENDIF} {$ENDIF}; function SDL_SetHint(name, value: TSDL_Char): TSDL_Bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetHint' {$ENDIF} {$ENDIF}; function SDL_GetHint(name: TSDL_Char): TSDL_Char; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetHint' {$ENDIF} {$ENDIF}; procedure SDL_ClearHints; cdecl;external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearHints' {$ENDIF} {$ENDIF};
Best regards,
Cybermonkey
I want to thank you (all contributors) for the SDL 2.0 headers!
Finally I was able to handle focus changing, keyboad input, game controllers etc.
A great relief!
Bookmarks