Cleaned up some joystick-related code I missed (fixup d384b96
)
This commit is contained in:
parent
d384b96d97
commit
50407c1e8e
5 changed files with 0 additions and 197 deletions
|
@ -285,29 +285,6 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts, const char
|
|||
}
|
||||
}
|
||||
|
||||
bool game_launcher::init_joystick()
|
||||
{
|
||||
if (!preferences::joystick_support_enabled())
|
||||
return false;
|
||||
|
||||
if(SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
||||
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
|
||||
return false;
|
||||
|
||||
int joysticks = SDL_NumJoysticks();
|
||||
if (joysticks == 0) return false;
|
||||
|
||||
SDL_JoystickEventState(SDL_ENABLE);
|
||||
|
||||
bool joystick_found = false;
|
||||
for (int i = 0; i<joysticks; i++) {
|
||||
|
||||
if (SDL_JoystickOpen(i))
|
||||
joystick_found = true;
|
||||
}
|
||||
return joystick_found;
|
||||
}
|
||||
|
||||
bool game_launcher::init_language()
|
||||
{
|
||||
if(!::load_language_list())
|
||||
|
|
|
@ -57,7 +57,6 @@ public:
|
|||
|
||||
bool init_video();
|
||||
bool init_language();
|
||||
bool init_joystick();
|
||||
bool init_lua_script();
|
||||
|
||||
bool play_test();
|
||||
|
|
|
@ -720,144 +720,6 @@ namespace {
|
|||
double scroll = 0.2;
|
||||
}
|
||||
|
||||
bool joystick_support_enabled()
|
||||
{
|
||||
return get("joystick_support_enabled", false);
|
||||
}
|
||||
|
||||
int joystick_mouse_deadzone()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_scroll_deadzone"), 1500), 0, 16000);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_num_mouse_xaxis()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_num_scroll_xaxis"), 0), -1, 3);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_mouse_xaxis_num()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_scroll_xaxis_num"), 0), 0, 7);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_num_mouse_yaxis()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_num_scroll_yaxis"), 0), -1, 3);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_mouse_yaxis_num()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_scroll_yaxis_num"), 1), 0, 7);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_scroll_deadzone()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_scroll_deadzone"), 1500), 0, 16000);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_cursor_deadzone()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_cursor_deadzone"), 1500), 0, 16000);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_thrusta_deadzone()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_thrusta_deadzone"), 1500), 0, 16000);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_thrustb_deadzone()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_thrustb_deadzone"), 1500), 0, 16000);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_cursor_threshold()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_cursor_threshold"), 10000), 0, 16000);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_num_scroll_xaxis()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_num_scroll_xaxis"), 0), -1, 3);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_scroll_xaxis_num()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_scroll_xaxis_num"), 0), 0, 7);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_num_scroll_yaxis()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_num_scroll_yaxis"), 0), -1, 3);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_scroll_yaxis_num()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_scroll_yaxis_num"), 1), 0, 7);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_num_cursor_xaxis()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_num_cursor_xaxis"), 0), -1, 3);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_cursor_xaxis_num()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_cursor_xaxis_num"), 3), 0, 7);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_num_cursor_yaxis()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_num_cursor_yaxis"), 0), -1, 3);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_cursor_yaxis_num()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_cursor_yaxis_num"), 4), 0, 7);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_num_thrusta_axis()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_num_thrusta_axis"), 0), -1, 3);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_thrusta_axis_num()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_thrusta_axis_num"), 2), 0, 7);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_num_thrustb_axis()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_num_thrustb_axis"), 0), -1, 3);
|
||||
return value;
|
||||
}
|
||||
|
||||
int joystick_thrustb_axis_num()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("joystick_thrustb_axis_num"), 2), 0, 7);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
int scroll_speed()
|
||||
{
|
||||
const int value = utils::clamp<int>(lexical_cast_default<int>(get("scroll"), 50), 1, 100);
|
||||
|
|
|
@ -193,34 +193,6 @@ namespace preferences {
|
|||
bool use_color_cursors();
|
||||
void _set_color_cursors(bool value);
|
||||
|
||||
bool joystick_support_enabled();
|
||||
int joystick_mouse_deadzone();
|
||||
int joystick_num_mouse_xaxis();
|
||||
int joystick_num_mouse_yaxis();
|
||||
int joystick_mouse_xaxis_num();
|
||||
int joystick_mouse_yaxis_num();
|
||||
|
||||
int joystick_scroll_deadzone();
|
||||
int joystick_num_scroll_xaxis();
|
||||
int joystick_num_scroll_yaxis();
|
||||
int joystick_scroll_xaxis_num();
|
||||
int joystick_scroll_yaxis_num();
|
||||
|
||||
int joystick_cursor_deadzone();
|
||||
int joystick_num_cursor_xaxis();
|
||||
int joystick_num_cursor_yaxis();
|
||||
int joystick_cursor_xaxis_num();
|
||||
int joystick_cursor_yaxis_num();
|
||||
int joystick_cursor_threshold();
|
||||
|
||||
int joystick_thrusta_deadzone();
|
||||
int joystick_num_thrusta_axis();
|
||||
int joystick_thrusta_axis_num();
|
||||
|
||||
int joystick_thrustb_deadzone();
|
||||
int joystick_num_thrustb_axis();
|
||||
int joystick_thrustb_axis_num();
|
||||
|
||||
int scroll_speed();
|
||||
void set_scroll_speed(const int scroll);
|
||||
|
||||
|
|
|
@ -685,13 +685,6 @@ static int do_gameloop(const std::vector<std::string>& args)
|
|||
|
||||
events::run_event_loop();
|
||||
|
||||
if(preferences::joystick_support_enabled()) {
|
||||
res = game->init_joystick();
|
||||
if(res == false) {
|
||||
std::cerr << "could not initialize joystick\n";
|
||||
}
|
||||
}
|
||||
|
||||
check_fpu();
|
||||
const cursor::manager cursor_manager;
|
||||
cursor::set(cursor::WAIT);
|
||||
|
|
Loading…
Add table
Reference in a new issue