mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-30 12:05:39 +00:00
Sorted list after gamelist.xml is parsed. Added restart to GuiMenu.
This commit is contained in:
parent
cd4ebeafa2
commit
284a7a5dc6
|
@ -1,6 +1,6 @@
|
||||||
August 4
|
August 4
|
||||||
-Moved configuration files to $HOME/.emulationstation/
|
-Moved configuration files to $HOME/.emulationstation/
|
||||||
-Renderer::loadFonts() will now fall back to /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf if LinLibertine.ttf is not
|
-Renderer::loadFonts() will now fall back to /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf if LinLibertine.ttf is not found.
|
||||||
-Folders should now be sorted alphabetically
|
-All folders should now be sorted alphabetically
|
||||||
-Added Menu button
|
-Added Menu button
|
||||||
-Added simple menu
|
-Added menu consisting of bash commands for "Restart" and "Shutdown"
|
||||||
|
|
|
@ -60,9 +60,11 @@ void parseXMLFile(std::string xmlpath)
|
||||||
std::string path = pathNode.text().get();
|
std::string path = pathNode.text().get();
|
||||||
|
|
||||||
GameData* game = NULL;
|
GameData* game = NULL;
|
||||||
|
SystemData* system = NULL;
|
||||||
for(unsigned int i = 0; i < SystemData::sSystemVector.size(); i++)
|
for(unsigned int i = 0; i < SystemData::sSystemVector.size(); i++)
|
||||||
{
|
{
|
||||||
game = searchFolderByPath(SystemData::sSystemVector.at(i)->getRootFolder(), path);
|
system = SystemData::sSystemVector.at(i);
|
||||||
|
game = searchFolderByPath(system->getRootFolder(), path);
|
||||||
if(game != NULL)
|
if(game != NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -86,4 +88,12 @@ void parseXMLFile(std::string xmlpath)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "XML parsing complete.\n";
|
std::cout << "XML parsing complete.\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//sort all systems
|
||||||
|
for(unsigned int i = 0; i < SystemData::sSystemVector.size(); i++)
|
||||||
|
{
|
||||||
|
SystemData::sSystemVector.at(i)->getRootFolder()->sort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,4 +131,6 @@ void GuiInputConfig::writeConfig()
|
||||||
{
|
{
|
||||||
file << "AXISNEG " << iter->first << " " << iter->second << "\n";
|
file << "AXISNEG " << iter->first << " " << iter->second << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
template <typename listType>
|
template <typename listType>
|
||||||
GuiList<listType>::GuiList(int offsetX, int offsetY)
|
GuiList<listType>::GuiList(int offsetX, int offsetY, Renderer::FontSize fontsize)
|
||||||
{
|
{
|
||||||
mSelection = 0;
|
mSelection = 0;
|
||||||
mScrollDir = 0;
|
mScrollDir = 0;
|
||||||
|
@ -12,6 +12,8 @@ GuiList<listType>::GuiList(int offsetX, int offsetY)
|
||||||
mOffsetX = offsetX;
|
mOffsetX = offsetX;
|
||||||
mOffsetY = offsetY;
|
mOffsetY = offsetY;
|
||||||
|
|
||||||
|
mFont = fontsize;
|
||||||
|
|
||||||
InputManager::registerComponent(this);
|
InputManager::registerComponent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,10 +26,8 @@ GuiList<listType>::~GuiList()
|
||||||
template <typename listType>
|
template <typename listType>
|
||||||
void GuiList<listType>::onRender()
|
void GuiList<listType>::onRender()
|
||||||
{
|
{
|
||||||
Renderer::FontSize fontsize = Renderer::MEDIUM;
|
|
||||||
|
|
||||||
const int cutoff = mOffsetY;
|
const int cutoff = mOffsetY;
|
||||||
const int entrySize = Renderer::getFontHeight(fontsize) + 5;
|
const int entrySize = Renderer::getFontHeight(mFont) + 5;
|
||||||
|
|
||||||
int startEntry = 0;
|
int startEntry = 0;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ void GuiList<listType>::onRender()
|
||||||
|
|
||||||
if(mRowVector.size() == 0)
|
if(mRowVector.size() == 0)
|
||||||
{
|
{
|
||||||
Renderer::drawCenteredText("The list is empty.", 0, y, 0xFF0000);
|
Renderer::drawCenteredText("The list is empty.", 0, y, 0xFF0000, mFont);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,11 +60,11 @@ void GuiList<listType>::onRender()
|
||||||
{
|
{
|
||||||
if(mSelection == i)
|
if(mSelection == i)
|
||||||
{
|
{
|
||||||
Renderer::drawRect(mOffsetX, y, Renderer::getScreenWidth(), Renderer::getFontHeight(fontsize), 0x000000);
|
Renderer::drawRect(mOffsetX, y, Renderer::getScreenWidth(), Renderer::getFontHeight(mFont), 0x000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListRow row = mRowVector.at((unsigned int)i);
|
ListRow row = mRowVector.at((unsigned int)i);
|
||||||
Renderer::drawCenteredText(row.name, mOffsetX, y, row.color);
|
Renderer::drawCenteredText(row.name, mOffsetX, y, row.color, mFont);
|
||||||
y += entrySize;
|
y += entrySize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ template <typename listType>
|
||||||
class GuiList : public GuiComponent
|
class GuiList : public GuiComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GuiList(int offsetX = 0, int offsetY = 0);
|
GuiList(int offsetX = 0, int offsetY = 0, Renderer::FontSize fontsize = Renderer::MEDIUM);
|
||||||
~GuiList();
|
~GuiList();
|
||||||
|
|
||||||
void onRender();
|
void onRender();
|
||||||
|
@ -32,6 +32,8 @@ private:
|
||||||
int mScrollDir, mScrollAccumulator;
|
int mScrollDir, mScrollAccumulator;
|
||||||
bool mScrolling;
|
bool mScrolling;
|
||||||
|
|
||||||
|
Renderer::FontSize mFont;
|
||||||
|
|
||||||
int mOffsetX, mOffsetY;
|
int mOffsetX, mOffsetY;
|
||||||
|
|
||||||
struct ListRow
|
struct ListRow
|
||||||
|
|
|
@ -6,14 +6,15 @@ GuiMenu::GuiMenu(GuiComponent* parent)
|
||||||
mParent = parent;
|
mParent = parent;
|
||||||
parent->pause();
|
parent->pause();
|
||||||
|
|
||||||
mList = new GuiList<std::string>(Renderer::getScreenWidth() * 0.5, 20);
|
mList = new GuiList<std::string>(0, Renderer::getFontHeight(Renderer::LARGE) + 2, Renderer::LARGE);
|
||||||
|
populateList();
|
||||||
addChild(mList);
|
addChild(mList);
|
||||||
|
|
||||||
mSkippedMenuClose = false;
|
mSkippedMenuClose = false;
|
||||||
|
|
||||||
Renderer::registerComponent(this);
|
Renderer::registerComponent(this);
|
||||||
InputManager::registerComponent(this);
|
InputManager::registerComponent(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiMenu::~GuiMenu()
|
GuiMenu::~GuiMenu()
|
||||||
|
@ -48,8 +49,8 @@ void GuiMenu::populateList()
|
||||||
{
|
{
|
||||||
mList->clear();
|
mList->clear();
|
||||||
|
|
||||||
mList->addObject("Nothing", "");
|
mList->addObject("Restart", "sudo shutdown -r now", 0x0000FF);
|
||||||
mList->addObject("Shutdown", "sudo shutdown -h now");
|
mList->addObject("Shutdown", "sudo shutdown -h now", 0x0000FF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiMenu::onRender()
|
void GuiMenu::onRender()
|
||||||
|
|
|
@ -67,7 +67,7 @@ int main(int argc, char* argv[])
|
||||||
std::string configDir = home + "/.emulationstation";
|
std::string configDir = home + "/.emulationstation";
|
||||||
if(!boost::filesystem::exists(configDir))
|
if(!boost::filesystem::exists(configDir))
|
||||||
{
|
{
|
||||||
std::cout << "Creating config directory " << configDir << "\n";
|
std::cout << "Creating config directory \"" << configDir << "\"\n";
|
||||||
boost::filesystem::create_directory(configDir);
|
boost::filesystem::create_directory(configDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,8 +82,7 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
if(boost::filesystem::exists(oldInpPath))
|
if(boost::filesystem::exists(oldInpPath))
|
||||||
{
|
{
|
||||||
std::cout << "Moving old input config file " << oldInpPath << " to new path at " << InputManager::getConfigPath() << "\n";
|
std::cout << "Deleting old input config file\n";
|
||||||
boost::filesystem::copy_file(oldInpPath, InputManager::getConfigPath());
|
|
||||||
boost::filesystem::remove(oldInpPath);
|
boost::filesystem::remove(oldInpPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue