Results 1 to 7 of 7

Thread: Joystick things

  1. #1
    Guest
    How can I get values of min and max values for x and y coordinates?

    I can't use DirectX so have to be API. I found a couple of functions, joyGetPos, joyGetPosEx, joyGetDevCaps or something like that. The Caps thingy seems to be what I need but all I can get with it is the driver name (which is Microsoft's default with Win98SE).

    Thanks for advance,

  2. #2
    Junior Member
    Join Date
    Feb 2000
    Location
    Gig Harbor, WA, USA
    Posts
    25
    Min and Max X and Y values for Joysticks are always 0-65535. I wrote a Joystick module and a wrapper OCX using the JoyGetDevCaps function.

    There are two ways to get joystick input via the API, one is with the calls you mentioned, and the other is to capture them, via Windows Messages. There are cons to both.

    If you use the API, you have to use a loop, which can consume a ton of CPU. Using the Messages route eliminates the CPU overload (because it uses quazi-events), but requires subclassing, I think. Also, the Messages route doesn't let you get info on the R, U, and V axises, which can be bad, as a good joystick has at least 4 axises built in (X, Y for positioning, Z for rudder, and R for throttle).

    You can find out more about Joystick stuff in the MSDN Library which should have come with VB. It's C documentation, but if you don't have the experience to convert it to VB, you probably don't have the experience to use it anyway. It's under Platform SDK\Multimedia Input\Joysticks\.

    If you need more help, please don't email me, instead, reply to this message.
    (¯`·.¸¸.·´¯`·->Cromas<-·´¯`·.¸¸.·´¯)
    Teenage Programmer
    Formerly known as ShadowCrawler

    E-Mail: [email protected]
    ICQ: 9872708
    AIM: VotchOut

  3. #3
    Guest
    I don't have the MSDN library, my VB is 4 Pro. I've programmed quite long with it, so I think I've the experience. Somewhy I just don't get the values. Here's a part of my code:

    Code:
    Global MinX As Integer, MinY As Integer, MaxX As Integer, MaxY As Integer
    
    Sub OnLoad()
        Dim PadInfo As JOYCAPS
        Dim B As Integer
        For B = 0 To 256
            Call joyGetDevCaps(B, PadInfo, 256)
            MinX = (PadInfo.wXmax - PadInfo.wXmin) / 4
            MinY = (PadInfo.wYmax - PadInfo.wYmin) / 4
            MaxX = MinX * 3
            MaxY = MinY * 3
            Buttons = PadInfo.wNumButtons
            Settings.Caption = PadInfo.szPname
            Settings.Caption = Settings.Caption & "... - Pad Mouse"
            Debug.Print MinX & " | " & MaxX & " - " & MinY & " | " & MaxY
        Next B
    End Sub
    As you see, I tried to search for values (B). All it does is to return zeros. I haven't yet looked for all the values in the JOYCAPS, but those should be the ones, I think.

    Thanks,

  4. #4
    Junior Member
    Join Date
    Feb 2000
    Location
    Gig Harbor, WA, USA
    Posts
    25
    I have sent you an email with my module, it should do everything you need, and if it doesn't, it should show everything you need to know to do what you want to do.
    (¯`·.¸¸.·´¯`·->Cromas<-·´¯`·.¸¸.·´¯)
    Teenage Programmer
    Formerly known as ShadowCrawler

    E-Mail: [email protected]
    ICQ: 9872708
    AIM: VotchOut

  5. #5
    Guest
    It doesn't work. There's no Enum in VB4 and when I changed the values to Const, I get error 165 (Invalid parameters). So I just use Min and Max values of my own like I've done this far.

  6. #6
    Junior Member
    Join Date
    Feb 2000
    Location
    Gig Harbor, WA, USA
    Posts
    25
    I can write a .DLL in either VB or Delphi, if you'd like.
    (¯`·.¸¸.·´¯`·->Cromas<-·´¯`·.¸¸.·´¯)
    Teenage Programmer
    Formerly known as ShadowCrawler

    E-Mail: [email protected]
    ICQ: 9872708
    AIM: VotchOut

  7. #7
    Guest
    No need to. I don't need the exact/real values, because the program I'm writing is mainly for gamepads and for "my own use". And first I wanted to make the prog in "the correct" way.

    The program makes mouse cursor movable with a pad so my mother can use our computer too. She's VERY bad with mouse and she is...how could I say it...not stupid but...silly? Just can't learn how to use mouse.


    You can do the dll if you really really want to of course

    Thanks for your help,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width