[Scummvm-cvs-logs] CVS: scummvm/backends/sdl sdl-common.cpp,1.89,1.90 sdl-common.h,1.39,1.40
Jonathan Gray
khalek at users.sourceforge.net
Wed Oct 1 03:48:09 CEST 2003
Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1:/tmp/cvs-serv9324/backends/sdl
Modified Files:
sdl-common.cpp sdl-common.h
Log Message:
disable joystick input by default either command line or config file need to be used to enable it now, ability to choose joystick number to use also added
Index: sdl-common.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- sdl-common.cpp 28 Sep 2003 14:27:08 -0000 1.89
+++ sdl-common.cpp 1 Oct 2003 10:47:18 -0000 1.90
@@ -41,26 +41,32 @@
#define JOY_BUT_SPACE 4
#define JOY_BUT_F5 5
-OSystem *OSystem_SDL_create(int gfx_mode, bool full_screen, bool aspect_ratio) {
- return OSystem_SDL_Common::create(gfx_mode, full_screen, aspect_ratio);
+OSystem *OSystem_SDL_create(int gfx_mode, bool full_screen, bool aspect_ratio, int joystick_num) {
+ return OSystem_SDL_Common::create(gfx_mode, full_screen, aspect_ratio, joystick_num);
}
-OSystem *OSystem_SDL_Common::create(int gfx_mode, bool full_screen, bool aspect_ratio) {
+OSystem *OSystem_SDL_Common::create(int gfx_mode, bool full_screen, bool aspect_ratio, int joystick_num) {
OSystem_SDL_Common *syst = OSystem_SDL_Common::create_intern();
- syst->init_intern(gfx_mode, full_screen, aspect_ratio);
+ syst->init_intern(gfx_mode, full_screen, aspect_ratio, joystick_num);
return syst;
}
-void OSystem_SDL_Common::init_intern(int gfx_mode, bool full_screen, bool aspect_ratio) {
+void OSystem_SDL_Common::init_intern(int gfx_mode, bool full_screen, bool aspect_ratio, int joystick_num) {
_mode = gfx_mode;
_full_screen = full_screen;
_adjustAspectRatio = aspect_ratio;
_mode_flags = 0;
+ uint32 sdlFlags;
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK) ==-1) {
+ sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
+
+ if (joystick_num > -1)
+ sdlFlags |= SDL_INIT_JOYSTICK;
+
+ if (SDL_Init(sdlFlags) ==-1) {
error("Could not initialize SDL: %s.\n", SDL_GetError());
}
@@ -77,9 +83,9 @@
#endif
// enable joystick
- if (SDL_NumJoysticks() > 0) {
+ if (joystick_num > -1 && SDL_NumJoysticks() > 0) {
printf("Using joystick: %s\n", SDL_JoystickName(0));
- init_joystick();
+ init_joystick(joystick_num);
}
}
Index: sdl-common.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- sdl-common.h 27 Sep 2003 16:54:10 -0000 1.39
+++ sdl-common.h 1 Oct 2003 10:47:18 -0000 1.40
@@ -117,7 +117,7 @@
virtual int16 RGBToColor(uint8 r, uint8 g, uint8 b);
virtual void colorToRGB(int16 color, uint8 &r, uint8 &g, uint8 &b);
- static OSystem *create(int gfx_mode, bool full_screenm, bool aspect_ratio);
+ static OSystem *create(int gfx_mode, bool full_screenm, bool aspect_ratio, int joystick_num);
protected:
OSystem_SDL_Common();
@@ -125,7 +125,7 @@
static OSystem_SDL_Common *create_intern();
- void init_intern(int gfx_mode, bool full_screen, bool aspect_ratio);
+ void init_intern(int gfx_mode, bool full_screen, bool aspect_ratio, int joystick_num);
// unseen game screen
SDL_Surface *_screen;
@@ -229,7 +229,7 @@
void setup_icon();
void kbd_mouse();
- void init_joystick() { _joystick = SDL_JoystickOpen(0); }
+ void init_joystick(int joystick_num) { _joystick = SDL_JoystickOpen(joystick_num); }
};
#endif
More information about the Scummvm-git-logs
mailing list