Example #1
0
SDLInputState::SDLInputState(void)
	: InputState()
{
#if !defined(__ANDROID__) && !defined (__IPHONEOS__)
	SDL_StartTextInput();
#endif

	defaultQwertyKeyBindings();
	defaultJoystickBindings();

	for (int key=0; key<key_count; key++) {
		pressing[key] = false;
		un_press[key] = false;
		lock[key] = false;
	}

	loadKeyBindings();
	setKeybindNames();
}
Example #2
0
SDLInputState::SDLInputState(void)
	: InputState()
	, joy(NULL)
	, joy_num(0)
	, joy_axis_num(0)
	, resize_ticks(-1)
	, joystick_init(false)
{
	// don't use keyboard for touchscreen devices
	if (!PlatformOptions.is_mobile_device)
		SDL_StartTextInput();

	PlatformSetExitEventFilter();

	defaultQwertyKeyBindings();
	defaultJoystickBindings();

	for (int key=0; key<key_count; key++) {
		pressing[key] = false;
		un_press[key] = false;
		lock[key] = false;
	}

	loadKeyBindings();
	setKeybindNames();

	// print some information to the console about connected joysticks
	if(SDL_NumJoysticks() > 0) {
		logInfo("%d joystick(s) found.", SDL_NumJoysticks());
		joy_num = SDL_NumJoysticks();
	}
	else {
		logInfo("No joysticks were found.");
		ENABLE_JOYSTICK = false;
		return;
	}

	for(int i = 0; i < SDL_NumJoysticks(); i++) {
		logInfo("  Joy %d) %s", i, getJoystickName(i).c_str());
	}
}