Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

/*
 * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
 *
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
 *               Gerardo Lamastra <gerardo@sssup.it>
 *
 * Authors     : Mauro MArinoni <mauro.marinoni@unipv.it>
 * (see authors.txt for full list of hartik's authors)
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://hartik.sssup.it
 */


/*
 * Copyright (C) 2000 Paolo Gai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */


#ifndef __JOY_H__
#define __JOY_H__

/* standard I/O port address for the PC joystick */
#define JPORT   0x201

/*
 * max counts to wait for joystick. In normal usage, you don't
 * want this too large, so that the program doesn't hang up too long
 * if no joystick is attached. But if you make it too small, a
 * program that works on a slow machine may fail on a faster CPU
 * (unless you have a "speed adjustable" game card).
 */

#define CMAX    9999

typedef struct { /*describe the position and buttons state of a joystick*/
        int x;
        int y;
        char b1;
        char b2;
} JOY_STATE;

typedef struct { /*describe the four buttons state of a joystick*/
        char b1;
        char b2;
        char b3;
        char b4;
} JOY_BUTTONS;

typedef struct { /*describe the position boundaries of a joystick*/
        int x_min;
        int y_min;
        int x_max;
        int y_max;
} JOY_BOUND;

void get_joystick_buttons(JOY_BUTTONS *jb);
int  get_joystick_AB(JOY_STATE *jsa, JOY_STATE *jsb);
int  get_joystick_A(JOY_STATE *js);
int  get_joystick_B(JOY_STATE *js);
int  get_joystick_bound_A(JOY_BOUND *jb);
int  get_joystick_bound_B(JOY_BOUND *jb);

#endif