How can i read gaming steering wheel input in delphi?
I have a steering wheel connected to my computer..开发者_JAVA百科. My problem is that i want to get the state of the accelerator how much % is pressed...can i do this in delphi? how can i communicate with the device ? do you know any tutorials ?
If it is a HID then perhaps this lib is useful Human Interface Device controller suite
If your steering wheel is connected via USB, it probably interfaces with your system using the standard USB Hid device class.
For help with delphi and USB Hid device class, look at this question.
I have no experience with steering wheels, but I suppose the acceleration value is just an axis value of one of the possible six axes of a standard joystick. If so, then you can do with any joystick component which supports multiple axes (maybe Jedi's TJvJoystick, no experience with). Or try this simple one, set the Advanced
property to True
and add the following handler to the OnMove
event to find out which axis is the acceleration pedal:
procedure TForm1.NLDJoystick1Move(Sender: TNLDJoystick;
const JoyPos: TJoyRelPos; const Buttons: TJoyButtons);
begin
LabelX.Caption := FloatToStr(JoyPos.X);
LabelY.Caption := FloatToStr(JoyPos.Y);
LabelZ.Caption := FloatToStr(JoyPos.Z);
LabelR.Caption := FloatToStr(JoyPos.R);
LabelU.Caption := FloatToStr(JoyPos.U);
LabelV.Caption := FloatToStr(JoyPos.V);
end;
精彩评论