Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

SDL joystick problem

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 Penanito   Members   

381
Like
0Likes
Like

Posted 02 February 2014 - 07:58 PM

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






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.