Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

MRX-Gamepad-Core

A modern, lightweight gamepad input handler for Delphi VCL & FireMonkey (FMX) using SDL3. It features a background polling thread, visual UI mapping, deadzone configuration, and rumble support.

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

MRX-Gamepad-Core

A modern, lightweight gamepad input handler for Delphi VCL & FireMonkey (FMX) using SDL3. It features a background polling thread, visual UI mapping, deadzone configuration, and rumble support.

🎮 MRX Gamepad Core (Delphi / FMX / VCL / SDL3) alpha v0.1

Status: 🚧 Work in Progress / Prototype. Core functionality works, but API might change.
Sure some to do still, but a good start :)

Guaranteed bugs to play with :D

Unbenannt

✨ Features

pascal
SDL3 Dynamic Binding: No static .lib files needed. Just drop the SDL3.dll next to your .exe.
Threaded Polling: Runs input detection in a background thread to keep your UI smooth.
Thread-Safe Events: Gamepad events are safely marshaled to the main UI thread using TThread.Queue.
Multi-Gamepad Support: Supports up to 4 connected gamepads simultaneously.
Rumble Support: Trigger haptic feedback (low/high frequency motors) for any connected pad.
Visual Settings UI: 
    Drag-and-drop style click-to-map interface for buttons.
    Visualizes analog stick movement directly on the UI.
    Adjustable Deadzones with visual indicators.
Profile Management: Save and load controller mappings to .ini files.
Event Throttling: Optimized to prevent event flooding from analog stick micro-movements.

📦 Requirements

pascal
Delphi 10.x or newer (uses modern generics and anonymous threads).
FireMonkey (FMX) framework.
SDL3.dll (Place it in your project's output directory).

🚀 Sample Project
Project and compiled .exe are included in this repository. Tested with win32 and win64 and following controllers:

pascal
XInput: EasySMX X05 Pro
DInput: EasySMX ESM-9124

🗺️ Todos

pascal
Fix gamepad hot-plugging (disconnect/reconnect handling).
Implement a proper data dictionary for mappings (instead of parsing UI label text).
Add separate trigger deadzones.
And many more sure :D

🤝 Contributing

This is a work in progress. If you find bugs or want to improve the code (especially the SDL3 pointer logic), feel free to open a Pull Request or an Issue! 📜 License

MIT License. See LICENSE file for details. (Note: SDL3 itself is licensed under the zlib license).

SDL3 from: [https://github.com/libsdl-org/SDL](https://github.com/libsdl-org)

If you want to tip me a coffee.. :)

🎮 Skia4Delphi Games (each one file, no ext engine):
2D JumpnRun Platformer https://github.com/LaMitaOne/Skia_PlatformerGame
2D MegaCatling (Megaman platformer/shooter) https://github.com/LaMitaOne/Skia-MegaCatling
2D Lemmings/Worms/Portal/Touch hybrid https://github.com/LaMitaOne/SkiaLemmings
2D Side-scrolling space shooter https://github.com/LaMitaOne/SkiaStarPatrols
2D Tetris clone https://github.com/LaMitaOne/Skiatris
2D Skia Powder (Falling Sand Simulation) https://github.com/LaMitaOne/Skia-Powder
2D BombRunner (Bomberman clone) https://github.com/LaMitaOne/SkiaBombRunner
2D Skia Micro Racers https://github.com/LaMitaOne/SkiaMicroRacers
2.5D C&C style isometric rts https://github.com/LaMitaOne/Skia-RTS-Game
2.5D Isometric cat game https://github.com/LaMitaOne/Skia-A-Cats-Life
2.5D Raycasting doom base https://github.com/LaMitaOne/SkiaDoomBase
2.5D Voxel Raycasting Comanche https://github.com/LaMitaOne/Skia-Voxel-Comanche
3D better go to https://github.com/castle-engine