Jump to content



Photo

SDL UDF


  • Please log in to reply
84 replies to this topic

#21 Zisly

Zisly

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 252 posts

Posted 25 June 2009 - 07:31 PM

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





#22 AdmiralAlkex

AdmiralAlkex

    I'm on a boat

  • MVPs
  • 4,490 posts

Posted 25 June 2009 - 08:15 PM

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, 25 June 2009 - 08:17 PM.


#23 Zisly

Zisly

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 252 posts

Posted 25 June 2009 - 08:20 PM

I think I get it :D

Little example of what I got :D

Plain Text         
#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, 25 June 2009 - 08:22 PM.


#24 AdmiralAlkex

AdmiralAlkex

    I'm on a boat

  • MVPs
  • 4,490 posts

Posted 25 June 2009 - 09:21 PM

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)

#25 Zisly

Zisly

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 252 posts

Posted 25 June 2009 - 09:28 PM

Ok :D
Working on a tile based game just for fun now, the hard part will be rendering the character :D

#26 AdmiralAlkex

AdmiralAlkex

    I'm on a boat

  • MVPs
  • 4,490 posts

Posted 25 June 2009 - 09:45 PM

Doesn't sound very hard to me :D .
Ah well you know where to find me if you need help :D

#27 Zisly

Zisly

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 252 posts

Posted 26 June 2009 - 01:00 AM

Seems pretty fast if you load everything before starting rendering :D

#28 madflame991

madflame991

    Wayfarer

  • Active Members
  • Pip
  • 97 posts

Posted 26 June 2009 - 05:06 PM

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, 26 June 2009 - 05:24 PM.


#29 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 26 June 2009 - 06:32 PM

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* Posted Image [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

#30 Zisly

Zisly

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 252 posts

Posted 26 June 2009 - 06:38 PM

Edit: Solved, was pretty easy :D

Edited by Zisly, 27 June 2009 - 01:40 AM.


#31 JRSmile

JRSmile

    IT infrastructure specialist

  • Active Members
  • PipPipPipPipPipPip
  • 453 posts

Posted 27 June 2009 - 10:46 AM

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

Edited by JRSmile, 27 June 2009 - 10:46 AM.

$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:-)Try2Hack: http://www.try2hack.nl/levels/level13-olwehfdow.xhtml

#32 AdmiralAlkex

AdmiralAlkex

    I'm on a boat

  • MVPs
  • 4,490 posts

Posted 02 August 2009 - 06:14 AM

@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.

#33 AdmiralAlkex

AdmiralAlkex

    I'm on a boat

  • MVPs
  • 4,490 posts

Posted 05 August 2009 - 06:22 PM

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" >_<

#34 Zisly

Zisly

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 252 posts

Posted 07 August 2009 - 04:27 AM

I didn't notice the update until now >_<
I just gotta test the UDF later today :(

#35 AdmiralAlkex

AdmiralAlkex

    I'm on a boat

  • MVPs
  • 4,490 posts

Posted 07 August 2009 - 05:00 AM

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.

#36 liten

liten

    Adventurer

  • Active Members
  • PipPip
  • 104 posts

Posted 07 August 2009 - 01:36 PM

OMG i will love you forever if you add 3d
My UDF:Freeze.au3-Freeze values like CE, ML, ETC

#37 AdmiralAlkex

AdmiralAlkex

    I'm on a boat

  • MVPs
  • 4,490 posts

Posted 07 August 2009 - 03:03 PM

OMG i will love you forever if you add 3d

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

#38 liten

liten

    Adventurer

  • Active Members
  • PipPip
  • 104 posts

Posted 07 August 2009 - 03:06 PM

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

#39 AdmiralAlkex

AdmiralAlkex

    I'm on a boat

  • MVPs
  • 4,490 posts

Posted 07 August 2009 - 03:11 PM

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.

#40 Suirad

Suirad

    Seeker

  • Active Members
  • 39 posts

Posted 09 August 2009 - 05:21 AM

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, 09 August 2009 - 05:21 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users