![]() |
Xbox Controller class
To make it easier for me and other programmers especially new ones, I have made this class that uses the Joystick class to get the state of the buttons and axis on an XboxController in a way that enables others to not have to remember the button and axis numbers. To that it is also able to tell if the button has just changed state that run making it easier to create programs that use toggle. The only dounside is that at the start of every run a refresh method has to be called.
We have been using this code with out problems and I would like to know what others think about it. Thanks Code:
import edu.wpi.first.wpilibj.Joystick; |
Re: Xbox Controller class
Just a small nitpick from first glance, but is there a reason you didn't extend the Joystick class? This would allow you to use this class in any place a Joystick is used. We're currently working on one that overrides all of the joystick methods to map them to the buttons and sticks correctly.
|
Re: Xbox Controller class
That is because I have never worked with extend
|
Re: Xbox Controller class
Quote:
|
Re: Xbox Controller class
Quote:
If you are interested you can look up information about Inheritance, Java is an Object Oriented Programming language, so it is a good topic to read up on. If you have any questions let me know. |
Re: Xbox Controller class
Quote:
|
Re: Xbox Controller class
As I been looking, extending Joystick class might make the choices of methods which I want to keep as few as possible too crowded for the programmer that is using my class.
|
Re: Xbox Controller class
Quote:
Overall, looks good. Well done. |
| All times are GMT -5. The time now is 10:53. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi