Re: [AD] pressure support

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sat, 2010-02-20 at 19:23 -0500, Evert Glebbeek wrote:
> On 20 Feb 2010, at 18:32 , Peter Wang wrote:
> > You should update event emitting code for other ports as well.
> > What should pressure-insensitive devices report?
> 
> Unfortunately I have no idea how they'd work (that's probably the easy
> part to figure out) and no means of testing them. Should be marked as
> something that would need to be done.
> At least on OS X, a normal mouse reports "1" if the button is down,
> "0" if it isn't. Makes sense to me.

For X11, can always check the Gimp (and GTK) sources for how to get the
events, I did that for several other X11-related things in the past :)

> > What events are generated when you touch the tablet, then increase the
> > pressure, decrease the pressure, then release?  Multiple
> > MOUSE_BUTTON_DOWN events in a row, with varying pressures, followed by a
> > single MOUSE_BUTTON_UP?
> 
> I guess. Although on OS X, the pressure is also reported when a movement event is generated.
> Someone with a stylus (Trent?) should probably test this.
> 
> > I think a single pressure field is not enough; some tablets support
> > tilt-x, tilt-y as well.  And some support multiple styluses, too.
> > We probably need to treat pressure and tilt as additional axes.
> 
> Maybe. In a sense having a float for pressure sortof does this
> already, and it probably works better that way than as an analogue of
> the z or w parameters.
> The question of multiple styluses is not so straightforward, since we
> have no API to deal with multiple pointing devices... for the event
> system a simple workaround is to include an identifier for the device
> that generated the event (if known), but for the state-based API this
> is not so straightforward.
> 

I never looked at it much before, but our joystick API can already do it
all. For example for a drawing tablet, al_get_joystick_name() would
return

"pen", "eraser"

for its two "sticks". And al_get_joystick_axis_name() could return, for
5 "axes" of each "stick":

"x-position", "y-position", "pressure", "x-tilt", "y-tilt"

Each gestures of an OSX touch pad would similarly be an axis with an
appropriate name.

So I'd say, we rename all our al_*_joystick_* functions to
al_*_input_device_* functions. Instead of multiple "sticks" we have
multiple "devices". Same for events - ALLEGRO_EVENT_JOYSTICK_AXIS gets
ALLEGRO_EVENT_INPUT_DEVICE_AXIS, and so on.

Then it's just a matter of all the different drivers implementing the
new vtables for whatever underlying devices can be reported. I volunteer
to rename... I mean implement it for iphone, instead of a 3-axis
joystick the accelerometer will be a 3-axis input device :) Maybe can
also add a single button to it which is reported as pressed when we
receive a shake event.

-- 
Elias Pschernig <elias.pschernig@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/