Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++CodeDelphiRAD StudioTech Partner

Add Instant Joystick Support Using The Winsoft Controller Library In Delphi on Windows

Winsoft’s Controller is a XInput API controller SDK. XInput a universal joystick controller for Windows 7, 8, 10.

In the Windows platform, you can use other joysticks, such as PlayStation Dual-Shock Controller, Nintendo Switch Pro Controller and Steam Controller if you don’t have a XBOX joystick controller.

Winsoft Controller Installation

Installed in less than a minute!

Steps:

  1. Go to https://www.winsoft.sk/controller.htm for the download link.
  2. Download the trial version.
  3. Install Controller.exe
  4. Find Winsoft’s Controller installed in C:\Program Files (x86)\Winsoft\Controller\ and example in C:\Program Files (x86)\Winsoft\Controller\Examples\Delphi\Demo.dproj.
  5. If you want to add Winsoft’s DirectX path controller, go to Language > Delphi > Library >
Adding X Box Controller Library Path to Delphis Library Path

Setting up the XBOX Controller

Prior to starting, go to Control Panel > Devices and Printers.

  1. Right-click on the joystick icon.
  2. Go to Game controller settings.
  3. Ensure status is OK.

If the status is not OK, please install the XBOX redistributable framework 4.0 and DirectX 9.0 run-time.

Ensure your XBox 360 Controller is correctly recognized by Windows

Quick Joystick Support

I have made changes to the Delphi Stater Kit game Alien Invasion.

I first drag and drop the TController from the (1) component palette to form (2).

Adding Joystick Controller support is as easy as drag and drop from Component Palette to FireMonkey Form

I then add code to get button press data from Controller.Buttons and respond to btUp as a Key-Up event.

Loading and Saving Controller Settings

Adding Joystick Controller Support

In order to load Joystick controller settings, I load ControllerIndex. If the setting is more than 1 (i.e, 0 = (none), 1 = Device 0), I enable the Joystick Controller, or else, Joystick is disabled.

In order to save controller setting, I save the ControllerIndex.

The GIT repository for the Alien Invasion modifications to work with Winsoft Controller is at https://github.com/PolywickStudio/DelphiAlienInvasion

Winsoft sells the full-version at their website.

  • Works with: Delphi, C++Builder, FMX, VCL
  • Works on: Windows 32-bit, Windows 64-bit

Conclusion:  In less than 30 lines of code, I have demonstrated adding Joystick support to your game. WINSOFT saves game-development time. 

Check out the full WINSOFT Controller for Delphi and C++Builder.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Technical Director at Polywick Studio. I have over 10+ years of experience using Delphi. I am a member of the Add-in-Express ADX Team, I developed ZPAY Payroll System, made using Delphi.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Worth reading...
Enterprise Component Pack 2020 Details

IN THE ARTICLES