mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 17:58:53 +01:00
remove joystick
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
d23cf74c1d
commit
d1809eb9c0
@ -1,5 +1,6 @@
|
|||||||
#include "JoyAxisHandler.h"
|
#include "JoyAxisHandler.h"
|
||||||
|
|
||||||
|
/*
|
||||||
JoyAxisHandler::JoyAxisHandler(SDL_JoystickID joyid, Uint8 axis, Sint16 min, Sint16 max)
|
JoyAxisHandler::JoyAxisHandler(SDL_JoystickID joyid, Uint8 axis, Sint16 min, Sint16 max)
|
||||||
: joyid_(joyid)
|
: joyid_(joyid)
|
||||||
, axis_(axis)
|
, axis_(axis)
|
||||||
@ -26,4 +27,4 @@ bool JoyAxisHandler::pressed()
|
|||||||
{
|
{
|
||||||
return pressed_;
|
return pressed_;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "InputHandler.h"
|
#include "InputHandler.h"
|
||||||
|
/*
|
||||||
class JoyAxisHandler : public InputHandler
|
class JoyAxisHandler : public InputHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -18,4 +18,4 @@ private:
|
|||||||
|
|
||||||
bool pressed_;
|
bool pressed_;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "JoyButtonHandler.h"
|
#include "JoyButtonHandler.h"
|
||||||
|
/*
|
||||||
JoyButtonHandler::JoyButtonHandler(SDL_JoystickID joynum, Uint8 button)
|
JoyButtonHandler::JoyButtonHandler(SDL_JoystickID joynum, Uint8 button)
|
||||||
: joynum_(joynum)
|
: joynum_(joynum)
|
||||||
, button_(button)
|
, button_(button)
|
||||||
@ -28,5 +28,5 @@ bool JoyButtonHandler::update(SDL_Event &e)
|
|||||||
bool JoyButtonHandler::pressed()
|
bool JoyButtonHandler::pressed()
|
||||||
{
|
{
|
||||||
return pressed_;
|
return pressed_;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "InputHandler.h"
|
#include "InputHandler.h"
|
||||||
|
/*
|
||||||
class JoyButtonHandler : public InputHandler
|
class JoyButtonHandler : public InputHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -16,3 +16,4 @@ private:
|
|||||||
bool pressed_;
|
bool pressed_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "JoyHatHandler.h"
|
#include "JoyHatHandler.h"
|
||||||
|
/*
|
||||||
JoyHatHandler::JoyHatHandler(SDL_JoystickID joynum, Uint8 hatnum, Uint8 direction)
|
JoyHatHandler::JoyHatHandler(SDL_JoystickID joynum, Uint8 hatnum, Uint8 direction)
|
||||||
: joynum_(joynum)
|
: joynum_(joynum)
|
||||||
, hatnum_(hatnum)
|
, hatnum_(hatnum)
|
||||||
@ -26,3 +26,4 @@ bool JoyHatHandler::pressed()
|
|||||||
return pressed_;
|
return pressed_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "InputHandler.h"
|
#include "InputHandler.h"
|
||||||
|
/*
|
||||||
class JoyHatHandler : public InputHandler
|
class JoyHatHandler : public InputHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -17,3 +17,4 @@ private:
|
|||||||
bool pressed_;
|
bool pressed_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
|
|||||||
@ -124,10 +124,10 @@ UserInput::UserInput(Configuration &c)
|
|||||||
currentKeyState_[i] = false;
|
currentKeyState_[i] = false;
|
||||||
lastKeyState_[i] = false;
|
lastKeyState_[i] = false;
|
||||||
}
|
}
|
||||||
for ( unsigned int i = 0; i < cMaxJoy; i++ )
|
/*for ( unsigned int i = 0; i < cMaxJoy; i++ )
|
||||||
{
|
{
|
||||||
joysticks_[i] = -1;
|
joysticks_[i] = -1;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
UserInput::~UserInput()
|
UserInput::~UserInput()
|
||||||
@ -267,7 +267,7 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required)
|
|||||||
}
|
}
|
||||||
else if (token.find("joy") == 0)
|
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;
|
int joynum;
|
||||||
if ( isdigit( joydesc.at( 0 ) ) )
|
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());
|
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));
|
keyHandlers_.push_back(std::pair<InputHandler *, KeyCode_E>(new JoyAxisHandler(joynum, axis, min, max), key));
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}*/
|
||||||
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
@ -387,7 +388,7 @@ bool UserInput::update( SDL_Event &e )
|
|||||||
memset( currentKeyState_, 0, sizeof( currentKeyState_ ) );
|
memset( currentKeyState_, 0, sizeof( currentKeyState_ ) );
|
||||||
|
|
||||||
// Handle adding a joystick
|
// Handle adding a joystick
|
||||||
if ( e.type == SDL_JOYDEVICEADDED )
|
/*if ( e.type == SDL_JOYDEVICEADDED )
|
||||||
{
|
{
|
||||||
SDL_JoystickID id = SDL_JoystickInstanceID( SDL_JoystickOpen( e.jdevice.which ) );
|
SDL_JoystickID id = SDL_JoystickInstanceID( SDL_JoystickOpen( e.jdevice.which ) );
|
||||||
for ( unsigned int i = 0; i < cMaxJoy; i++ )
|
for ( unsigned int i = 0; i < cMaxJoy; i++ )
|
||||||
@ -431,7 +432,7 @@ bool UserInput::update( SDL_Event &e )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < keyHandlers_.size( ); ++i )
|
for ( unsigned int i = 0; i < keyHandlers_.size( ); ++i )
|
||||||
{
|
{
|
||||||
@ -458,11 +459,11 @@ bool UserInput::newKeyPressed(KeyCode_E code)
|
|||||||
return currentKeyState_[code] && !lastKeyState_[code];
|
return currentKeyState_[code] && !lastKeyState_[code];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void UserInput::clearJoysticks( )
|
void UserInput::clearJoysticks( )
|
||||||
{
|
{
|
||||||
for ( unsigned int i = 0; i < cMaxJoy; i++ )
|
for ( unsigned int i = 0; i < cMaxJoy; i++ )
|
||||||
{
|
{
|
||||||
joysticks_[i] = -1;
|
joysticks_[i] = -1;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#include <SDL2/SDL_joystick.h>
|
//#include <SDL/SDL_joystick.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -75,7 +75,7 @@ private:
|
|||||||
bool MapKey(std::string keyDescription, KeyCode_E key);
|
bool MapKey(std::string keyDescription, KeyCode_E key);
|
||||||
bool MapKey(std::string keyDescription, KeyCode_E key, bool required);
|
bool MapKey(std::string keyDescription, KeyCode_E key, bool required);
|
||||||
Configuration &config_;
|
Configuration &config_;
|
||||||
SDL_JoystickID joysticks_[cMaxJoy];
|
//SDL_JoystickID joysticks_[cMaxJoy];
|
||||||
std::vector<std::pair<InputHandler *, KeyCode_E> > keyHandlers_;
|
std::vector<std::pair<InputHandler *, KeyCode_E> > keyHandlers_;
|
||||||
bool lastKeyState_[KeyCodeMax];
|
bool lastKeyState_[KeyCodeMax];
|
||||||
bool currentKeyState_[KeyCodeMax];
|
bool currentKeyState_[KeyCodeMax];
|
||||||
|
|||||||
@ -176,10 +176,10 @@ void RetroFE::launchExit( )
|
|||||||
SDL_Event e;
|
SDL_Event e;
|
||||||
while ( SDL_PollEvent( &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_.update( e );
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
input_.resetStates( );
|
input_.resetStates( );
|
||||||
attract_.reset( );
|
attract_.reset( );
|
||||||
@ -208,7 +208,7 @@ void RetroFE::freeGraphicsMemory( )
|
|||||||
{
|
{
|
||||||
currentPage_->deInitializeFonts( );
|
currentPage_->deInitializeFonts( );
|
||||||
SDL::deInitialize( );
|
SDL::deInitialize( );
|
||||||
input_.clearJoysticks( );
|
//input_.clearJoysticks( );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user