• Advertisement
Sign in to follow this  

SDL joystick problem

This topic is 1446 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement