Joysticks and buttons now work. Fixed alphetical scrolling bug when list was empty.

This commit is contained in:
emb 2015-07-27 12:50:31 -05:00
parent dcd5e942b3
commit 1f0b2c70fa
4 changed files with 13 additions and 10 deletions

View File

@ -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

View File

@ -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());

View File

@ -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)

View File

@ -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();