Ran astyle to follow allman coding standard.

This commit is contained in:
Don Honerbrink 2015-02-17 08:41:07 -06:00
parent 6c4dfcb9af
commit 86200ad731
20 changed files with 275 additions and 167 deletions

View File

@ -35,7 +35,7 @@ CollectionInfo::CollectionInfo(std::string name,
CollectionInfo::~CollectionInfo()
{
std::vector<Item *>::iterator it = Items.begin();
while(it != Items.end())
{
delete *it;
@ -89,14 +89,14 @@ std::vector<Item *> *CollectionInfo::GetItems()
return &Items;
}
bool CollectionInfo::ItemIsLess(Item const *lhs, Item const *rhs)
bool CollectionInfo::ItemIsLess(Item const *lhs, Item const *rhs)
{
return lhs->GetLCTitle() < rhs->GetLCTitle();
}
void CollectionInfo::SortItems()
{
std::sort(Items.begin(), Items.end(), ItemIsLess);
std::sort(Items.begin(), Items.end(), ItemIsLess);
}

View File

@ -36,7 +36,7 @@ public:
void GetExtensions(std::vector<std::string> &extensions);
private:
static bool ItemIsLess(Item const *lhs, Item const *rhs);
static bool ItemIsLess(Item const *lhs, Item const *rhs);
std::string Name;
std::string ListPath;

View File

@ -84,7 +84,10 @@ bool CollectionInfoBuilder::ImportBasicList(CollectionInfo *info, std::string fi
{
std::ifstream includeStream(file.c_str());
if (!includeStream.good()) { return false; }
if (!includeStream.good())
{
return false;
}
std::string line;
@ -121,14 +124,14 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info)
ImportBasicList(info, includeFile, includeFilter);
ImportBasicList(info, excludeFile, excludeFilter);
std::vector<std::string> extensions;
std::vector<std::string>::iterator extensionsIt;
info->GetExtensions(extensions);
(void)Conf.GetProperty("collections." + info->GetName() + ".launcher", launcher);
Logger::Write(Logger::ZONE_ERROR, "CollectionInfoBuilder", "Check path " + includeFile);
Logger::Write(Logger::ZONE_ERROR, "CollectionInfoBuilder", "Check path " + includeFile);
dp = opendir(path.c_str());
@ -137,7 +140,7 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info)
Logger::Write(Logger::ZONE_ERROR, "CollectionInfoBuilder", "Could not read directory \"" + path + "\"");
return false;
}
while((dirp = readdir(dp)) != NULL)
{
std::string file = dirp->d_name;

View File

@ -81,7 +81,7 @@ bool MenuParser::GetMenuItems(CollectionInfo *collection)
{
import = importAttribute->value();
}
if(import != "true")
{
//todo, check for empty string

View File

@ -205,7 +205,7 @@ bool Configuration::GetProperty(std::string key, std::string &value)
GetRawProperty("baseMediaPath", baseMediaPath);
GetRawProperty("baseItemPath", baseItemPath);
collectionName = GetCurrentCollection();
value = Utils::Replace(value, "%BASE_MEDIA_PATH%", baseMediaPath);
value = Utils::Replace(value, "%BASE_ITEM_PATH%", baseItemPath);
value = Utils::Replace(value, "%ITEM_COLLECTION_NAME%", collectionName);
@ -343,7 +343,10 @@ void Configuration::GetMediaPropertyAbsolutePath(std::string collectionName, std
{
std::string key = "media." + collectionName + "." + mediaType;
if(GetPropertyAbsolutePath(key, value)) { return; }
if(GetPropertyAbsolutePath(key, value))
{
return;
}
std::string baseMediaPath;
if(!GetPropertyAbsolutePath("baseMediaPath", baseMediaPath))
@ -358,7 +361,10 @@ void Configuration::GetCollectionAbsolutePath(std::string collectionName, std::s
{
std::string key = "collections." + collectionName + ".list.path";
if(GetPropertyAbsolutePath(key, value)) { return; }
if(GetPropertyAbsolutePath(key, value))
{
return;
}
std::string baseItemPath;
if(!GetPropertyAbsolutePath("baseItemPath", baseItemPath))

View File

@ -64,7 +64,7 @@ bool MetadataDatabase::ResetDatabase()
Logger::Write(Logger::ZONE_ERROR, "Metadata", ss.str());
return false;
}
return Initialize();
}
@ -131,7 +131,7 @@ bool MetadataDatabase::ImportDirectory()
basename = basename.substr(0, basename.find_last_of("."));
std::string collectionName = basename.substr(0, basename.find_first_of("."));
if(extension == ".xml")
{
std::string importFile = hyperListPath + "/" + dirp->d_name;
@ -140,41 +140,41 @@ bool MetadataDatabase::ImportDirectory()
}
}
}
closedir(dp);
}
dp = opendir(mameListPath.c_str());
if(dp == NULL)
{
Logger::Write(Logger::ZONE_ERROR, "CollectionInfoBuilder", "Could not read directory \"" + mameListPath + "\"");
}
else
{
while((dirp = readdir(dp)) != NULL)
{
if (dirp->d_type != DT_DIR && std::string(dirp->d_name) != "." && std::string(dirp->d_name) != "..")
{
else
{
while((dirp = readdir(dp)) != NULL)
{
if (dirp->d_type != DT_DIR && std::string(dirp->d_name) != "." && std::string(dirp->d_name) != "..")
{
std::string basename = dirp->d_name;
std::string basename = dirp->d_name;
std::string extension = basename.substr(basename.find_last_of("."), basename.size()-1);
basename = basename.substr(0, basename.find_last_of("."));
std::string collectionName = basename.substr(0, basename.find_first_of("."));
std::string extension = basename.substr(basename.find_last_of("."), basename.size()-1);
basename = basename.substr(0, basename.find_last_of("."));
std::string collectionName = basename.substr(0, basename.find_first_of("."));
if(extension == ".xml")
{
std::string importFile = mameListPath + "/" + dirp->d_name;
Logger::Write(Logger::ZONE_INFO, "Metadata", "Importing mamelist: " + importFile);
Config.SetStatus("Scraping data from " + importFile);
ImportMameList(importFile, collectionName);
}
}
}
closedir(dp);
if(extension == ".xml")
{
std::string importFile = mameListPath + "/" + dirp->d_name;
Logger::Write(Logger::ZONE_INFO, "Metadata", "Importing mamelist: " + importFile);
Config.SetStatus("Scraping data from " + importFile);
ImportMameList(importFile, collectionName);
}
}
}
closedir(dp);
}
return true;
@ -259,7 +259,7 @@ void MetadataDatabase::InjectMetadata(CollectionInfo *collection)
}
std::map<std::string, Item *>::iterator it = itemMap.find(name);
if(it != itemMap.end())
{
Item *item = it->second;
@ -321,7 +321,7 @@ bool MetadataDatabase::ImportHyperList(std::string hyperlistFile, std::string co
return false;
}
sqlite3 *handle = DBInstance.GetHandle();
sqlite3_exec(handle, "BEGIN IMMEDIATE TRANSACTION;", NULL, NULL, &error);
sqlite3_exec(handle, "BEGIN IMMEDIATE TRANSACTION;", NULL, NULL, &error);
for(rapidxml::xml_node<> *game = root->first_node("game"); game; game = game->next_sibling("game"))
{
rapidxml::xml_attribute<> *nameXml = game->first_attribute("name");
@ -348,8 +348,8 @@ bool MetadataDatabase::ImportHyperList(std::string hyperlistFile, std::string co
sqlite3_stmt *stmt;
sqlite3_prepare_v2(handle,
"INSERT OR REPLACE INTO Meta (name, title, year, manufacturer, cloneOf, collectionName) VALUES (?,?,?,?,?,?)",
-1, &stmt, 0);
"INSERT OR REPLACE INTO Meta (name, title, year, manufacturer, cloneOf, collectionName) VALUES (?,?,?,?,?,?)",
-1, &stmt, 0);
sqlite3_bind_text(stmt, 1, name.c_str(), -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 2, description.c_str(), -1, SQLITE_TRANSIENT);
@ -453,8 +453,8 @@ bool MetadataDatabase::ImportMameList(std::string filename, std::string collecti
sqlite3_stmt *stmt;
sqlite3_prepare_v2(handle,
"INSERT OR REPLACE INTO Meta (name, title, year, manufacturer, players, buttons, cloneOf, collectionName) VALUES (?,?,?,?,?,?,?,?)",
-1, &stmt, 0);
"INSERT OR REPLACE INTO Meta (name, title, year, manufacturer, players, buttons, cloneOf, collectionName) VALUES (?,?,?,?,?,?,?,?)",
-1, &stmt, 0);
sqlite3_bind_text(stmt, 1, name.c_str(), -1, SQLITE_TRANSIENT);

View File

@ -266,7 +266,7 @@ bool Launcher::GetExtensions(std::string &extensions, std::string collection)
bool Launcher::GetCollectionDirectory(std::string &directory, std::string collection)
{
std::string itemsPathValue;
// find the items path folder (i.e. ROM path)
Config.GetCollectionAbsolutePath(collection, itemsPathValue);
directory += itemsPathValue + "/";

View File

@ -19,23 +19,23 @@
TweenSets::TweenSets()
{
}
TweenSets::TweenSets(TweenSets &copy)
{
TweenSets::TweenSets(TweenSets &copy)
{
std::map<std::string, std::map<int, TweenAttributes *> >::iterator it;
for(it = copy.TweenMap.begin(); it != copy.TweenMap.end(); it++)
{
std::map<int, TweenAttributes *>::iterator it2;
for(it2 = (it->second).begin(); it2 != (it->second).end(); it2++)
{
TweenMap[it->first][it2->first] = it2->second;
}
}
}
TweenSets::~TweenSets()
for(it = copy.TweenMap.begin(); it != copy.TweenMap.end(); it++)
{
std::map<int, TweenAttributes *>::iterator it2;
for(it2 = (it->second).begin(); it2 != (it->second).end(); it2++)
{
TweenMap[it->first][it2->first] = it2->second;
}
}
}
TweenSets::~TweenSets()
{
DestroyTweens();
}
@ -43,20 +43,20 @@ TweenSets::~TweenSets()
void TweenSets::DestroyTweens()
{
std::map<std::string, std::map<int, TweenAttributes *> >::iterator it = TweenMap.begin();
while(it != TweenMap.end())
{
std::map<int, TweenAttributes *>::iterator it2 = (it->second).begin();
while(it2 != (it->second).end())
{
delete it2->second;
(it->second).erase(it2);
it2 = (it->second).begin();
}
it =TweenMap.begin();
}
while(it != TweenMap.end())
{
std::map<int, TweenAttributes *>::iterator it2 = (it->second).begin();
while(it2 != (it->second).end())
{
delete it2->second;
(it->second).erase(it2);
it2 = (it->second).begin();
}
it =TweenMap.begin();
}
}
TweenSets::TweenAttributes *TweenSets::GetTween(std::string tween)
@ -68,11 +68,11 @@ TweenSets::TweenAttributes *TweenSets::GetTween(std::string tween, int index)
{
return FindTween(TweenMap[tween], index);
}
void TweenSets::SetTween(std::string tween, int index, TweenAttributes *set)
{
TweenMap[tween][index] = set;
}
void TweenSets::SetTween(std::string tween, int index, TweenAttributes *set)
{
TweenMap[tween][index] = set;
}
TweenSets::TweenAttributes *TweenSets::FindTween(std::map<int, TweenAttributes *> &tweens, int index)
{
@ -88,6 +88,6 @@ TweenSets::TweenAttributes *TweenSets::FindTween(std::map<int, TweenAttributes *
}
return tweens[index];
}
}

View File

@ -33,8 +33,8 @@ public:
void SetTween(std::string tween, int index, TweenAttributes *set);
private:
TweenAttributes *FindTween(std::map<int, TweenAttributes *> &tweens, int index);
void DestroyTweens();
TweenAttributes *FindTween(std::map<int, TweenAttributes *> &tweens, int index);
void DestroyTweens();
std::map<std::string, std::map<int, TweenAttributes *> > TweenMap;
};

View File

@ -151,15 +151,15 @@ void Component::SetCollectionName(std::string collectionName)
CollectionName = collectionName;
}
TweenSets *Component::GetTweens()
{
return Tweens;
TweenSets *Component::GetTweens()
{
return Tweens;
}
void Component::SetTweens(TweenSets *set)
{
Tweens = set;
CurrentAnimationState = IDLE;
CurrentAnimationState = IDLE;
CurrentTweenIndex = 0;
CurrentTweenComplete = false;
ElapsedTweenTime = 0;
@ -237,8 +237,8 @@ void Component::Update(float dt)
// prevent us from automatically jumping to the exit tween upon enter
if(EnterRequested)
{
EnterRequested = false;
NewItemSelected = false;
EnterRequested = false;
NewItemSelected = false;
}
else if(MenuExitRequested && (!MenuEnterRequested || MenuExitRequested <= MenuEnterRequested))
{
@ -273,7 +273,7 @@ void Component::Update(float dt)
case HIGHLIGHT_EXIT:
// intentionally break down
// intentionally break down
case HIGHLIGHT_WAIT:
if(ExitRequested && (CurrentAnimationState == HIGHLIGHT_WAIT))

View File

@ -172,7 +172,7 @@ void ReloadableMedia::ReloadTexture()
}
std::string imageBasename = selectedItem->GetFullTitle();
std::string typeLC = Utils::ToLower(Type);
if(typeLC == "numberButtons")
@ -200,9 +200,9 @@ void ReloadableMedia::ReloadTexture()
{
std::string imagePath;
Config.GetMediaPropertyAbsolutePath(GetCollectionName(), Type, imagePath);
ImageBuilder imageBuild;
LoadedComponent = imageBuild.CreateImage(imagePath, imageBasename, ScaleX, ScaleY);
if (LoadedComponent != NULL)

View File

@ -78,7 +78,10 @@ void ScrollingList::SetItems(std::vector<ComponentItemBinding *> *spriteList)
SpriteList = spriteList;
FirstSpriteIndex = 0;
if(!SpriteList) { return; }
if(!SpriteList)
{
return;
}
unsigned int originalSize = SpriteList->size();
// loop the scroll points if there are not enough, the +2 represents the head and tail nodes (for when the item is allocated)
@ -115,7 +118,10 @@ void ScrollingList::SetStartScrollTime(float value)
void ScrollingList::DeallocateSpritePoints()
{
if(!SpriteList) { return; }
if(!SpriteList)
{
return;
}
unsigned int spriteIndex = FirstSpriteIndex;
@ -128,10 +134,22 @@ void ScrollingList::DeallocateSpritePoints()
void ScrollingList::AllocateSpritePoints()
{
if(!ScrollPoints) { return; }
if(!SpriteList) { return; }
if(SpriteList->size() == 0) { return; }
if(!TweenPoints) { return; }
if(!ScrollPoints)
{
return;
}
if(!SpriteList)
{
return;
}
if(SpriteList->size() == 0)
{
return;
}
if(!TweenPoints)
{
return;
}
unsigned int spriteIndex = FirstSpriteIndex;
@ -151,7 +169,10 @@ void ScrollingList::AllocateSpritePoints()
void ScrollingList::DestroyItems()
{
if(!SpriteList) { return; }
if(!SpriteList)
{
return;
}
std::vector<ComponentItemBinding *>::iterator it = SpriteList->begin();
while(it != SpriteList->end())
@ -203,8 +224,14 @@ void ScrollingList::SetSelectedIndex(int selectedIndex)
void ScrollingList::Click(double nextScrollTime)
{
if(!SpriteList) { return; }
if(SpriteList->size() == 0) { return; }
if(!SpriteList)
{
return;
}
if(SpriteList->size() == 0)
{
return;
}
unsigned int listSize = ScrollPoints->size();
unsigned int end = CircularIncrement(FirstSpriteIndex, listSize - 1, SpriteList);
@ -321,10 +348,22 @@ void ScrollingList::TriggerMenuEnterEvent()
Focus = true;
NotifyAllRequested = true;
if(!ScrollPoints) { return; }
if(!SpriteList) { return; }
if(SpriteList->size() == 0 ) { return; }
if(FirstSpriteIndex >= SpriteList->size()) { return; }
if(!ScrollPoints)
{
return;
}
if(!SpriteList)
{
return;
}
if(SpriteList->size() == 0 )
{
return;
}
if(FirstSpriteIndex >= SpriteList->size())
{
return;
}
unsigned int spriteIndex = FirstSpriteIndex;
@ -347,10 +386,22 @@ void ScrollingList::TriggerMenuExitEvent()
Focus = false;
NotifyAllRequested = true;
if(!ScrollPoints) { return; }
if(!SpriteList) { return; }
if(SpriteList->size() == 0 ) { return; }
if(FirstSpriteIndex >= SpriteList->size()) { return; }
if(!ScrollPoints)
{
return;
}
if(!SpriteList)
{
return;
}
if(SpriteList->size() == 0 )
{
return;
}
if(FirstSpriteIndex >= SpriteList->size())
{
return;
}
unsigned int spriteIndex = FirstSpriteIndex;
@ -374,9 +425,18 @@ void ScrollingList::Update(float dt)
bool initializePoints = false;
Component::Update(dt);
if(!ScrollPoints) { return; }
if(!SpriteList) { return; }
if(SpriteList->size() == 0) { return; }
if(!ScrollPoints)
{
return;
}
if(!SpriteList)
{
return;
}
if(SpriteList->size() == 0)
{
return;
}
bool readyToScroll = true;
bool scrollChanged = false;
@ -422,7 +482,7 @@ void ScrollingList::Update(float dt)
Click(0);
CurrentScrollState = ScrollStateIdle;
scrollStopped = true;
// update the tweens now that we are done
unsigned int spriteIndex = FirstSpriteIndex;
@ -517,10 +577,22 @@ void ScrollingList::UpdateSprite(unsigned int spriteIndex, unsigned int pointInd
void ScrollingList::ResetTweens(Component *c, TweenSets *sets, ViewInfo *currentViewInfo, ViewInfo *nextViewInfo, double scrollTime)
{
if(!c) { return; }
if(!sets) { return; }
if(!currentViewInfo) { return; }
if(!nextViewInfo) { return; }
if(!c)
{
return;
}
if(!sets)
{
return;
}
if(!currentViewInfo)
{
return;
}
if(!nextViewInfo)
{
return;
}
currentViewInfo->SetImageHeight(c->GetBaseViewInfo()->GetImageHeight());
currentViewInfo->SetImageWidth(c->GetBaseViewInfo()->GetImageWidth());
@ -546,9 +618,9 @@ void ScrollingList::ResetTweens(Component *c, TweenSets *sets, ViewInfo *current
delete *it;
scrollTween->erase(it);
it = scrollTween->begin();
}
scrollTween->clear();
c->UpdateBaseViewInfo(*currentViewInfo);
@ -571,8 +643,11 @@ void ScrollingList::ResetTweens(Component *c, TweenSets *sets, ViewInfo *current
bool ScrollingList::AllocateTexture(ComponentItemBinding *s)
{
if(!s || s->GetComponent() != NULL) { return false; }
if(!s || s->GetComponent() != NULL)
{
return false;
}
const Item *item = s->GetCollectionItem();
//todo: will create a runtime fault if not of the right type
@ -623,9 +698,18 @@ void ScrollingList::Draw()
void ScrollingList::Draw(unsigned int layer)
{
if(!ScrollPoints) { return; }
if(!SpriteList) { return; }
if(SpriteList->size() == 0) { return; }
if(!ScrollPoints)
{
return;
}
if(!SpriteList)
{
return;
}
if(SpriteList->size() == 0)
{
return;
}
unsigned int spriteIndex = FirstSpriteIndex;
@ -802,7 +886,7 @@ int ScrollingList::CircularIncrement(unsigned int index, unsigned int offset, st
while(end >= list->size() && list->size() > 0)
{
end -= list->size();
end -= list->size();
}
return end;

View File

@ -43,13 +43,13 @@ public:
};
ScrollingList(Configuration &c,
float scaleX,
float scaleY,
Font *font,
SDL_Color fontColor,
std::string layoutKey,
std::string imageType);
ScrollingList(Configuration &c,
float scaleX,
float scaleY,
Font *font,
SDL_Color fontColor,
std::string layoutKey,
std::string imageType);
virtual ~ScrollingList();
void TriggerMenuEnterEvent();
void TriggerMenuExitEvent();
@ -96,7 +96,7 @@ private:
std::vector<ComponentItemBinding *> *SpriteList;
std::vector<ViewInfo *> *ScrollPoints;
std::vector<TweenSets *> *TweenPoints;
std::vector<TweenSets *> *TweenPoints;
std::vector<MenuNotifierInterface *> NotificationComponents;
float TweenEnterTime;
bool Focus;

View File

@ -46,7 +46,7 @@ void Text::AllocateGraphicsMemory()
Component::AllocateGraphicsMemory();
}
void Text::SetText(std::string text)
void Text::SetText(std::string text)
{
TextData = text;
}
@ -66,11 +66,11 @@ void Text::Draw()
{
Font::GlyphInfo glyph;
if(FontInst->GetRect(TextData[i], glyph))
{
imageWidth += glyph.Advance;
imageHeight = (imageHeight >= glyph.Rect.h) ? imageHeight : glyph.Rect.h;
{
imageWidth += glyph.Advance;
imageHeight = (imageHeight >= glyph.Rect.h) ? imageHeight : glyph.Rect.h;
}
}
float scale = (float)info->GetFontSize() / (float)imageHeight;
@ -107,7 +107,7 @@ void Text::Draw()
SDL::RenderCopy(t, static_cast<char>(info->GetAlpha() * 255), &charRect, &rect, info->GetAngle());
rect.x += static_cast<int>(glyph.Advance * scale);
if((static_cast<float>(rect.x) - xOrigin) > info->GetMaxWidth())
{
break;

View File

@ -341,7 +341,7 @@ bool Page::PushCollection(CollectionInfo *collection)
{
menuExitIndex = MenuDepth - 1;
}
ActiveMenu = Menus[MenuDepth];
ActiveMenu->SetCollectionName(collection->GetName());
ActiveMenu->DestroyItems();
@ -350,7 +350,7 @@ bool Page::PushCollection(CollectionInfo *collection)
if(MenuDepth < Menus.size())
{
menuEnterIndex = MenuDepth;
menuEnterIndex = MenuDepth;
MenuDepth++;
}
@ -379,11 +379,17 @@ bool Page::PopCollection()
int menuExitIndex = -1;
int menuEnterIndex = -1;
CollectionInfo *collection = NULL;
if(MenuDepth <= 1) { return false; }
if(Collections.size() <= 1) { return false; }
if(MenuDepth <= 1)
{
return false;
}
if(Collections.size() <= 1)
{
return false;
}
Collections.pop_back();
collection = Collections.back();
collection = Collections.back();
if(ActiveMenu)
{

View File

@ -45,7 +45,10 @@ public:
virtual ~Page();
virtual void OnNewItemSelected(Item *);
bool PushCollection(CollectionInfo *collection);
bool IsMenusFull() { return (MenuDepth > Menus.size()); }
bool IsMenusFull()
{
return (MenuDepth > Menus.size());
}
bool PopCollection();
void PushMenu(ScrollingList *s);
@ -72,7 +75,10 @@ public:
void StartComponents();
void Stop();
void SetScrolling(ScrollDirection direction);
unsigned int GetMenuDepth() { return MenuDepth; }
unsigned int GetMenuDepth()
{
return MenuDepth;
}
Item *GetSelectedItem();
Item *GetPendingSelectedItem();
void RemoveSelectedItem();
@ -103,7 +109,7 @@ private:
std::vector<Component *> LayerComponents[NUM_LAYERS];
std::vector<Item *> *Items;
bool ScrollActive;
Item *SelectedItem;
Text *TextStatusComponent;
bool SelectedItemChanged;

View File

@ -45,7 +45,7 @@ static const int MENU_LAST = -3; // last visible item in the list
static const int MENU_START = -1; // first item transitions here after it scrolls "off the menu/screen"
static const int MENU_END = -2; // last item transitions here after it scrolls "off the menu/screen"
static const int MENU_CENTER = -4;
//todo: this file is starting to become a god class of building. Consider splitting into sub-builders
PageBuilder::PageBuilder(std::string layoutKey, Configuration &c, FontCache *fc)
: LayoutKey(layoutKey)
@ -378,7 +378,7 @@ bool PageBuilder::BuildComponents(xml_node<> *layout, Page *page)
page->AddComponent(c);
}
}
for(xml_node<> *componentXml = layout->first_node("statusText"); componentXml; componentXml = componentXml->next_sibling("statusText"))
{
FC->LoadFont(Font, FontSize, FontColor);
@ -492,7 +492,7 @@ void PageBuilder::BuildTweenAttributes(TweenSets *tweens, xml_node<> *componentX
TweenSets::TweenAttributes *sets = new TweenSets::TweenAttributes();
GetTweenAttributes(componentXml, sets);
tweens->SetTween(tweenName, index, sets);
}
}
}
@ -568,7 +568,7 @@ void PageBuilder::BuildCustomMenu(ScrollingList *menu, xml_node<> *menuXml, xml_
{
ViewInfo *viewInfo = new ViewInfo();
BuildViewInfo(componentXml, viewInfo, itemDefaults);
points->push_back(viewInfo);
tweenPoints->push_back(CreateTweenInstance(componentXml));
xml_attribute<> *selected = componentXml->first_attribute("selected");
@ -878,7 +878,7 @@ void PageBuilder::GetTweenSets(xml_node<> *node, std::vector<Tween *> &tweens)
toValue = GetHorizontalAlignment(to, 0);
break;
// x origin gets translated to a percent
// x origin gets translated to a percent
case TWEEN_PROPERTY_X_ORIGIN:
fromValue = GetHorizontalAlignment(from, 0) / ScreenWidth;
toValue = GetHorizontalAlignment(to, 0) / ScreenWidth;
@ -892,7 +892,7 @@ void PageBuilder::GetTweenSets(xml_node<> *node, std::vector<Tween *> &tweens)
toValue = GetVerticalAlignment(to, 0);
break;
// y origin gets translated to a percent
// y origin gets translated to a percent
case TWEEN_PROPERTY_Y_ORIGIN:
fromValue = GetVerticalAlignment(from, 0) / ScreenHeight;
toValue = GetVerticalAlignment(to, 0) / ScreenHeight;

View File

@ -70,11 +70,11 @@ float ViewInfo::GetHeight() const
float scaleH = MinHeight / height;
float scaleW = MinWidth / width;
if(width >= MinWidth && height < MinHeight)
if(width >= MinWidth && height < MinHeight)
{
height = MinHeight;
}
else if(width < MinWidth && height >= MinHeight)
else if(width < MinWidth && height >= MinHeight)
{
height = scaleW * height;
}
@ -115,11 +115,11 @@ float ViewInfo::GetWidth() const
float scaleH = MinHeight / height;
float scaleW = MinWidth / width;
if(height >= MinHeight && width < MinWidth)
if(height >= MinHeight && width < MinWidth)
{
width = MinWidth;
}
else if(height < MinHeight && width >= MinWidth)
else if(height < MinHeight && width >= MinWidth)
{
width = scaleH * width;
}

View File

@ -112,7 +112,7 @@ bool ImportConfiguration(Configuration *c)
}
closedir(dp);
dp = opendir(collectionsPath.c_str());
if(dp == NULL)
@ -137,7 +137,7 @@ bool ImportConfiguration(Configuration *c)
}
}
}
closedir(dp);
Logger::Write(Logger::ZONE_INFO, "RetroFE", "Imported configuration");

View File

@ -105,7 +105,7 @@ void GStreamerVideo::ProcessNewBuffer (GstElement *fakesink, GstBuffer *buf, Gst
if(video->Height && video->Width)
{
// keep the largest video buffer allocated to avoid the penalty of reallocating and deallocating
if(!video->VideoBuffer || video->MaxVideoBufferSize < map.size)
if(!video->VideoBuffer || video->MaxVideoBufferSize < map.size)
{
if(video->VideoBuffer)
{
@ -129,7 +129,10 @@ void GStreamerVideo::ProcessNewBuffer (GstElement *fakesink, GstBuffer *buf, Gst
bool GStreamerVideo::Initialize()
{
if(Initialized) { return true; }
if(Initialized)
{
return true;
}
std::string path = Configuration::GetAbsolutePath() + "/Core";
gst_init(NULL, NULL);
@ -169,14 +172,14 @@ bool GStreamerVideo::Stop()
(void)gst_element_set_state(Playbin, GST_STATE_NULL);
}
if(Texture)
if(Texture)
{
SDL_DestroyTexture(Texture);
Texture = NULL;
}
// FreeElements();
// FreeElements();
IsPlaying = false;
Height = 0;