mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-10-03 12:28:10 +03:00
Always enable GameController, and remove unused USE_JOY code
This commit is contained in:
@@ -96,15 +96,6 @@ NACT::NACT(int sys_ver, uint32 crc32_a, uint32 crc32_b, const Config& config)
|
||||
mako = new MAKO(this, config);
|
||||
msgskip = new MsgSkip(this);
|
||||
|
||||
#ifdef USE_JOY
|
||||
// 入力初期化
|
||||
joy_num = joyGetNumDevs();
|
||||
if(joy_num) {
|
||||
joyGetDevCaps(JOYSTICKID1, &joycaps, sizeof(JOYCAPS));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_JOY_SDL
|
||||
SDL_Init(SDL_INIT_GAMECONTROLLER);
|
||||
for (int i = 0; i < SDL_NumJoysticks(); ++i) {
|
||||
if (SDL_IsGameController(i)) {
|
||||
@@ -116,7 +107,6 @@ NACT::NACT(int sys_ver, uint32 crc32_a, uint32 crc32_b, const Config& config)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
terminate = false;
|
||||
restart_after_terminate = false;
|
||||
|
||||
+1
-7
@@ -231,14 +231,8 @@ protected:
|
||||
void get_cursor(int* x, int* y);
|
||||
void set_cursor(int x, int y);
|
||||
|
||||
#ifdef USE_JOY
|
||||
int joy_num;
|
||||
JOYCAPS joycaps;
|
||||
#endif
|
||||
|
||||
#ifdef USE_JOY_SDL
|
||||
SDL_GameController *sdl_gamecontroller = NULL;
|
||||
#endif
|
||||
|
||||
int mouse_x = 0, mouse_y = 0;
|
||||
|
||||
static uint32 calc_crc32(const char* file_name, const std::string& game_id);
|
||||
|
||||
@@ -85,24 +85,6 @@ uint8 NACT::get_key()
|
||||
|
||||
// マウス移動で方向入力はサポートしない
|
||||
|
||||
#ifdef USE_JOY
|
||||
// ジョイスティック
|
||||
if(joy_num > 0) {
|
||||
JOYINFO joyinfo;
|
||||
if(joyGetPos(JOYSTICKID1, &joyinfo) == JOYERR_NOERROR) {
|
||||
if(joyinfo.wYpos == joycaps.wYmin) val |= 0x01;
|
||||
if(joyinfo.wYpos == joycaps.wYmax) val |= 0x02;
|
||||
if(joyinfo.wXpos == joycaps.wXmin) val |= 0x04;
|
||||
if(joyinfo.wXpos == joycaps.wXmax) val |= 0x08;
|
||||
if(joyinfo.wButtons & JOY_BUTTON1) val |= 0x10;
|
||||
if(joyinfo.wButtons & JOY_BUTTON2) val |= 0x20;
|
||||
if(joyinfo.wButtons & JOY_BUTTON3) val |= 0x40;
|
||||
if(joyinfo.wButtons & JOY_BUTTON4) val |= 0x80;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_JOY_SDL
|
||||
if(sdl_gamecontroller) {
|
||||
if(SDL_GameControllerGetButton(sdl_gamecontroller, SDL_CONTROLLER_BUTTON_DPAD_UP) || SDL_GameControllerGetAxis(sdl_gamecontroller, SDL_CONTROLLER_AXIS_LEFTY) <= -8000) val |= 0x01;
|
||||
if(SDL_GameControllerGetButton(sdl_gamecontroller, SDL_CONTROLLER_BUTTON_DPAD_DOWN) || SDL_GameControllerGetAxis(sdl_gamecontroller, SDL_CONTROLLER_AXIS_LEFTY) >= 8000) val |= 0x02;
|
||||
@@ -113,7 +95,6 @@ uint8 NACT::get_key()
|
||||
if(SDL_GameControllerGetButton(sdl_gamecontroller, SDL_CONTROLLER_BUTTON_X)) val |= 0x40;
|
||||
if(SDL_GameControllerGetButton(sdl_gamecontroller, SDL_CONTROLLER_BUTTON_Y)) val |= 0x80;
|
||||
}
|
||||
#endif
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user