Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 61 lines (47 sloc) 1.841 kB
eb8058a @smcameron add joystick support
authored
1 /*
2 (C) Copyright 2007,2008, Stephen M. Cameron.
3
4 This file is part of wordwarvi.
5
6 wordwarvi is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 wordwarvi is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with wordwarvi; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20 */
21 #ifndef __JOYSTICK_H__
22 #define __JOYSTICK_H__
23
24 #include <stdio.h>
25 #ifdef __WIN32__
26 #include <gdk/gdktypes.h>
27 #endif
28
29 #define JOYSTICK_DEVNAME "/dev/input/js0"
30
31 #define JS_EVENT_BUTTON 0x01 /* button pressed/released */
32 #define JS_EVENT_AXIS 0x02 /* joystick moved */
33 #define JS_EVENT_INIT 0x80 /* initial state of device */
34
35
36 struct js_event {
37 unsigned int time; /* event timestamp in milliseconds */
38 short value; /* value */
39 unsigned char type; /* event type */
40 unsigned char number; /* axis/button number */
41 };
42
43 struct wwvi_js_event {
44 int button[11];
45 int stick_x;
46 int stick_y;
47 };
48
49 #ifdef __WIN32__
50 extern int open_joystick(char *joystick_device, GdkWindow *window);
51 #else
52 extern int open_joystick(char *joystick_device, void *window);
53 #endif
54 extern int read_joystick_event(struct js_event *jse);
55 extern void set_joystick_y_axis(int axis);
56 extern void set_joystick_x_axis(int axis);
57 extern void close_joystick();
58 extern int get_joystick_status(struct wwvi_js_event *wjse);
59
60 #endif
Something went wrong with that request. Please try again.