]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/jsinput.cxx
Fix line endings
[flightgear.git] / src / Input / jsinput.cxx
index 48d0d74be1650a9c8a595092bf84f1e838b53ff1..7b6a198f26cad93af1e59e82d3fdcf93ca300ea5 100644 (file)
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-#include <jssuper.h>
-#include <jsinput.h>
-#include <plib/js.h>
-#include <plib/ul.h>
-
+#include "jsinput.h"
 
 jsInput::jsInput(jsSuper *j) {
   jss=j;
-  pretty_display=false;
+  pretty_display=true;
   joystick=axis=button=-1;
   axis_threshold=0.2;
 }
 
 jsInput::~jsInput(void) {}
 
-int jsInput::getInput(void){
+int jsInput::getInput(){
       
       bool gotit=false;
       
       float delta;
-      int i,current_button=0,button_bits;       
+      int i, current_button = 0, button_bits = 0;
 
       joystick=axis=button=-1;
+      axis_positive=false;
       
       if(pretty_display) {
           printf ( "+----------------------------------------------\n" ) ;
@@ -83,6 +80,7 @@ int jsInput::getInput(void){
                 gotit=true;
                 joystick=jss->getCurrentJoystickId();
                 axis=i;
+               axis_positive=(delta>0);
               } else if( current_button != 0 ) {
                 gotit=true;
                 joystick=jss->getCurrentJoystickId();  
@@ -106,12 +104,14 @@ int jsInput::getInput(void){
         ulMilliSecondSleep(1);
       }
       if(button_bits != 0) {
-        for(int i=1;i<=31;i++) {
+        for(int i=0;i<=31;i++) {
           if( ( button_bits & (1 << i) ) > 0 ) {
              button=i;
              break;
           } 
         }    
       } 
+
+      return 0;
 }