|
-
Nov 23rd, 2000, 01:54 PM
#1
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,
-
Nov 23rd, 2000, 05:49 PM
#2
Junior Member
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
-
Nov 24th, 2000, 04:21 AM
#3
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,
-
Nov 24th, 2000, 11:35 AM
#4
Junior Member
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
-
Nov 25th, 2000, 01:15 PM
#5
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.
-
Nov 25th, 2000, 04:45 PM
#6
Junior Member
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
-
Nov 26th, 2000, 10:26 AM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|