Re: [AD] mouse_api branch

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


I've committed something like this; unfortunately it will break
everything because I had to change the AL_MOUSE_DRIVER structure
Pete

On 9/1/06, Peter Wang <tjaden@xxxxxxxxxx> wrote:
On 2006-09-01, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
> On 8/30/06, Peter Wang <tjaden@xxxxxxxxxx> wrote:
> > On 2006-08-29, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
> > > On 8/27/06, Peter Wang <tjaden@xxxxxxxxxx> wrote:
> > > > If you click outside, wouldn't that focus another window?
> > > Oh, yes I see what you mean now.
> > >
> > > In the new API, I don't think there are methods to:
> > > Determine the number of axes on the mouse
> > > Get the value on the fourth axis
> >
> > Add them :-)
> Sorry, I actually meant 'set the value on the fourth axis' - I already
> added the axis to the mouse event and mouse state structure.

You can add a setter function, and a function to get the number of axes...

> Anyway, I'm wondering whether the number of buttons and axes should be
> part of the AL_MOUSE structure.

... and the number of buttons.  (see below)

> I'm assuming there will be something
> analagous in the AL_JOYSTICK structure. Of course, having >1 joystick
> is not unusual, whereas >1 mouse would be extremely unusual*, but it
> would be nice to have the APIs looking 'aligned'.

Sure.  The only problem is that I'd rather refer to the x and y axes by
name (in the AL_MSESTATE) instead of state.axis[0], state.axis[1].  What
about we arrange AL_MSESTATE like this:

    typedef struct AL_MSESTATE
    {
       int buttons;
       int x;
       int y;
       int z;
       int w;
       int more_axes[N];
    } AL_MSESTATE;

Then provide a macro/function to refer to axes by number:

    int al_mouse_state_axis(AL_MSESTATE *state, int axis_num);

where
    x-axis = axis 0
    y-axis = axis 1
    z-axis = axis 2
    w-axis = axis 3

We can add enums for readability, but it's probably too tedious writing
x = al_mouse_state_axis(state, AL_MOUSE_AXIS_X);


Now, to determine the number of buttons/axes:

    int al_mouse_num_buttons(void);
    int al_mouse_num_axes(void);

To set the axes:

    bool al_mouse_set_axis(int axis_num, int value);

How's that?


Peter


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
--
https://lists.sourceforge.net/lists/listinfo/alleg-developers





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