mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 17:58:53 +01:00
Joysticks and buttons now work. Fixed alphetical scrolling bug when list was empty.
This commit is contained in:
parent
dcd5e942b3
commit
1f0b2c70fa
@ -145,7 +145,7 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key)
|
||||
Logger::write(Logger::ZONE_INFO, "Input", "Binding joypad button " + ss.str() );
|
||||
return true;
|
||||
}
|
||||
else if(joydesc.find("hat"))
|
||||
else if(joydesc.find("hat") == 0)
|
||||
{
|
||||
Uint8 hat;
|
||||
|
||||
@ -170,26 +170,26 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key)
|
||||
Logger::write(Logger::ZONE_INFO, "Input", "Binding joypad hat " + joydesc );
|
||||
return true;
|
||||
}
|
||||
else if(joydesc.find("axis"))
|
||||
else if(joydesc.find("axis") == 0)
|
||||
{
|
||||
// string is now axis0+
|
||||
unsigned int axis;
|
||||
Sint16 min;
|
||||
Sint16 max;
|
||||
Utils::replace(joydesc, "axis", "");
|
||||
joydesc = Utils::replace(joydesc, "axis", "");
|
||||
|
||||
// string is now 0+
|
||||
if(joydesc.find("-") != std::string::npos)
|
||||
{
|
||||
min = -32768;
|
||||
max = -1000;
|
||||
Utils::replace(joydesc, "-", "");
|
||||
joydesc = Utils::replace(joydesc, "-", "");
|
||||
}
|
||||
else if(joydesc.find("+") != std::string::npos)
|
||||
{
|
||||
min = 1000;
|
||||
max = 32767;
|
||||
Utils::replace(joydesc, "+", "");
|
||||
joydesc = Utils::replace(joydesc, "+", "");
|
||||
}
|
||||
|
||||
// string is now just the axis number
|
||||
|
||||
@ -40,6 +40,9 @@ Configuration::~Configuration()
|
||||
|
||||
void Configuration::initialize()
|
||||
{
|
||||
absolutePath = "D:/RetroFE";
|
||||
return;
|
||||
|
||||
const char *environment = std::getenv("RETROFE_PATH");
|
||||
std::string environmentStr;
|
||||
if (environment != NULL)
|
||||
@ -55,7 +58,7 @@ void Configuration::initialize()
|
||||
GetModuleFileName(hModule, exe, MAX_PATH);
|
||||
std::string sPath(exe);
|
||||
sPath = Utils::getDirectory(sPath);
|
||||
sPath = Utils::GetParentDirectory(sPath);
|
||||
sPath = Utils::getParentDirectory(sPath);
|
||||
#else
|
||||
char exepath[1024];
|
||||
sprintf(exepath, "/proc/%d/exe", getpid());
|
||||
|
||||
@ -374,7 +374,7 @@ bool Component::animate(bool loop)
|
||||
for(unsigned int i = 0; i < tweens->size(); i++)
|
||||
{
|
||||
Tween *tween = tweens->tweens()->at(i);
|
||||
float elapsedTime = elapsedTweenTime_;
|
||||
double elapsedTime = elapsedTweenTime_;
|
||||
|
||||
//todo: too many levels of nesting
|
||||
if(elapsedTime < tween->duration)
|
||||
|
||||
@ -179,7 +179,7 @@ void ScrollingList::deallocateSpritePoints()
|
||||
|
||||
unsigned int spriteIndex = firstSpriteIndex_;
|
||||
|
||||
for(unsigned int i = 0; i < scrollPoints_->size(); ++i)
|
||||
for(unsigned int i = 0; i < scrollPoints_->size() && spriteList_->size() > spriteIndex; ++i)
|
||||
{
|
||||
deallocateTexture(spriteList_->at(spriteIndex));
|
||||
circularIncrement(spriteIndex, spriteList_);
|
||||
@ -393,7 +393,7 @@ void ScrollingList::letterUp()
|
||||
notifyAllRequested_ = true;
|
||||
deallocateSpritePoints();
|
||||
|
||||
if(spriteList_ && scrollPoints_)
|
||||
if(spriteList_ && scrollPoints_ && getSelectedCollectionItemSprite())
|
||||
{
|
||||
unsigned int i = 0;
|
||||
|
||||
@ -438,7 +438,7 @@ void ScrollingList::letterDown()
|
||||
notifyAllRequested_ = true;
|
||||
deallocateSpritePoints();
|
||||
|
||||
if(spriteList_ && scrollPoints_)
|
||||
if(spriteList_ && scrollPoints_ && getSelectedCollectionItemSprite())
|
||||
{
|
||||
|
||||
std::string startname = getSelectedCollectionItemSprite()->item->lowercaseFullTitle();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user