HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.96k stars 432 forks source link

Rename FlxJoystick to FlxGamepad / input package structure #529

Closed Gama11 closed 11 years ago

Gama11 commented 11 years ago

FlxJoystick is quite misleading, as this is actually the class for gamepad support, not for joysticks. Same for related classes like FlxJoyButton and FlxJoystickManager. The problem with renaming it that a class named FlxGamePad already exists, and I can't really think of a better name for it. It's an on-screen gamepad for mobile devices, FlxOnScreenGamepad seems a bit too long.

Besides, the input package should be reorganized. Some subpackages like touch or gamepad would make a lot of sense. The question is, should the same be done for categories where there's only one class, like a mouse package for FlxMouse?

I think the current FlxGamePad should also be moved to flixel.addons.ui.

Tiago-Ling commented 11 years ago

Maybe we can change them in this way:

FlxJoystick -> FlxGamepad FlxGamepad -> FlxVirtualPad (or FlxVirtualpad)

impaler commented 11 years ago

'misleading' not so much, since its using the native joystick api which in turn supports buttons and multiple joysticks. As far as I see it the thing that makes a gamepad is the fact it entirely fits in your hand and may have multiple joysticks. My preference is that FlxJoystick should be left alone since it uses the SDL joystick api and instead think about the gamepads themselves. Maybe a gamepad package would be more helpful for the button ID maps for ps3/xbox/ouya. I agree FlxVirtualPad sounds easier to understand for touch controls.

Gama11 commented 11 years ago

@impaler I don't see how this is not misleading, considering that gamepads and joysticks are entirely different peripherals. Not sure about the name of the API, but that shouldn't matter to the end user.

I agree, I was thinking about adding more keycodes as well. That's one of the reasons why I'm suggesting a gamepad package.

impaler commented 11 years ago

Its not misleading because this is a well known legacy name in apis that gamepads use to get support on native targets. The only logic I can see to use Gamepad as the name, is the fact that gamepads are probably more common than joysticks. The api supports both device types, the data we get to use just has more or less joysticks and or buttons.

Its not uncommon to get Gamepad support under the guise of the name "joystick" even in the OS, I use Joystick Mapper on osx to get ps3 controller working and MotionInJoy on windows.

A more important task in the longer term maybe for flixel devs to support the real end users with an input mapping ui. A reusable class for end users to setup their own preferences in a gui would be great.