Re: [Plib-devel] Re: control abstraction, continued (ad infinitum)
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-06-02 00:01:12
|
James Turner wrote: > > Some more points that have come up: > > the need for controls with both analog inputs and digital buttons. Hence > I have a new input type, ctlDual, which clan be used as follows: > > ctlDual *t = new ctlDual("Throttle", 0.1, 0.05, CTL_JS_0, 3); > 2 parameter is the 'step size', explained below > 3 param is a threshold, also explained below Why should there be a new type? I think that all analog inputs should have the capability of being driven from digital inputs because some people don't like using the mouse or joystick at all. (eg Quake fanatics) > then: > > t->addDigital(new ctlDigital("100% Throttle", CTL_KEYBOARD, '#'), > CTL_DUAL_MAX); > t->addDigital(new ctlDigital("Increase Throttle", CTL_KEYBOARD, '+'), > CTL_DUAL_INC); I don't think this should be under program control. I think the application should just state it's needs: addDigital ( "RetractSwitch" ) ; addAnalog ( "Throttle" ) ; ...and have an external file (say '.fgfs_controls' for FlightGear, '.tux_aqfh_controls' for Tux, etc) that binds physical controllers to each application variable: RetractSwitch:DIGITAL: 'R'==1, 'U'==0 Throttle:ANALOG: MOUSE_NORTH_SOUTH + MOUSE_MIDDLE_BUTTON, scale=1.5, deadzone=0.3, linear Flaps:ANALOG: '<'==++0.1, '>'==--0.1 ...and so on. Then (initially) we can create such a file that installs with FGFS (or whatever) which has the default controllers - possibly one file for people with joysticks and one without. Experts can then hand-edit that file to set their own personal preferences - and perhaps some kind person would create a GUI-driven configuration widget that would be application-independent. > One other suggested change is that digital inputs drive callbacks rather > than being polled; this makes a lot of sense I suspect, so I will add a > setCallback method and alternate constructor to ctlDigital. I don't > think callback behaviour makes sense for analog inputs, but if people > disagree then it could be included. It should be possible to use three mechanisms: 1) Polling (that doesn't work well with GLUT - but it can be done) 2) Callbacks. 3) Direct variable drive (ie you call a single 'update' function and it updates a bunch of variables that the application bound to the controllers). Each method has its benefits. > As ever feedback is appreciated especially from non-FG users of PLIB, > who I suspect are all looking on in amazement and thinking 'when would I > *ever* use this junk' :-) To the contrary - I'm hoping that this will allow me to get mouse and keyboard drivers for my two Tux games (A Quest for Herring - and the upcoming 'TuxKart') - with zero effort on my part! -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |