Jump to content

SDL UDF


Recommended Posts

I'll try to make use this for a little game, let's see how fast it is :D

I haven't done any serious benchmark's but It should be faster than GDI+ :D (and it's easier to use when you learned it).

Please tell me if you would like any special benchmark's or examples created ;)

Edited by AdmiralAlkex
Link to comment
Share on other sites

I think I get it :D

Little example of what I got :D

#include "SDL v10.au3"
#include "SDL_image v1.au3"

_SDL_Init_image()
_SDL_Init($_SDL_INIT_EVERYTHING)

$Surface = _SDL_SetVideoMode(640, 480, 32, $_SDL_SWSURFACE)

$map = StringSplit(FileRead("map.txt"), ',')
$ii=0

For $i = 1 To $map[0]
    $Loaded1 = _IMG_Load("C:\Documents and Settings\lars\Desktop\AutoIt Game (SDL TEST)\Sprites\" & $map[$i] & '.bmp')
    _SDL_BlitSurface($Loaded1, 0, $Surface, _SDL_Rect_Create($ii, 96, 32, 32))
    $ii +=32
Next
_SDL_Flip($Surface)

While 1
WEnd


_SDL_Quit()
_SDL_Shutdown_image()

Any faster way I could do that? ;)

And is _SDL_Flip really function is a bit misleading lol, (the name) is it really done to show the rendered things?

Edited by Zisly
Link to comment
Share on other sites

Well I don't have those images and the txt but it looks alright to me :D .

About _SDL_Flip(), it's actually for "flipping" the screen buffers when using doublebuffered (hardware?) rendering. When used like in your script it's the same as _SDL_UpdateRect($Surface, 0, 0, 0, 0)

Link to comment
Share on other sites

P.S. A cookie to the one who knows where the quotes in the MsgBox is from :D

It's from Startrek... It was the vulcans motto. I think it was first said by Spock in the first series ever produced.

Regarding your SDL library... YOU DID A GREAT JOB!

I have been waiting for this since I joined the forums back in 2006 and saw on the first page of Autoit's website "Feaures: bla bla bla... you can make games calling the SDL library... bla bla bla". I think they erased that part when, in jan 2008, I actually asked for an example here

Keep up the good work! I'll most likely want someday to make a game.

Thx!

Edited by madflame991
Link to comment
Share on other sites

Ohh, why did i propose PtrStringRead for SDL_WM_GetCaption? I just found a way to do it without this func: you can use str*, too.

;Written by ProgAndy
Func _SDL_WM_GetCaption()
    Local $aResult = DllCall($__SDL_DLL, "none:cdecl", "SDL_WM_GetCaption", "str*", 0, "str*", 0)
    Local $aTemp[2]=[($aResult[1]), ($aResult[2])]
    Return $aTemp
EndFunc

*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

Link to comment
Share on other sites

any chance to hook an existing directx game and display test as overlay via SDL?

Edited by JRSmile
$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:-)
Link to comment
Share on other sites

  • 1 month later...

@All

New update uploaded.

Implemented SDL_sprig:

Advanced library dealing with 2D graphics, Surfaces and more.

Implemented SDL_sge:

More basic library dealing with 2D graphics, and more.

Updated SDL_gfx:

Implemented functions for controlling framerate (tested and 100% working)

Lots of other things done:

Fixed SDL_WarpMouse()

Added new _SDL_WM_GetCaption() from Progandy

Fixed _SDL_SaveBMP_RW()

New example: SDL Example Convert Image to BMP.au3 (loads any image in the usual formats and spit out a bmp)

+Lots of minor(ish) things. Run your favourite file comparing utility and check for yourself if you are curious :(

Please note that SDL_sprig and SDL_sge was (mostly) automatically converted by a tool I built and not by me. That means that the local variable-names look like crap, but it saved me a shitload amount of time to not have to write around 200 funcs. I will try to find a way to clean them up in a future update.

Download is as usual in second post.

@madflame991

You won the cookie! Swing by my place next time you go to Sweden and I will buy you the biggest one I can find :(

P.S. Did you see the reference in SDL.au3? It's not really hidden, but you need to have seen VOY to get >_<

@ProgAndy

Thank you, it's really nice to see some contributions. This function is included with V.11 and forward.

@JRSmile

Not that I know off, SDL was created to make games, not interface with them.

Link to comment
Share on other sites

Is seems 2 of the examples in the download gives errors on "duplicate funcitons". If you get that open THE EXAMPLE and remove those funcs. They are leftovers from v10.

And remember that "q" is for exiting the scripts with a SDL gui so you don't panic when you run "SDL Example WarpMouse.au3" >_<

Link to comment
Share on other sites

I didn't notice the update until now :(

I just gotta test the UDF later today :D

Well there wasn't anything spectacular, both sge and sprig is mainly for primitives. I highly recommend sprig if you are into that kind of things, it has loads of more options (and a bit better speed to) than the others.

Next update will probably be released next week, and should (if nothing unexpected happens) have sound and events implemented. More details when that day come >_< .

You know, I could send you a message when I update it if you want, just add the hotmail-address in my profile to your Live Messenger :( . I am online almost every day.

Link to comment
Share on other sites

That's not really needed. There already exist an OpenGL UDF written by trancexx.

Wow thanks see me and liek 20 other guys from auto it are trying to start on and cretes the first 3d Game in autoit, we have done 3d games(Bad Graphics) in C++ Etc, never improved on them so we think we know the concept just neede to find out how to load 3d objects you helped TY

My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Link to comment
Share on other sites

Wow thanks see me and liek 20 other guys from auto it are trying to start on and cretes the first 3d Game in autoit, we have done 3d games(Bad Graphics) in C++ Etc, never improved on them so we think we know the concept just neede to find out how to load 3d objects you helped TY

Maybe you should look at the Au3IrrLicht too, it's quite impressive for being free and all.
Link to comment
Share on other sites

great job with this, its coming along greatly! i really consider using this from now on as a replacement of gdi+.

tho running your png in gui example, ive come to an issue. where would i be able to specify were on the gui to draw the image

Edited by Suirad
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...