Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13494
Modified Files:
defines.h gameloop.cpp globals.cpp globals.h worldmap.cpp
Log Message:
- turned joystick defines into variables
Index: defines.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/defines.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- defines.h 20 Apr 2004 11:09:33 -0000 1.16
+++ defines.h 20 Apr 2004 12:24:28 -0000 1.17
@@ -32,16 +32,6 @@
#define FPS (1000 / 25)
-
-/* Joystick buttons and axes: */
-
-#define JOY_A 0
-#define JOY_B 1
-#define JOY_START 9
-
-#define JOY_X 0
-#define JOY_Y 1
-
/* Direction (keyboard/joystick) states: */
#define UP 0
Index: globals.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/globals.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- globals.cpp 20 Apr 2004 11:09:33 -0000 1.13
+++ globals.cpp 20 Apr 2004 12:24:28 -0000 1.14
@@ -23,6 +23,13 @@
/** The datadir prefix prepended when loading game data file */
std::string datadir;
+int JOY_A = 0;
+int JOY_B = 1;
+int JOY_START = 9;
+
+int JOY_X = 0;
+int JOY_Y = 1;
+
SDL_Surface * screen;
Text* black_text;
Text* gold_text;
Index: globals.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/globals.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- globals.h 20 Apr 2004 11:09:33 -0000 1.25
+++ globals.h 20 Apr 2004 12:24:28 -0000 1.26
@@ -30,6 +30,14 @@
extern std::string datadir;
+/* Joystick buttons and axes: */
+extern int JOY_A;
+extern int JOY_B;
+extern int JOY_START;
+
+extern int JOY_X;
+extern int JOY_Y;
+
extern SDL_Surface * screen;
extern Text* black_text;
extern Text* gold_text;
Index: worldmap.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- worldmap.cpp 20 Apr 2004 10:42:05 -0000 1.38
+++ worldmap.cpp 20 Apr 2004 12:24:28 -0000 1.39
@@ -408,20 +408,19 @@
break;
case SDL_JOYAXISMOTION:
- switch(event.jaxis.axis)
+ if (event.jaxis.axis == JOY_X)
{
- case JOY_X:
if (event.jaxis.value < -JOYSTICK_DEAD_ZONE)
input_direction = WEST;
else if (event.jaxis.value > JOYSTICK_DEAD_ZONE)
input_direction = EAST;
- break;
- case JOY_Y:
+ }
+ else if (event.jaxis.axis == JOY_Y)
+ {
if (event.jaxis.value > JOYSTICK_DEAD_ZONE)
input_direction = SOUTH;
else if (event.jaxis.value < -JOYSTICK_DEAD_ZONE)
input_direction = NORTH;
- break;
}
break;
Index: gameloop.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- gameloop.cpp 20 Apr 2004 12:12:31 -0000 1.85
+++ gameloop.cpp 20 Apr 2004 12:24:28 -0000 1.86
@@ -280,9 +280,8 @@
break;
case SDL_JOYAXISMOTION:
- switch(event.jaxis.axis)
+ if (event.jaxis.axis == JOY_X)
{
- case JOY_X:
if (event.jaxis.value < -JOYSTICK_DEAD_ZONE)
{
tux.input.left = DOWN;
@@ -298,20 +297,18 @@
tux.input.left = DOWN;
tux.input.right = DOWN;
}
- break;
- case JOY_Y:
+ }
+ else if (event.jaxis.axis == JOY_Y)
+ {
if (event.jaxis.value > JOYSTICK_DEAD_ZONE)
tux.input.down = DOWN;
else if (event.jaxis.value < -JOYSTICK_DEAD_ZONE)
tux.input.down = UP;
else
tux.input.down = UP;
-
- break;
- default:
- break;
}
break;
+
case SDL_JOYBUTTONDOWN:
if (event.jbutton.button == JOY_A)
tux.input.up = DOWN;
|