0

Currently I am an IT student, and I want to make a game as my semestral work. I want to make a Geometry Wars clone purely in C (cause we are bound to C, ergo no C++/C#, only C and OpenGL), and when it will be done, I want to publish that as open-source game for Linux/Mac/PC. I want to ask, how can I use Xbox360 controller (wired) as gaming input device? I learnt after some research that XInput does the stuff, but is that really multiplatform thingy? I am curious what do you use folks for coding Xbox controller input in C under linux.

Citrus
  • 1,162
  • 1
  • 16
  • 38
  • I assume you're using a normal Wireless XBox 360 controller with one of these: http://www.microsoft.com/games/en-US/Hardware/Controllers/Pages/XboxWirelessGamingReceiverforWindows.aspx/ ? – John Carter Feb 27 '13 at 21:17
  • 1
    Does it not appear as a standard USB controller? (I don't know) – John Carter Feb 27 '13 at 21:43
  • okay, maybe I ask a little bit different...how can I capture the input from an USB device (xbox360 controller now) via C programming language? I have never worked with USB peripherals for now in C – Citrus Feb 27 '13 at 21:45
  • 3
    Note that you can't really create much using only C and OpenGL, as neither C nor OpenGL concerns itself with windowing, input and other platform specific stuff. Use libSDL to cover up that, which also provides a cross platform joystick and keyboard API. Linux has drivers which will make the xbox controller appear as a joystick, and you can map buttons to look like key presses. – nos Feb 27 '13 at 22:06
  • I think I summed up my problem in a really dumb way, never mind, I learned from this :D I meant only, that I can use only C and extend it with external libs, like OpenXX stuff or that. I will try out that SDL thingy, maybe it will work, thanks for the answer :) – Citrus Feb 27 '13 at 22:12
  • @LászlóCitrusNagy working out the right question to ask is half the battle ;) – John Carter Mar 02 '13 at 22:30
  • totally agree with you @therefromhere – Citrus Mar 02 '13 at 22:36

1 Answers1

0

I've taken a look and find some information about this and I've found:

  1. use the SDL library
  2. use the functions in the github linux/joystick.h

I've no idea how to do any of this, but a good point to begin is studying what is SDL, in there or the github above.

A workarround:
Get a look on this repo on github. It's a Linux substitute for JoyToKey. You can use it to bind keys for your controller, and bind keys like CRTL+SPACE or bind some button to a virtual keyboard.

Lucas
  • 1
  • 1