Easily DirectX Support with VCL In C++Builder On Windows
It is surprisingly easy to add joystick support to your VCL In C++Builder app on Windows. Here is third party Delphi and C++ Builder component from WINSOFT for retrieving joystick position and status for any keys.
You can use wired or wireless joystick for your application like games, audio/video players and other application. I have tested this delphi component on a recent Windows 10. All functionality corresponds to the declared. All buttons my joystick successful detected. Also works analog sticks. Now let’s view this demo (included to instalation packages)
The first thing you need to do is install component to Delphi. It’s very fast and simple! Look this video.
Demo included to component package. Now let’s look at the stages of working with a component.
# 1 stage – Enumerate controlers
for I := 0 to FJoystick.ControllerCount - 1 do
if FJoystick.Attached[I] then
ComboBox.Items.Add(FJoystick.ControllerName[I]);
# 2 stage – Connect to controler and get value ranges
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.Capabilities.MaxV;
ProgressBarZ.Min := FJoystick.Capabilities.MinZ;
ProgressBarZ.Max := FJoystick.Capabilities.MaxZ;
# 3 stage – Now we can read current values from controller anytime.
if FJoystick.Active then
begin
SetColor(ColorBoxButton5, joButton5 in FJoystick.PressedButtons);
SetColor(ColorBoxButton6, joButton6 in FJoystick.PressedButtons);
SetColor(ColorBoxButton7, joButton7 in FJoystick.PressedButtons);
SetColor(ColorBoxButton8, joButton8 in FJoystick.PressedButtons);
SetColor(ColorBoxButton9, joButton9 in FJoystick.PressedButtons);
SetColor(ColorBoxButton10, joButton10 in FJoystick.PressedButtons);
SetColor(ColorBoxButton11, joButton11 in FJoystick.PressedButtons);
SetColor(ColorBoxButton12, joButton12 in FJoystick.PressedButtons);
SetColor(ColorBoxButton13, joButton13 in FJoystick.PressedButtons);
SetColor(ColorBoxButton14, joButton14 in FJoystick.PressedButtons);
SetColor(ColorBoxButton15, joButton15 in FJoystick.PressedButtons);
SetColor(ColorBoxButton16, joButton16 in FJoystick.PressedButtons);
ProgressBarR.Value := FJoystick.PositionR;
ProgressBarU.Value := FJoystick.PositionU;
ProgressBarV.Value := FJoystick.PositionV;
end;
The component uses the DirectX API. Extended capabilities also provide support for rudder pedals, flight yokes, and other devices that use up to six axes of movement, a point-of-view hat, and 32 buttons.
This component has both versions for FireMonkey and for VCL In C++Builder applications to Delphi / C ++ Builder 10 – 10.4.
Works with: Delphi, C ++ Builder, RAD Server, FireMonkey, VCL
Works on: Windows 32-bit, Windows 64-bit
Source code included in registered version. Royalty free distribution with application without any limitation.
Related links
Here is packages for VCL and Firemonkey:
Joystick
Joystick for FireMonkey
DirectX Joystick
DirectX Joystick for FireMonkey
Code Faster and Smarter with VCL on C++Builder
Smart developers and Agile software teams write better code faster using modern OOP practices and C++Builder’s robust frameworks and feature-rich IDE.
- Spend less time waiting for lengthy compiles with our highly optimized modern C++ compilers for Windows and iOS
- Code Insight™ delivers code-completion based on your code and used libraries to help you code quickly and accurately plus customize the IDE to meet your coding style.
- Get native, high-speed direct access to InterBase, SQLite, MySQL, SQL Server, Oracle, PostgreSQL, DB2, SQL Anywhere, Advantage DB, Firebird, Access, Informix, MongoDB, and more.
- Get hints and tips from inline documentation as you write code
- Utilize popular libraries such as Boost, Eigen, and ZeroMQ plus leverage a broad range of community tools and libraries.
- Integrate with version control systems including Git, Subversion and Mercurial
