Open MCMrARM opened 7 years ago
Maybe a higher level API like SDL?
@guppy42 I'm not fully sure if I want to include SDL only for gamepads though?
Is it really hard to compile with evdev?
I'm right now trying to get something working with evdev, but no promises (yet).
I did some experimenting with this on the gamepad-support
branch and this commit:
https://github.com/MCMrARM/mcpelauncher-linux/commit/5986a61369e3d4e279cefc63b5309ea4591ceda8
I plan on implementing support for the sdl gamepad mappings and this currently might work on some gamepads (the pad for which my mappings were done was a Xbox One pad).
SDL mappings look not compatible with evdev though.
When this cool enhancement could materialize? I tried it with my Xbox 360 controller that works fine with for example retropie but here no movement or action is detected even though i am using the right branch.
Hello, @MCMrARM can you tell me how extacly function feedButtom/Trigger/Stick work?
Buttons that MCPE supports https://github.com/MCMrARM/mcpelauncher-linux/blob/8e0d035f062df06c13a1cfd925a631982b5271cf/src/gamepad.h#L10-L21
feedButton(int gamepadIndex, int buttonId, int state, bool unknown) - state afaik can be only 1 (pressed) or 0 (released) feedStick(int gamepadIndex, int stickId, int flags, float axisX, float axisY) - afaik there can be only 2 sticks (from what I remember: 0 - the left one on xbox controller, used for movement, 1 - the right one used for camera), flags determine whether axis x or axis y should be updated, use 3 to update both (it's a bitmask so probably 1 will be axis x, and 2 will be axis y, or the reverse). feedTrigger(int gamepadIndex, int triggerId, float value) - in my code I used two triggers, I think it's self explainatory
The float values are in the range 0.f-1.f.
You'll also want to use setGameControllerConnected to notify MCPE about a controller connection/disconnection.
I tried to add splitscreen support but unfortunately only one splited screen renders and the other one is blue. I don't know why is this the case, but looks like no split screen multiplayer for us :(
@MCMrARM I suppose that is not fully implemented on android
I am using an xbox 360 wireless gamepad and I noticed that analog sticks' deadzones don't exist. My gamepad is old so its analog sticks don't return precisely to the center; as a result my character moves even when I am doing nothing. This isn't an issue when I move the character but I can't aim precisely at a certain player/block and this isn't good for PvP or competitive games. @MCMrARM
Hmm, there is a deadzone of 0.1, I guess I should make it a larger value.
I think you should make it configurable. Hardcoding, the value would be a pain in the *** for compatibility with generic and non-generic controllers
I'd like to have gamepad support. Implementing gamepad support with MCPE is pretty trivial, but I'm unsure how to handle gamepads at the system-level. I got something working with my own gamepad but the mappings are hardcoded and it uses the deprecated joystick API. I'd like to use evdev instead, but then getting this to compile is a mess.