remove joystick

Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
Vincent-FK 2020-11-15 15:52:36 +01:00
parent d23cf74c1d
commit d1809eb9c0
9 changed files with 27 additions and 22 deletions

View File

@ -1,5 +1,6 @@
#include "JoyAxisHandler.h"
/*
JoyAxisHandler::JoyAxisHandler(SDL_JoystickID joyid, Uint8 axis, Sint16 min, Sint16 max)
: joyid_(joyid)
, axis_(axis)
@ -26,4 +27,4 @@ bool JoyAxisHandler::pressed()
{
return pressed_;
}
*/

View File

@ -1,7 +1,7 @@
#pragma once
#include "InputHandler.h"
/*
class JoyAxisHandler : public InputHandler
{
public:
@ -18,4 +18,4 @@ private:
bool pressed_;
};
*/

View File

@ -1,5 +1,5 @@
#include "JoyButtonHandler.h"
/*
JoyButtonHandler::JoyButtonHandler(SDL_JoystickID joynum, Uint8 button)
: joynum_(joynum)
, button_(button)
@ -28,5 +28,5 @@ bool JoyButtonHandler::update(SDL_Event &e)
bool JoyButtonHandler::pressed()
{
return pressed_;
}
}*/

View File

@ -1,7 +1,7 @@
#pragma once
#include "InputHandler.h"
/*
class JoyButtonHandler : public InputHandler
{
public:
@ -16,3 +16,4 @@ private:
bool pressed_;
};
*/

View File

@ -1,5 +1,5 @@
#include "JoyHatHandler.h"
/*
JoyHatHandler::JoyHatHandler(SDL_JoystickID joynum, Uint8 hatnum, Uint8 direction)
: joynum_(joynum)
, hatnum_(hatnum)
@ -26,3 +26,4 @@ bool JoyHatHandler::pressed()
return pressed_;
}
*/

View File

@ -1,7 +1,7 @@
#pragma once
#include "InputHandler.h"
/*
class JoyHatHandler : public InputHandler
{
public:
@ -17,3 +17,4 @@ private:
bool pressed_;
};
*/

View File

@ -124,10 +124,10 @@ UserInput::UserInput(Configuration &c)
currentKeyState_[i] = false;
lastKeyState_[i] = false;
}
for ( unsigned int i = 0; i < cMaxJoy; i++ )
/*for ( unsigned int i = 0; i < cMaxJoy; i++ )
{
joysticks_[i] = -1;
}
}*/
}
UserInput::~UserInput()
@ -267,7 +267,7 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required)
}
else if (token.find("joy") == 0)
{
std::string joydesc = Utils::replace(Utils::toLower(token), "joy", "");
/*std::string joydesc = Utils::replace(Utils::toLower(token), "joy", "");
int joynum;
if ( isdigit( joydesc.at( 0 ) ) )
{
@ -352,7 +352,8 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required)
Logger::write(Logger::ZONE_INFO, "Input", "Binding joypad axis " + ss.str());
keyHandlers_.push_back(std::pair<InputHandler *, KeyCode_E>(new JoyAxisHandler(joynum, axis, min, max), key));
found = true;
}
}*/
found = true;
}
if (!found)
@ -387,7 +388,7 @@ bool UserInput::update( SDL_Event &e )
memset( currentKeyState_, 0, sizeof( currentKeyState_ ) );
// Handle adding a joystick
if ( e.type == SDL_JOYDEVICEADDED )
/*if ( e.type == SDL_JOYDEVICEADDED )
{
SDL_JoystickID id = SDL_JoystickInstanceID( SDL_JoystickOpen( e.jdevice.which ) );
for ( unsigned int i = 0; i < cMaxJoy; i++ )
@ -431,7 +432,7 @@ bool UserInput::update( SDL_Event &e )
break;
}
}
}
}*/
for ( unsigned int i = 0; i < keyHandlers_.size( ); ++i )
{
@ -443,7 +444,7 @@ bool UserInput::update( SDL_Event &e )
currentKeyState_[keyHandlers_[i].second] |= h->pressed( );
}
}
return updated;
}
@ -458,11 +459,11 @@ bool UserInput::newKeyPressed(KeyCode_E code)
return currentKeyState_[code] && !lastKeyState_[code];
}
/*
void UserInput::clearJoysticks( )
{
for ( unsigned int i = 0; i < cMaxJoy; i++ )
{
joysticks_[i] = -1;
}
}
}*/

View File

@ -15,7 +15,7 @@
*/
#pragma once
#include <SDL/SDL.h>
#include <SDL2/SDL_joystick.h>
//#include <SDL/SDL_joystick.h>
#include <map>
#include <string>
#include <vector>
@ -75,7 +75,7 @@ private:
bool MapKey(std::string keyDescription, KeyCode_E key);
bool MapKey(std::string keyDescription, KeyCode_E key, bool required);
Configuration &config_;
SDL_JoystickID joysticks_[cMaxJoy];
//SDL_JoystickID joysticks_[cMaxJoy];
std::vector<std::pair<InputHandler *, KeyCode_E> > keyHandlers_;
bool lastKeyState_[KeyCodeMax];
bool currentKeyState_[KeyCodeMax];

View File

@ -176,10 +176,10 @@ void RetroFE::launchExit( )
SDL_Event e;
while ( SDL_PollEvent( &e ) )
{
if ( e.type == SDL_JOYDEVICEADDED || e.type == SDL_JOYDEVICEREMOVED )
/*if ( e.type == SDL_JOYDEVICEADDED || e.type == SDL_JOYDEVICEREMOVED )
{
input_.update( e );
}
}*/
}
input_.resetStates( );
attract_.reset( );
@ -208,7 +208,7 @@ void RetroFE::freeGraphicsMemory( )
{
currentPage_->deInitializeFonts( );
SDL::deInitialize( );
input_.clearJoysticks( );
//input_.clearJoysticks( );
}
}