Sign in to follow this  
Followers 0
AdmiralAlkex

SDL UDF

90 posts in this topic

Silly me :huggles:

For anyone that saw this comment:

Note1 = The _SDL_*Color funcs doesn't paint the right colors.

You can safely IGNORE IT.

I was only testing it the wrong way. It works fine if you use 0xRRGGBBAA :D

To make a solid red, use :0xFF0000FF

To make a solid green, use :0x00FF00FF

To make a semi-transparent blue, use :0x0000FF80

Share this post


Link to post
Share on other sites



#62 ·  Posted (edited)

@ALL

I have been experimenting with something that would greatly simplify distribution for the UDF.

The idea is to have the dll file included as binary in the include, and in the beginning of the *Init() func, check if the file exist and create it if it doesn't.

This would mean that you would never have to package any dll, and the total filesize would be smaller (in compiled form).

Working with source would be easier too. Copy include and you're done!

What do you think?

Makes sense?

Doesn't make sense?

Am I crazy?

Am I hungry? (actually yes I am)

Here's something for you to test so you see what I mean:

1. Download the updated SDL.au3

2. Download the "blob" containing the dll

3. Run a test script, like this:

#include "SDL.au3"
ConsoleWrite("FileExist(SDL.dll) says: " & FileExists("SDL.dll") & @CRLF)
_SDL_Init($_SDL_INIT_EVERYTHING)
ConsoleWrite("FileExist(SDL.dll) says: " & FileExists("SDL.dll") & @CRLF)
_SDL_Quit()

4. Pay attention to the ConsoleWrite. Neat, right? :D

(attachment removed, it's worthless without the "blob" (damn upload site that keeps deleting my files for no obvious reason), if it isn't in the next release, you could probably rebuild it in minutes anyway, or just ask me for the code)

SDL.au3 (52.35K)

Number of downloads: 162

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

Português

Olá pessoal,

preciso saber como enviar o pressionamento de um botão no joystick, pois o jogo "street fighter 4" o player 2 não tem comandos no teclado.

Alguém sabe me ajudar?

Translate by google

Inglês

Hello everybody,

need to know how to send the push of a button on the joystick, because the game "street fighter 4" player 2 has no controls on the keyboard.

Someone help me know?

Share this post


Link to post
Share on other sites

@AdmiralAlkex

SDL can't do that, it's for creating games, not automating them.

Obrigado,

mas você tem alguma idéia de como fazê-lo?

thanks,

but you have any idea how to do it?

Share this post


Link to post
Share on other sites

#67 ·  Posted

If I am using _SDL_GuiCreate to construct a gui, how do I reposition the gui to the center of my screen? Currently, it is in the top left hand corner.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#68 ·  Posted (edited)

You could set where the window should be created by setting the environment variable "SDL_VIDEO_WINDOW_POS", like this:

EnvSet("SDL_VIDEO_WINDOW_POS", 0 & ", " & 0)
The first number is X, and second Y. Don't forget the comma between them. Note that SDL read the environment variables when you do _SDL_Init(), so set them before that or nothing will happen.

Then there's always WinMove() (but that wouldn't look good, would it?) or you could create a normal AutoIt window and let SDL use that with SDL_WINDOWID. See the script "SDL Example Transparent PNG on AutoIt GUI.au3" for that.

And remember, controls ARE windows, so you could create a label or something, get it's handle and pass that to SDL_WINDOWID.

Just get the sizes right or things will get really weird.

Big :idea: EDit:

I was a bit bored so I wrote this half-crazy example:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include "SDL.au3"


Local $GX = 640, $GY = 480
$hWnd = GUICreate(@ScriptName, $GX, $GY, 0, 0)
EnvSet("SDL_WINDOWID", $hWnd)
_SDL_Init($_SDL_INIT_VIDEO)

$pSurface = _SDL_SetVideoMode($GX, $GY, 0, $_SDL_SWSURFACE)     ;Just for some variation
_SDL_FillRect($pSurface, 0, 0xFF0000)
_SDL_Flip($pSurface)
GUISetState()

Do
    Sleep(10)
Until GUIGetMsg() = -3
_SDL_Quit()
GUIDelete($hWnd)


Local $GX = 320, $GY = 240
$hWnd = GUICreate(@ScriptName, $GX*2, $GY*2, @DesktopWidth/2 - $GX, @DesktopHeight/2 - $GY)
$hWnd2 = GUICtrlGetHandle(GUICtrlCreateLabel("", 30, 10, $GX, $GY))
EnvSet("SDL_WINDOWID", $hWnd2)
_SDL_Init($_SDL_INIT_VIDEO)

$pSurface = _SDL_SetVideoMode($GX, $GY, 0, $_SDL_SWSURFACE)     ;Just for some variation
_SDL_FillRect($pSurface, 0, 0x00FF00)
_SDL_Flip($pSurface)
GUISetState()

Do
    Sleep(10)
Until GUIGetMsg() = -3
_SDL_Quit()
GUIDelete($hWnd)


Local $GX = 640, $GY = 480
EnvSet("SDL_WINDOWID", "")
EnvSet("SDL_VIDEO_WINDOW_POS", @DesktopWidth -$GX & ", " & @DesktopHeight -$GY)
_SDL_Init($_SDL_INIT_VIDEO)

$pSurface = _SDL_GuiCreate(@ScriptName, $GX, $GY, 32, $_SDL_SWSURFACE)
_SDL_FillRect($pSurface, 0, 0x0000FF)
_SDL_Flip($pSurface)

While 1
    Sleep(10)
WEnd

Please note that that script doesn't seem to close itself properly sometimes (not sure why) so you may want to check your task manager after running it.

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

#72 ·  Posted (edited)

@yehia

Sorry buddy, missed you there a couple of days.

SDL_gfx can flip a surface, see description on the official website (do a search in page for "Rotozoomer").

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

Well no, not from me anyway. I wouldn't even know where to begin.

How would you expect that to work anyway? Every frame gets loaded to separate surfaces? Wouldn't it be just as easy (and use less disk-space) to use multiple .png files?

Share this post


Link to post
Share on other sites

Can someone update the link lol

Share this post


Link to post
Share on other sites

I'm getting an error from both links.

The second one from post 44 is giving me this.

Du har försökt att ladda en sida på Passagens medlemsserver som inte finns. Det kan bero på :

* Den angivna adressen är felaktig. Kontrollera stavningen och försök igen.

* Medlemmen uppdaterar sidan. Försök igen senare.

Du kommer att dirigeras om till Passagens f�rstasida om n�gra sekunder

Till Passagen


[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites

Ignore the popup, the linked page should start the download. You could try downloading with another browser.

Some extra mirrors:

Some Swedish file upload site

My desktop (online at random times)

I have intentions to create a more "permanent" solution, but that will not happen right now.

It's pizza time! ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0