kkaja123 / Gopher360

Gopher360 is a free and open source zero-configuration-needed application that turns your Xbox 360, Xbox One, or even DualShock controller into a mouse and keyboard. Just download, run, and relax.
GNU General Public License v3.0
6 stars 2 forks source link

Linux #19

Open kkaja123 opened 4 years ago

kkaja123 commented 4 years ago

Originally posted by @redxtech Any plans to continue the port to Linux? With some basic introduction I might be able to do some things to it if you're willing to help me out.

I haven't done much with C++, but with some introduction to this project I might be able to get something done.

kkaja123 commented 4 years ago

Originally posted by @sighol Awesome!

There are some challengers with making this cross platform. Gopher interacts with the controller through xinput and windows.h. These are to my knowledge only available on windows. I see some possibilites:

Use a cross platform input library

I think SDL2 may be possible to use. Another option is GLFW. I believe SDL has full controller support, more uncertain with GLFW.

A pluss with this approach is that it should work with Mac as well. A con is that it will complicate the build process somehow. I can help you here.

I belive using GLFW or SDL2 can fix issues such as #29

Implement both windows and linux, and make the build select implementation

Separate the logic of Gopher with the controller interactions. This way we can make two implementation of the controller interaction: on for windows and one for linux.

I think this route is easier, but not necessarily best. The linux implementation may rely on GLFW or SDL2 anyway, so maybe it's best to make the whole switch.

Write in another language?

You said you hadn't done much in C++. Do you have more experience in golang or rust? Both of those compile into a single binary, which makes the program easy to distribute. My impression is that golang is easier than C++, and rust is more difficult.

The good thing with this approach is that maybe there exists some cross platform input library that is easy to reuse. Both go and rust are to my opinion more maintainable.

Go example: https://github.com/veandco/go-sdl2

EDIT: QT may be another option. Maybe the easiest: http://doc.qt.io/qt-5/qtgamepad-examples.html

kkaja123 commented 4 years ago

Originally posted by @redxtech I haven't used golang or rust, but I have used a lot of web development languages, php, ruby, python, and C#. I have been looking to get into working with golang recently, so maybe I could do some of that, and then see how I would work on this project in go.

(Don't worry, I pick up new things very quickly).

kkaja123 commented 4 years ago

It will take some investigation and experimentation to see how this could be done elegantly. We would want each platform to share some core code, but there will be some controller abstraction layer so the core code can read the controller no matter which OS provides the controller info.