mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Moved configuration files to $HOME/.emulationstation/
Folders should now be sorted alphabetically. Will now fall back to a system font if LinLibertine.ttf is not found. Added a Menu button. Began working on a simple menu.
This commit is contained in:
parent
b56094fe3d
commit
eaf7df7ad5
2
Makefile
2
Makefile
|
@ -1,7 +1,7 @@
|
|||
CC=g++
|
||||
CFLAGS=-c -Wall
|
||||
LDFLAGS=-lSDL -lSDL_ttf -lSDL_image -lboost_system -lboost_filesystem
|
||||
SRCSOURCES=main.cpp Renderer.cpp Renderer_draw.cpp GuiComponent.cpp InputManager.cpp SystemData.cpp GameData.cpp FolderData.cpp XMLReader.cpp components/GuiList.cpp components/GuiGameList.cpp components/GuiInputConfig.cpp components/GuiImage.cpp pugiXML/pugixml.cpp
|
||||
SRCSOURCES=main.cpp Renderer.cpp Renderer_draw.cpp GuiComponent.cpp InputManager.cpp SystemData.cpp GameData.cpp FolderData.cpp XMLReader.cpp components/GuiList.cpp components/GuiGameList.cpp components/GuiInputConfig.cpp components/GuiImage.cpp components/GuiMenu.cpp pugiXML/pugixml.cpp
|
||||
SOURCES=$(addprefix src/,$(SRCSOURCES))
|
||||
OBJECTS=$(SOURCES:.cpp=.o)
|
||||
EXECUTABLE=emulationstation
|
||||
|
|
6
changelog.txt
Normal file
6
changelog.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
August 4
|
||||
-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
|
||||
-Folders should now be sorted alphabetically
|
||||
-Added Menu button
|
||||
-Added simple menu
|
|
@ -1,5 +1,6 @@
|
|||
#include "FolderData.h"
|
||||
#include "SystemData.h"
|
||||
#include <algorithm>
|
||||
|
||||
bool FolderData::isFolder() { return true; }
|
||||
std::string FolderData::getName() { return mName; }
|
||||
|
@ -29,3 +30,32 @@ void FolderData::pushFileData(FileData* file)
|
|||
mFileVector.push_back(file);
|
||||
}
|
||||
|
||||
//returns if file1 should come before file2
|
||||
bool filesort(FileData* file1, FileData* file2)
|
||||
{
|
||||
std::string name1 = file1->getName();
|
||||
std::string name2 = file2->getName();
|
||||
|
||||
for(unsigned int i = 0; i < name1.length(); i++)
|
||||
{
|
||||
if(name1[i] != name2[i])
|
||||
{
|
||||
if(name1[i] < name2[i])
|
||||
{
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(name1.length() < name2.length())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void FolderData::sort()
|
||||
{
|
||||
std::sort(mFileVector.begin(), mFileVector.end(), filesort);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ public:
|
|||
FileData* getFile(unsigned int i);
|
||||
|
||||
void pushFileData(FileData* file);
|
||||
|
||||
void sort();
|
||||
private:
|
||||
SystemData* mSystem;
|
||||
std::string mPath;
|
||||
|
|
|
@ -57,3 +57,18 @@ void GuiComponent::render()
|
|||
}
|
||||
}
|
||||
|
||||
void GuiComponent::pause()
|
||||
{
|
||||
onPause();
|
||||
|
||||
for(unsigned int i = 0; i < mChildren.size(); i++)
|
||||
mChildren.at(i)->pause();
|
||||
}
|
||||
|
||||
void GuiComponent::resume()
|
||||
{
|
||||
onResume();
|
||||
|
||||
for(unsigned int i = 0; i < mChildren.size(); i++)
|
||||
mChildren.at(i)->resume();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,11 @@ public:
|
|||
virtual void onRender() { };
|
||||
virtual void onTick(int deltaTime) { };
|
||||
|
||||
void pause();
|
||||
void resume();
|
||||
virtual void onPause() { };
|
||||
virtual void onResume() { };
|
||||
|
||||
virtual void onInput(InputManager::InputButton button, bool keyDown) { };
|
||||
|
||||
void addChild(GuiComponent* comp);
|
||||
|
|
|
@ -39,4 +39,3 @@ void Renderer::render()
|
|||
renderVector.at(i)->render();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,8 @@ void SystemData::populateFolder(FolderData* folder)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
folder->sort();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "GuiGameList.h"
|
||||
#include "../InputManager.h"
|
||||
#include <iostream>
|
||||
#include "GuiMenu.h"
|
||||
|
||||
#define SCREENSHOTWIDTH 256
|
||||
#define SCREENSHOTHEIGHT 256
|
||||
|
@ -128,6 +129,11 @@ void GuiGameList::onInput(InputManager::InputButton button, bool keyDown)
|
|||
setSystemId(mSystemId - 1);
|
||||
}
|
||||
|
||||
if(button == InputManager::MENU && keyDown)
|
||||
{
|
||||
new GuiMenu(this);
|
||||
}
|
||||
|
||||
if(mDetailed)
|
||||
{
|
||||
if(!keyDown && (button == InputManager::UP || button == InputManager::DOWN))
|
||||
|
@ -159,3 +165,16 @@ void GuiGameList::updateList()
|
|||
mList->addObject(file->getName(), file);
|
||||
}
|
||||
}
|
||||
|
||||
//these are called when the menu opens/closes
|
||||
void GuiGameList::onPause()
|
||||
{
|
||||
InputManager::unregisterComponent(this);
|
||||
InputManager::unregisterComponent(mList);
|
||||
}
|
||||
|
||||
void GuiGameList::onResume()
|
||||
{
|
||||
InputManager::registerComponent(this);
|
||||
InputManager::registerComponent(mList);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ public:
|
|||
|
||||
void onRender();
|
||||
void onInput(InputManager::InputButton button, bool keyDown);
|
||||
void onPause();
|
||||
void onResume();
|
||||
|
||||
private:
|
||||
SystemData* mSystem;
|
||||
|
|
50
src/components/GuiMenu.cpp
Normal file
50
src/components/GuiMenu.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include "GuiMenu.h"
|
||||
#include <iostream>
|
||||
|
||||
GuiMenu::GuiMenu(GuiComponent* parent)
|
||||
{
|
||||
mParent = parent;
|
||||
parent->pause();
|
||||
|
||||
mList = new GuiList(Renderer::getScreenWidth() * 0.5, 20);
|
||||
|
||||
addChild(mList);
|
||||
|
||||
mSkippedMenuClose = false;
|
||||
|
||||
Renderer::registerComponent(this);
|
||||
InputManager::registerComponent(this);
|
||||
}
|
||||
|
||||
GuiMenu::~GuiMenu()
|
||||
{
|
||||
Renderer::unregisterComponent(this);
|
||||
InputManager::unregisterComponent(this);
|
||||
|
||||
delete mList;
|
||||
mParent->resume();
|
||||
}
|
||||
|
||||
void GuiMenu::onInput(InputManager::InputButton button, bool keyDown)
|
||||
{
|
||||
if(button == InputManager::MENU && !keyDown)
|
||||
{
|
||||
if(!mSkippedMenuClose)
|
||||
{
|
||||
mSkippedMenuClose = true;
|
||||
}else{
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GuiMenu::populateList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GuiMenu::onRender()
|
||||
{
|
||||
Renderer::drawRect(Renderer::getScreenWidth() * 0.25, 0, Renderer::getScreenWidth() * 0.5, Renderer::getScreenHeight(), 0xFF00FF);
|
||||
}
|
22
src/components/GuiMenu.h
Normal file
22
src/components/GuiMenu.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef _GUIMENU_H_
|
||||
#define _GUIMENU_H_
|
||||
|
||||
#include "../GuiComponent.h"
|
||||
#include "GuiList.h"
|
||||
|
||||
class GuiMenu : public GuiComponent
|
||||
{
|
||||
public:
|
||||
GuiMenu(GuiComponent* parent);
|
||||
~GuiMenu();
|
||||
|
||||
void onInput(InputManager::InputButton button, bool keyDown);
|
||||
void onRender();
|
||||
|
||||
private:
|
||||
GuiComponent* mParent;
|
||||
GuiList* mList;
|
||||
bool mSkippedMenuClose;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue