Jump to content

GamePadEx UDF


Shafayat
 Share

Recommended Posts

As the title suggests, with this UDF library, you can receive all sorts of input from an standard GamePad.

I had one logitech USB gamepad and it Works great with it.

I've added lots of samples. They are almost everything you'll ever need when working with a gamepad.

Features

  • X,Y,Z,R,U,V Axis
  • GPExGetAxisEx command makes it easy to get direction and speed.
  • get POV (Point of View)
  • Get Buttons (API-ish. you don't even need to remember button values)

ToDo

  • Vibration
  • SciTE highlighting

History

7/11/2010 > First release

Comments/Suggestions are very much welcome.

Regards

Shafayat

GamePadEx.zip

[Not using this account any more. Using "iShafayet" instead]

Link to comment
Share on other sites

Very cool. Nice job. Works fine with my Cordless Rumblepad 2 :blink:

Link to comment
Share on other sites

Thanks for commenting guys.

I know that there are other udfs that lets you get GamePad inputs. But when you'll try all of them out, you'll find this one much more standard and easy to use. Besides, you don't have to manually learn how to process the data, Let the udf do the messy stuffs. Taking a look at the samples will suffice.

[Not using this account any more. Using "iShafayet" instead]

Link to comment
Share on other sites

Very cool. Maybe I can integrate this into joytunes (control itunes with gamepad/joystick) as some point (providing you don't mind)

Edit:Removed quote

Edited by FuryCell
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Ok, so I got bored? This sample was modified to cause mouse movements based on the Left Analog stick. (On mine anyway).

Haha, fun stuff. :blink:

#include "GamePadEx.au3"
#include <Constants.au3>
#Include <WinAPI.au3>

HotKeySet("{ESC}", "_Quit") ; Just for the demo

Global $myGamePadHandle = GPExInitialize() ; Get a handle. This doesn't have to be global but needs to be passed to all the other functions.
Global $myID = 0 ; We want to monitor the default GamePad

While 1
    Sleep(10)
    $testrawdata = GPExGetRawData($myGamePadHandle, $myID) ; Get almost every data possible from the gamepad. Returns in an array with 8 elements.
    ;
    ; Display the RAW output.
    ; --->
    ; ---> Resize the console area so that you can have all the outputs and then move the gamepad. <---
    ; --->
    ConsoleWrite(@CRLF & "==========================================================")
    ConsoleWrite(@CRLF & "[0]" & $testrawdata[0]) ; X Axis
    ConsoleWrite(@CRLF & "[1]" & $testrawdata[1]) ; Y Axis
    ConsoleWrite(@CRLF & "[2]" & $testrawdata[2]) ; Z Axis
    ConsoleWrite(@CRLF & "[3]" & $testrawdata[3]) ; R Axis
    ConsoleWrite(@CRLF & "[4]" & $testrawdata[4]) ; U Axis
    ConsoleWrite(@CRLF & "[5]" & $testrawdata[5]) ; V Axis
    ConsoleWrite(@CRLF & "[6]" & $testrawdata[6]) ; Point of View
    ConsoleWrite(@CRLF & "[7]" & $testrawdata[7]) ; Buttons
    ConsoleWrite(@CRLF & "==========================================================")
    If $testrawdata[0] > 32767 Then
        _WinAPI_Mouse_Event($MOUSEEVENTF_MOVE, ($testrawdata[0] - 32767)/4000)
    EndIf
    If $testrawdata[1] > 32767 Then
        _WinAPI_Mouse_Event($MOUSEEVENTF_MOVE, 0, ($testrawdata[1] - 32767)/4000)
    EndIf
    If $testrawdata[0] < 32767 Then
        _WinAPI_Mouse_Event($MOUSEEVENTF_MOVE, -(32767 - $testrawdata[0])/4000)
    EndIf
    If $testrawdata[1] < 32767 Then
        _WinAPI_Mouse_Event($MOUSEEVENTF_MOVE, 0, -(32767 - $testrawdata[1])/4000)
    EndIf
WEnd

Func _Quit()
    GPExTerminate($myGamePadHandle) ; Just for good manners.
    Exit
EndFunc   ;==>_Quit
Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

Here's links to the other UDF's I know about, if anyone is curious:

_Joystick.au3 (take the code form post #4)

Joystick.au3

SDL.au3

Note that the one by elgabionline doesn't work in it's current state, but the others is fine. I prefer my own UDF of course, since among other things, it's the most advanced one (it can get the device's name :blink:)

#Include "SDL.au3"

_SDL_Init($_SDL_INIT_JOYSTICK)

For $X = 0 To _SDL_NumJoysticks() -1
    ConsoleWrite("Joystick " & $X & ": " & _SDL_JoystickName($X) & @CRLF)
Next
Link to comment
Share on other sites

I prefer my own UDF of course, since among other things, it's the most advanced one (it can get the device's name )

- You like embedding the SDL dll file and increasing the size? :blink:

Then, maybe I'll try and use DirectX to get Game Input Device's name. lol ;) . All the computers have directX installed. So, you won't even have to embed anything if directX is used. But implementing it might be a bit tricky though. Gonna look into it in a few days.

[Not using this account any more. Using "iShafayet" instead]

Link to comment
Share on other sites

I don't think an extra 243 KB is the end of the world, after all AutoItSC.bin is 631 KB, so if you want low size you shouldn't be using AutoIt at all.

And SDL reads the name from the registry, so that's easy as pie to get. Or so I imagine, maybe I will give it a try later tonight... :blink:

Link to comment
Share on other sites

  • 1 month later...

Is it really so hard to give us any information about your problem so we can help you instead of give wild guesses? Do you really run around IRL and shouts "How do I use, How do I use, How do I use??" all the time? I hope not.

Now write down a nice post where you tell us exactly what is happening, and what your question really is, and we can go from there.

Also test the other 2 udf's I listed above.

Edit:

Wow, that's helpful. You're not in tech support, by any chance?

Oh yeah, like you were more helpful when you gave us nothing to work on. At least I gave a valid answer that was the most likely cause of the scripts not working. Edited by AdmiralAlkex
Link to comment
Share on other sites

That post is a little more constructive, but the tone could be less offputting. If we got off on the wrong foot because you inferred some criticism in my question, "How do I use it," please don't - there wasn't any. It was a neutral question.

My problem is this:

I downloaded the package, GamePadEx, extracted it into its own folder.

I double clicked the GamePadEx.au3 file, with an xbox controller attached to my pc (as always), and nothing happened.

I opened up each of the *.au3 files, to see if there was any instructions on configuration needed, and didn't see anything I understood.

I'm a newbie to AutoIt, so it may be that getting this working is not plug-and-play and requires a level of technical expertise I don't have yet. I don't mind if that is the case. So I asked how to use it, to find out if that was the case.

Is there more information you need?

Edited by MeMeMe
Link to comment
Share on other sites

  • 9 years later...
  • Moderators

arcade_extreme,

As the OP has not been here for the past 11 years, you may be waiting a long time for a response.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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