Marzac / le3d

A straightforward and easy to use 3D software renderer for real-time retro graphics.
https://marzac.github.io/le3d/
MIT License
60 stars 6 forks source link

Gamepad support on MacOS #14

Open Marzac opened 6 years ago

Marzac commented 6 years ago

One of the most and only missing feature from the MacOS port is the gamepad support. At the moment, gamepads (XBOX 360 USB and lookalike) are supported on both Windows and Unix OS.

The support is done with some very native code, with XInput for Win and evdev for Linux. It provides gamepads enumeration, scanning of joysticks and buttons and support of rumble (force feedback) in a platform independent way.

The gamepad class should be written for MacOS and I have yet no idea where to start.

I have had a look at the SFML code: https://github.com/SFML/SFML/blob/master/src/SFML/Window/OSX/JoystickImpl.cpp https://github.com/SFML/SFML/blob/master/src/SFML/Window/OSX/HIDInputManager.mm

But I must admit I don't understand much what is happening there.

Marzac commented 6 years ago

I made a stub class as I don't want to see #ifdefs (for platform specifics) in examples code.

Marzac commented 6 years ago

Another inspiration could be: https://github.com/glfw/glfw/blob/master/src/cocoa_joystick.m

Marzac commented 6 years ago

I think there is no chance to implement this without including some Objective-C classes and do some specific Apple MacOS programming. This is nothing I want / will do, therefore help would be appreciated!