Jump to content

SDL UDF


Recommended Posts

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

Link to comment
Share on other sites

@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
Link to comment
Share on other sites

  • 1 month later...

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?

Link to comment
Share on other sites

  • 1 month later...

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
Link to comment
Share on other sites

AdmiralAlkex, Neither links are working for me.

The one on post #44 works for me. Maybe it was just temporarily "confused", please try to click it again.
Link to comment
Share on other sites

  • 2 weeks later...

@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
Link to comment
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?

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

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]

Link to comment
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! ;)

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