1
0
Fork 0

Updated to work with current property naming convention.

This commit is contained in:
curt 2001-07-06 21:38:28 +00:00
parent 74bb87e855
commit 76815256f7
3 changed files with 18 additions and 14 deletions

View file

@ -2,15 +2,14 @@ noinst_LIBRARIES = libInput.a
libInput_a_SOURCES = input.cxx input.hxx libInput_a_SOURCES = input.cxx input.hxx
# bin_PROGRAMS = js_demo fgjs bin_PROGRAMS = js_demo fgjs
bin_PROGRAMS = js_demo
js_demo_SOURCES = js_demo.cxx js_demo_SOURCES = js_demo.cxx
js_demo_LDADD = $(audio_LIBS) js_demo_LDADD = $(audio_LIBS)
# fgjs_SOURCES = fgjs.cxx jsinput.cxx jsinput.h jssuper.cxx jssuper.h fgjs_SOURCES = fgjs.cxx jsinput.cxx jsinput.h jssuper.cxx jssuper.h
# fgjs_LDADD = $(audio_LIBS) fgjs_LDADD = $(audio_LIBS)
INCLUDES += -I$(top_srcdir) -I$(top_srcdir)/src INCLUDES += -I$(top_srcdir) -I$(top_srcdir)/src

View file

@ -89,15 +89,16 @@ void waitForButton(jsSuper *jss, int wait_ms) {
void writeAxisProperties(fstream &fs, int control,int joystick, int axis) { void writeAxisProperties(fstream &fs, int control,int joystick, int axis) {
char jsDesc[40]; char jsDesc[80];
snprintf(jsDesc,40,"--prop:/input/joysticks/js[%d]/axis[%d]",joystick,axis); snprintf(jsDesc,80,"--prop:/input/joysticks/js[%d]/axis[%d]/binding",joystick,axis);
fs << jsDesc << "/control=" << axes_propnames[control] << endl; fs << jsDesc << "/command=property-scale" << endl;
fs << jsDesc << "/property=" << axes_propnames[control] << endl;
fs << jsDesc << "/dead-band=0.02" << endl; fs << jsDesc << "/dead-band=0.02" << endl;
if( half_range[control] == true) { if( half_range[control] == true) {
fs << jsDesc << "/offset=-1.0" << endl; fs << jsDesc << "/offset=-1.0" << endl;
fs << jsDesc << "/factor=0.5" << endl; fs << jsDesc << "/factor=-0.5" << endl;
} else { } else {
fs << jsDesc << "/offset=0.0" << endl; fs << jsDesc << "/offset=0.0" << endl;
fs << jsDesc << "/factor=1.0" << endl; fs << jsDesc << "/factor=1.0" << endl;
@ -107,13 +108,13 @@ void writeAxisProperties(fstream &fs, int control,int joystick, int axis) {
void writeButtonProperties(fstream &fs, int property,int joystick, int button) { void writeButtonProperties(fstream &fs, int property,int joystick, int button) {
char jsDesc[40]; char jsDesc[80];
snprintf(jsDesc,40,"--prop:/input/joysticks/js[%d]/button[%d]",joystick,button); snprintf(jsDesc,80,"--prop:/input/joysticks/js[%d]/button[%d]/binding",joystick,button);
fs << jsDesc << "/action=adjust" << endl;
fs << jsDesc << "/control=" << button_propnames[property] << endl;
fs << jsDesc << "/step=" << button_step[property] << endl;
fs << jsDesc << "/repeatable=" << button_repeat[property] << endl; fs << jsDesc << "/repeatable=" << button_repeat[property] << endl;
fs << jsDesc << "/command=property-adjust" << endl;
fs << jsDesc << "/property=" << button_propnames[property] << endl;
fs << jsDesc << "/step=" << button_step[property] << endl;
fs << endl; fs << endl;
} }

View file

@ -22,7 +22,7 @@
jsInput::jsInput(jsSuper *j) { jsInput::jsInput(jsSuper *j) {
jss=j; jss=j;
pretty_display=false; pretty_display=true;
joystick=axis=button=-1; joystick=axis=button=-1;
axis_threshold=0.2; axis_threshold=0.2;
} }
@ -101,6 +101,7 @@ int jsInput::getInput(void){
ulMilliSecondSleep(1); ulMilliSecondSleep(1);
} }
#if 0
if(button_bits != 0) { if(button_bits != 0) {
for(int i=1;i<=31;i++) { for(int i=1;i<=31;i++) {
if( ( button_bits & (1 << i) ) > 0 ) { if( ( button_bits & (1 << i) ) > 0 ) {
@ -109,6 +110,9 @@ int jsInput::getInput(void){
} }
} }
} }
#else
button = button_bits;
#endif
return 0; return 0;
} }