Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Simple C library for an XBox Controller (Linux) for easy use in games (github.com/mauricegit)
36 points by EllipticCurve on Sept 10, 2016 | hide | past | favorite | 9 comments


This is great! I like the straightforwardness of it.

I'm sure the user could find out the index values for each button on the controller, but I'd be tempted to include an enum for each button so simplify things for the user. It's certainly usable in its current form though.


What is the "mt" prefix for?


I thought about some fancy, meaningful prefix. But in the end I decided, it doesn't really matter as long as it's unique.

So mt stands for my name (Maurice Tollmien).


> it doesn't really matter as long as it's unique.

It sort of does, because the library isn't called (or has the acronym) "mt". Why not call it "xbox*" or something like that?


Because I needed an acronym that I also could use for the vector and quaternion library. Especially for the vector library, as chance of conflict is highest there.


You really don't need to prefix everything with the same prefix everywhere, even in C. Using a per-module prefix that is unlikely to clash is enough.

For your vector and quaternion libs... You should make them header only, all static inline functions and perhaps with always_inline attribute if you care about performance. This also removes any need for prefixes.


I won't continue that mt Prefix streak. Maybe I think of something better later :)

That is a good idea, I will look into that, thanks!


Cool, does SDL already support the Xbox controller?


Possible, yes. But I'm not sure.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: