top of page

Divine Headboards

Public·95 members

How to Use Winsoft DirectX Joystick Component for Delphi and C++ Builder


How to Use Winsoft DirectX Joystick Component for Delphi and C++ Builder




If you want to add joystick support to your Delphi or C++ Builder applications on Windows, you can use the Winsoft DirectX Joystick component. This component allows you to retrieve joystick position and status for any keys, using the DirectX API. It also supports rudder pedals, flight yokes, and other devices that use up to six axes of movement, a point-of-view hat, and 32 buttons.




Winsoft DirectX Joystick v3.9 for Delphi C Builder 5 – 10.3 Full Source


Download File: https://www.google.com/url?q=https%3A%2F%2Furlca.com%2F2tJXTp&sa=D&sntz=1&usg=AOvVaw2RTX5JndYL-fgxWjntVrGR



In this article, we will show you how to install and use the Winsoft DirectX Joystick component for Delphi and C++ Builder 5 - 10.3. You can download the trial version or purchase the full source code from https://www.winsoft.sk/dxjoystick.htm.


Installation




To install the Winsoft DirectX Joystick component, follow these steps:


  • Run the setup file and follow the instructions.



  • Open Delphi or C++ Builder and go to Component -> Install Packages.



  • Click on Add and browse to the folder where you installed the component.



  • Select the package file that matches your IDE version (e.g. DXJoystickD26.bpl for Delphi 10.3).



  • Click on Open and then OK.



  • You should see the Winsoft DirectX Joystick component in the Winsoft tab of the Component Palette.



Usage




To use the Winsoft DirectX Joystick component, follow these steps:


  • Drop a TDXJoystick component on your form.



  • Use the ControllerCount property to get the number of available controllers.



  • Use the ControllerName property to get the name of each controller.



  • Use the Controller property to set the index of the controller you want to use (starting from 0).



  • Use the Active property to activate or deactivate the controller.



  • Use the Capabilities property to get the minimum and maximum values for each axis (X, Y, Z, R, U, V) and button (1 - 32).



  • Use the PositionX, PositionY, PositionZ, PositionR, PositionU, PositionV properties to get the current position of each axis.



  • Use the PressedButtons property to get a set of pressed buttons.



  • Use the OnChange event to handle changes in joystick position or status.



Example




The following example shows how to display joystick information on a form with labels, progress bars, and color boxes. You can also download a demo example from https://www.winsoft.sk/dxjoystick.htm.


// Delphi code


uses


DXJoystick;


var


FJoystick: TDXJoystick;


procedure TForm1.FormCreate(Sender: TObject);


var


I: Integer;


begin


FJoystick := TDXJoystick.Create(Self);


FJoystick.OnChange := JoystickChange;


for I := 0 to FJoystick.ControllerCount - 1 do


if FJoystick.Attached[I] then


ComboBox.Items.Add(FJoystick.ControllerName[I]);


end;


procedure TForm1.ComboBoxChange(Sender: TObject);


var


MinX, MaxX, MinY, MaxY: Integer;


begin


FJoystick.Controller := ComboBox.ItemIndex;


FJoystick.Active := True;


MinX := FJoystick.Capabilities.MinX;


MaxX := FJoystick.Capabilities.MaxX;


MinY := FJoystick.Capabilities.MinY;


MaxY := FJoystick.Capabilities.MaxY;


ProgressBarR.Min := FJoystick.Capabilities.MinR;


ProgressBarR.Max := FJoystick.Capabilities.MaxR;


ProgressBarU.Min := FJoystick.Capabilities.MinU;


ProgressBarU.Max := FJoystick.Capabilities.MaxU;


ProgressBarV.Min := FJoystick.Capabilities.MinV;


ProgressBarV.Max := FJoystick.Cap e0e6b7cb5c


About

Welcome to the group! You can connect with other members, ge...

bottom of page