SDL joystick problem

Started by
-1 comments, last by Penanito 10 years, 3 months ago

I have a straight up Input Handler function where im tryint o use the SDL joystick functions, but for some reason the SDL_JoystickOpened function doesnt seem to be working, visual studio complains "Error: SDL_JoystickOpened is undefined" Ive used other SDL functions in the same program without a problem and i have several other SDL_Joystick functions in that same class function...so why is this perticular one giving me errors?


void InputHandler::initialiseJoysticks()
{
	if(SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
	{
		SDL_InitSubSystem(SDL_INIT_JOYSTICK);
	}

	if(SDL_NumJoysticks() > 0)
	{
		for(int i = 0; i < SDL_NumJoysticks(); i++)
		{
			SDL_Joystick* joy = SDL_JoystickOpen(i);
			 if(SDL_JoystickOpened(i) == 1)//<--------SDL_JoystickOpened is apparently undefined
			{
				m_joysticks.push_back(joy); 
			}
			else
			{
				std::cout << SDL_GetError();
			}
		}
		SDL_JoystickEventState(SDL_ENABLE);
		m_bJoysticksInitialised  = true;

		std::cout << "Initialized"<< m_joysticks.size() << "joystick(s)";
	}
	else
	{
		m_bJoysticksInitialised = false;
	}
} 

I Cant find any similar problems online so im really stuck :s

This topic is closed to new replies.

Advertisement