AdmiralAlkex Posted May 11, 2009 Posted May 11, 2009 (edited) Ladies, gentlemens, nerds or whatever you are, I present to you, my SDL UDF!Q. So what is this then?A. It is a "wrapper" for the SDL.dll and some "help libraries" to make it easier to use in AutoIt.Q. WTF is SDL?A. As their webpage says: "Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer."Q. Can it really do all that?A. No. I have implemented many functions, but not all. I will update it on my own discretion.Q. So what does WORK?A. See the table below.Q. So how do I use it?A1. Read README.TXT in the archive. A2. There is a few examples in the download, study them.A3. Find any example or documentation for another language and translate it (shouldn't be to hard).Q. So where's the download?A. Next post. Edited October 24, 2009 by AdmiralAlkex JScript and Xandy 2 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
AdmiralAlkex Posted May 12, 2009 Author Posted May 12, 2009 (edited) Some screenshots: (notice the transparent Opera/AutoIt png image)Bugs:The _SDL_*Color() draw strange colors (_SDL_*RGBA() works fine).See notes in scripts for more details and broken functions.ToDo:Lots.Q. What licence does it use?A. Read README.TXT in the archive.Download:SDL v14 ½.zip(previous downloads= ???+117+68+40+9+5)(old uploads can be found here)If the above link doesn't work, try links from post #44 or Edited September 15, 2012 by AdmiralAlkex Xandy 1 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
JRSmile Posted May 12, 2009 Posted May 12, 2009 sounds great, maybe you can force development a bit in the direction of threads and 2d framebuffer just as a little hint ;P $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
AdmiralAlkex Posted May 12, 2009 Author Posted May 12, 2009 (edited) Well I am not sure how to even begin with the threads, or what they would be useful for. 2d graphics would be great, I just need to get alot better at structs and that kind of stuff unless some kind person want to help some Edited May 12, 2009 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
AdmiralAlkex Posted May 15, 2009 Author Posted May 15, 2009 YES!! I have managed to both read and draw single pixels + draw rectangles + load and draw BITMAPS!! (monoceres helped alot). Preliminary speed tests are quite good too. I will release a big update as soon as I get some functions to draw primitives to work + have written some examples. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
JRSmile Posted May 15, 2009 Posted May 15, 2009 sounds great, looking forward to hearing from you $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
AdmiralAlkex Posted May 17, 2009 Author Posted May 17, 2009 (edited) I just uploaded v6. The include have about 2.5 times the lines of code with about 3 times the functions. It now totals 1379 lines/160 funcs. You will notice alot of video functions implemented + the SDL_gfx.dll for drawing alot of prototypes (uninteresting fact, there are 5 functions for drawing a filled box, 1 from SDL, 2 from me, 2 from gfx). I also implemented most of the "window management" functions, even the most worthless ever: SDL_WM_ToggleFullScreen (a cookie to the one who knows why). Edit: Oh yeah, the initialization routines changed so old scripts will not work without modifications. Edited May 17, 2009 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
ProgAndy Posted May 17, 2009 Posted May 17, 2009 (edited) I have to say this is a Great UDF! And here is the working WM_GetCaption expandcollapse popupFunc _SDL_WM_GetCaption() Local $aResult = DllCall($__SDL_DLL, "none:cdecl", "SDL_WM_GetCaption", "ptr*", 0, "ptr*", 0) Local $aTemp[2]=[__SDL_PtrStringRead($aResult[1]), __SDL_PtrStringRead($aResult[2])] Return $aTemp EndFunc ;=============================================================================== ; ; Function Name: __SDL_PtrStringLen ; Description:: Gets length for a string by pointer ; Parameter(s): $ptr - Pointer to String ; $IsUniCode - Is a unicode string default. False ; Requirement(s): libmysql.dll ; Return Value(s): Length of the string ; Author(s): Prog@ndy ; ;=============================================================================== ; Func __SDL_PtrStringLen($ptr, $IsUniCode = False) Local $UniCodeFunc = "" If $IsUniCode Then $UniCodeFunc = "W" Local $Ret = DllCall("kernel32.dll", "int", "lstrlen" & $UniCodeFunc, "ptr", $ptr) If @error Then Return SetError(1, 0, -1) Return $Ret[0] EndFunc ;==>__SDL_PtrStringLen ;=============================================================================== ; ; Function Name: __SDL_PtrStringRead ; Description:: Reads a string by pointer ; Parameter(s): $ptr - Pointer to String ; $IsUniCode - Is a unicode string default. False ; Requirement(s): libmysql.dll ; Return Value(s): read string ; Author(s): Prog@ndy ; ;=============================================================================== ; Func __SDL_PtrStringRead($ptr, $IsUniCode = False, $StringLen = -1) Local $UniCodeString = "" If $IsUniCode Then $UniCodeString = "W" If $StringLen < 1 Then $StringLen = __SDL_PtrStringLen($ptr, $IsUniCode) If $StringLen < 1 Then Return SetError(1, 0, "") Local $struct = DllStructCreate($UniCodeString & "char[" & ($StringLen + 1) & "]", $ptr) Return DllStructGetData($struct, 1) EndFunc ;==>__SDL_PtrStringRead I also implemented most of the "window management" functions, even the most worthless ever: SDL_WM_ToggleFullScreen (a cookie to the one who knows why). It is just worthless for Windows. This functions works on *nix with X11 //Edit: Yeah i got the cookie. Thanks. I WANT MORE Edited May 17, 2009 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
AdmiralAlkex Posted May 17, 2009 Author Posted May 17, 2009 (edited) I have to say this is a Great UDF! And here is the working WM_GetCaption Thank you ProgAndy, but I just get a empty string? Do you have a working example so I can see what I am missing? It is just worthless for Windows. This functions works on *nix with X11Right, and AutoIt is for windows, soo it's totally pointless.... here you go - [insert picture of enormous cookie here] - Edit: Oh I get it, WM_GetCaption only returns something if you changed from the default first Edit2: I will include you code in the next update Edited May 17, 2009 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
AdmiralAlkex Posted May 25, 2009 Author Posted May 25, 2009 Update uploaded. Changes: Implemented _SDL_WM_GetCaption() posted by ProgAndy Split include into one file for each dll and rearranged the regions. Changed initialization routines. Implemented functions/macros/vars from version.h, cpuinfo.h, error.h and timer.h Lots of other "minor" stuff too.... .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
JRSmile Posted May 26, 2009 Posted May 26, 2009 thanks for your hard work alredy done at this project already using it :-) but maybe you could adapt the examples to work with the current release ? $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
AdmiralAlkex Posted May 26, 2009 Author Posted May 26, 2009 (edited) thanks for your hard work alredy done at this project already using it :-) but maybe you could adapt the examples to work with the current release ?Which examples are you referring to? Edit1: Oh right, I forgot to update the examples in the archive . I will fix that in the next update (should be tonight or tomorrow) but until then you can safely change line #11 to "#Include "SDL v8.au3"" and it will work. Joystick and CDROM funcs have not been changed since the initial release.Edit2: And add #include "SDL_gfx v1.au3" to the other one.... Edited May 26, 2009 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
AdmiralAlkex Posted May 28, 2009 Author Posted May 28, 2009 (edited) New update uploaded.Added MutexesAdded SDL_image.dllThis makes it possible to very easily use jpg and many other formats, including transparent png.Added new example that shows how to use SDL_image + DirectX.Please note that DirectX is considered unstable (that's why SDL is using Windib by default). Also it's only using hardware acceleration when using fullscreen (I think).Please note that neither of this should be any problem, Windib is usually more than enough for 2D graphics.Edit1: I just noticed the download was missing 2 files, it will be fixed in a minute.Edit2: Fixed. Edited May 28, 2009 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
TomCat Posted May 29, 2009 Posted May 29, 2009 can you give me a hint how to use SDL_WarpMouse() and SDL_GetMouseState() ?
AdmiralAlkex Posted May 29, 2009 Author Posted May 29, 2009 (edited) @TomCatSure, here you have:(attachments removed, they have been included in sdl.zip for a long time)SDL_Example_WarpMouse.au3 (1.05K) Number of downloads: 231SDL_Example_Get_Relative_MouseState.au3 (2.03K) Number of downloads: 214While writing the examples I saw that all 3 of them (including GetRelative...) wasn't working as intended, but in the bottom of the examples is the fixed functions. The fixes (and probably the examples) will be in the next update. Edited April 26, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
TomCat Posted May 29, 2009 Posted May 29, 2009 (edited) it works well some next question ^^ is it also possible to use this functions also in some games ? and if yes how ?^^ Edited May 29, 2009 by TomCat
AdmiralAlkex Posted May 29, 2009 Author Posted May 29, 2009 (edited) it works well some next question ^^ is it also possible to use this functions also in some games ? and if yes how ?^^Do you mean you want to use them in a window not created by the script itself? Like a bot for Diablo2? If so then I am afraid the answer is no, SDL doesn't have that functionality for the simple reason that it was created to build cross-platform multimedia apps, not controlling windows in Windows (that sounded weird). You probably need MouseMove() and MouseGetPos(). Edited May 29, 2009 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Zisly Posted May 29, 2009 Posted May 29, 2009 Wow, this sounds nice! I'll check it out for sure, nice work!
AdmiralAlkex Posted May 30, 2009 Author Posted May 30, 2009 (edited) Here is a example that creates a AutoIt gui and then uses SDL to draw a transparent PNG as a background.P.S. A cookie to the one who knows where the quotes in the MsgBox is from (attachment removed, it has been included in sdl.zip for a long time)SDL_Example_Transparent_PNG_on_AutoIt_GUI.au3 (1.55K)Number of downloads: 292 Edited April 26, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Roman9 Posted May 31, 2009 Posted May 31, 2009 My guess is Starcraft? Also, thanks for this UDF! Amazing! I'm loving AutoIt more and more as I browse these forums.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now