mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
More work.
This commit is contained in:
parent
04841ca436
commit
4747d70e1f
|
@ -2,7 +2,7 @@ CXX=g++
|
||||||
CXXFLAGS=-Wall -g -O2
|
CXXFLAGS=-Wall -g -O2
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
|
|
||||||
SRC_SOURCES=AudioManager.cpp InputConfig.cpp Log.cpp FolderData.cpp Font.cpp GameData.cpp Gui.cpp InputManager.cpp main.cpp MathExp.cpp Renderer_draw_gl.cpp Renderer_init.cpp Sound.cpp SystemData.cpp XMLReader.cpp components/GuiAnimation.cpp components/GuiBox.cpp components/GuiFastSelect.cpp components/GuiGameList.cpp components/GuiImage.cpp components/GuiInputConfig.cpp components/GuiMenu.cpp components/GuiTheme.cpp pugiXML/pugixml.cpp
|
SRC_SOURCES=AudioManager.cpp Window.cpp InputConfig.cpp Log.cpp FolderData.cpp Font.cpp GameData.cpp Gui.cpp InputManager.cpp main.cpp MathExp.cpp Renderer_draw_gl.cpp Renderer_init.cpp Sound.cpp SystemData.cpp XMLReader.cpp components/GuiAnimation.cpp components/GuiBox.cpp components/GuiFastSelect.cpp components/GuiGameList.cpp components/GuiImage.cpp components/GuiInputConfig.cpp components/GuiMenu.cpp components/GuiTheme.cpp pugiXML/pugixml.cpp
|
||||||
SOURCES=$(addprefix src/,$(SRC_SOURCES))
|
SOURCES=$(addprefix src/,$(SRC_SOURCES))
|
||||||
OBJECTS=$(SOURCES:.cpp=.o)
|
OBJECTS=$(SOURCES:.cpp=.o)
|
||||||
DEPS=$(SOURCES:.cpp=.d)
|
DEPS=$(SOURCES:.cpp=.d)
|
||||||
|
|
|
@ -9,3 +9,9 @@ Gui::~Gui()
|
||||||
{
|
{
|
||||||
mWindow->removeGui(this);
|
mWindow->removeGui(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Gui::setOffset(int x, int y) { mOffsetX = x; mOffsetY = y; }
|
||||||
|
void Gui::setOffsetX(int x) { mOffsetX = x; }
|
||||||
|
void Gui::setOffsetY(int y) { mOffsetY = y; }
|
||||||
|
int Gui::getOffsetX() { return mOffsetX; }
|
||||||
|
int Gui::getOffsetY() { return mOffsetY; }
|
||||||
|
|
12
src/Gui.h
12
src/Gui.h
|
@ -14,7 +14,19 @@ public:
|
||||||
virtual void input(InputConfig* config, Input input) { };
|
virtual void input(InputConfig* config, Input input) { };
|
||||||
virtual void update(int deltaTime) { };
|
virtual void update(int deltaTime) { };
|
||||||
virtual void render() { };
|
virtual void render() { };
|
||||||
|
|
||||||
|
virtual void init() { };
|
||||||
|
virtual void deinit() { };
|
||||||
|
|
||||||
|
void setOffsetX(int x);
|
||||||
|
void setOffsetY(int y);
|
||||||
|
void setOffset(int x, int y);
|
||||||
|
int getOffsetX();
|
||||||
|
int getOffsetY();
|
||||||
protected:
|
protected:
|
||||||
|
int mOffsetX;
|
||||||
|
int mOffsetY;
|
||||||
|
|
||||||
Window* mWindow;
|
Window* mWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,8 @@ class Font;
|
||||||
//Defined in multiple files - Renderer.cpp has the GuiComponent stuff, Renderer_draw_* includes renderer-specific drawing implementations, and Renderer_init_* includes renderer-specific init/deinit.
|
//Defined in multiple files - Renderer.cpp has the GuiComponent stuff, Renderer_draw_* includes renderer-specific drawing implementations, and Renderer_init_* includes renderer-specific init/deinit.
|
||||||
namespace Renderer
|
namespace Renderer
|
||||||
{
|
{
|
||||||
void registerComponent(GuiComponent* comp);
|
|
||||||
void unregisterComponent(GuiComponent* comp);
|
|
||||||
void deleteAll();
|
|
||||||
|
|
||||||
bool init(int w, int h);
|
bool init(int w, int h);
|
||||||
void onInit();
|
|
||||||
void deinit();
|
void deinit();
|
||||||
void onDeinit();
|
|
||||||
|
|
||||||
void render();
|
|
||||||
|
|
||||||
unsigned int getScreenWidth();
|
unsigned int getScreenWidth();
|
||||||
unsigned int getScreenHeight();
|
unsigned int getScreenHeight();
|
||||||
|
|
|
@ -80,14 +80,11 @@ namespace Renderer
|
||||||
glOrtho(0, display_width, display_height, 0, -1.0, 1.0);
|
glOrtho(0, display_width, display_height, 0, -1.0, 1.0);
|
||||||
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
onInit();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void deinit()
|
void deinit()
|
||||||
{
|
{
|
||||||
onDeinit();
|
|
||||||
destroySurface();
|
destroySurface();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,6 +47,22 @@ void Window::render()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::init()
|
||||||
|
{
|
||||||
|
for(unsigned int i = 0; i < mGuiStack.size(); i++)
|
||||||
|
{
|
||||||
|
mGuiStack.at(i)->init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::deinit()
|
||||||
|
{
|
||||||
|
for(unsigned int i = 0; i < mGuiStack.size(); i++)
|
||||||
|
{
|
||||||
|
mGuiStack.at(i)->deinit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Window::input(InputConfig* config, Input input)
|
void Window::input(InputConfig* config, Input input)
|
||||||
{
|
{
|
||||||
if(peekGui())
|
if(peekGui())
|
||||||
|
@ -63,8 +79,3 @@ InputManager* Window::getInputManager()
|
||||||
{
|
{
|
||||||
return mInputManager;
|
return mInputManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
asIScriptEngine* Window::getScriptEngine()
|
|
||||||
{
|
|
||||||
return mScriptEngine;
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,6 +19,9 @@ public:
|
||||||
void update(int deltaTime);
|
void update(int deltaTime);
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
|
void init();
|
||||||
|
void deinit();
|
||||||
|
|
||||||
InputManager* getInputManager();
|
InputManager* getInputManager();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "GuiBox.h"
|
#include "GuiBox.h"
|
||||||
|
|
||||||
GuiBox::GuiBox(int offsetX, int offsetY, unsigned int width, unsigned int height)
|
GuiBox::GuiBox(Window* window, int offsetX, int offsetY, unsigned int width, unsigned int height) : Gui(window), mBackgroundImage(window),
|
||||||
|
mHorizontalImage(window), mVerticalImage(window), mCornerImage(window)
|
||||||
{
|
{
|
||||||
setOffsetX(offsetX);
|
setOffsetX(offsetX);
|
||||||
setOffsetY(offsetY);
|
setOffsetY(offsetY);
|
||||||
|
@ -112,14 +113,10 @@ void GuiBox::render()
|
||||||
|
|
||||||
void GuiBox::onInit()
|
void GuiBox::onInit()
|
||||||
{
|
{
|
||||||
mHorizontalImage.init();
|
|
||||||
mVerticalImage.init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiBox::onDeinit()
|
void GuiBox::onDeinit()
|
||||||
{
|
{
|
||||||
mHorizontalImage.deinit();
|
|
||||||
mVerticalImage.deinit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int GuiBox::getHorizontalBorderWidth()
|
int GuiBox::getHorizontalBorderWidth()
|
||||||
|
|
|
@ -16,10 +16,10 @@ struct GuiBoxData
|
||||||
std::string cornerPath;
|
std::string cornerPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GuiBox
|
class GuiBox : public Gui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GuiBox(int offsetX, int offsetY, unsigned int width, unsigned int height);
|
GuiBox(Window* window, int offsetX, int offsetY, unsigned int width, unsigned int height);
|
||||||
|
|
||||||
void setData(GuiBoxData data);
|
void setData(GuiBoxData data);
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#include "GuiFastSelect.h"
|
#include "GuiFastSelect.h"
|
||||||
#include "../Renderer.h"
|
#include "../Renderer.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "GuiGameList.h"
|
||||||
|
|
||||||
const std::string GuiFastSelect::LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
const std::string GuiFastSelect::LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
const int GuiFastSelect::SCROLLSPEED = 100;
|
const int GuiFastSelect::SCROLLSPEED = 100;
|
||||||
const int GuiFastSelect::SCROLLDELAY = 507;
|
const int GuiFastSelect::SCROLLDELAY = 507;
|
||||||
|
|
||||||
GuiFastSelect::GuiFastSelect(Window* window, GuiComponent* parent, GuiList<FileData*>* list, char startLetter, GuiBoxData data,
|
GuiFastSelect::GuiFastSelect(Window* window, GuiGameList* parent, GuiList<FileData*>* list, char startLetter, GuiBoxData data,
|
||||||
int textcolor, Sound* scrollsound, Font* font) : Gui(window)
|
int textcolor, Sound* scrollsound, Font* font) : Gui(window)
|
||||||
{
|
{
|
||||||
mLetterID = LETTERS.find(toupper(startLetter));
|
mLetterID = LETTERS.find(toupper(startLetter));
|
||||||
|
@ -23,7 +24,7 @@ GuiFastSelect::GuiFastSelect(Window* window, GuiComponent* parent, GuiList<FileD
|
||||||
mScrollOffset = 0;
|
mScrollOffset = 0;
|
||||||
|
|
||||||
unsigned int sw = Renderer::getScreenWidth(), sh = Renderer::getScreenHeight();
|
unsigned int sw = Renderer::getScreenWidth(), sh = Renderer::getScreenHeight();
|
||||||
mBox = new GuiBox(sw * 0.2, sh * 0.2, sw * 0.6, sh * 0.6);
|
mBox = new GuiBox(window, sw * 0.2, sh * 0.2, sw * 0.6, sh * 0.6);
|
||||||
mBox->setData(data);
|
mBox->setData(data);
|
||||||
|
|
||||||
mTextColor = textcolor;
|
mTextColor = textcolor;
|
||||||
|
@ -31,6 +32,7 @@ GuiFastSelect::GuiFastSelect(Window* window, GuiComponent* parent, GuiList<FileD
|
||||||
|
|
||||||
GuiFastSelect::~GuiFastSelect()
|
GuiFastSelect::~GuiFastSelect()
|
||||||
{
|
{
|
||||||
|
mParent->updateDetailData();
|
||||||
delete mBox;
|
delete mBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,12 @@
|
||||||
#include "GuiList.h"
|
#include "GuiList.h"
|
||||||
#include "GuiBox.h"
|
#include "GuiBox.h"
|
||||||
|
|
||||||
|
class GuiGameList;
|
||||||
|
|
||||||
class GuiFastSelect : Gui
|
class GuiFastSelect : Gui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GuiFastSelect(Window* window, GuiComponent* parent, GuiList<FileData*>* list, char startLetter, GuiBoxData data, int textcolor, Sound* scrollsound, Font* font);
|
GuiFastSelect(Window* window, GuiGameList* parent, GuiList<FileData*>* list, char startLetter, GuiBoxData data, int textcolor, Sound* scrollsound, Font* font);
|
||||||
~GuiFastSelect();
|
~GuiFastSelect();
|
||||||
|
|
||||||
void input(InputConfig* config, Input input);
|
void input(InputConfig* config, Input input);
|
||||||
|
@ -29,7 +31,7 @@ private:
|
||||||
GuiList<FileData*>* mList;
|
GuiList<FileData*>* mList;
|
||||||
|
|
||||||
size_t mLetterID;
|
size_t mLetterID;
|
||||||
GuiComponent* mParent;
|
GuiGameList* mParent;
|
||||||
|
|
||||||
GuiBox* mBox;
|
GuiBox* mBox;
|
||||||
int mTextColor;
|
int mTextColor;
|
||||||
|
|
|
@ -22,11 +22,10 @@ GuiGameList::GuiGameList(Window* window, bool useDetail) : Gui(window)
|
||||||
mScreenshot = new GuiImage(mWindow, Renderer::getScreenWidth() * mTheme->getFloat("gameImageOffsetX"), Renderer::getScreenHeight() * mTheme->getFloat("gameImageOffsetY"), "", mTheme->getFloat("gameImageWidth"), mTheme->getFloat("gameImageHeight"), false);
|
mScreenshot = new GuiImage(mWindow, Renderer::getScreenWidth() * mTheme->getFloat("gameImageOffsetX"), Renderer::getScreenHeight() * mTheme->getFloat("gameImageOffsetY"), "", mTheme->getFloat("gameImageWidth"), mTheme->getFloat("gameImageHeight"), false);
|
||||||
mScreenshot->setOrigin(mTheme->getFloat("gameImageOriginX"), mTheme->getFloat("gameImageOriginY"));
|
mScreenshot->setOrigin(mTheme->getFloat("gameImageOriginX"), mTheme->getFloat("gameImageOriginY"));
|
||||||
|
|
||||||
//the animation renders the screenshot
|
|
||||||
mImageAnimation = new GuiAnimation();
|
mImageAnimation = new GuiAnimation();
|
||||||
mImageAnimation->addChild(mScreenshot);
|
mImageAnimation->addChild(mScreenshot);
|
||||||
}else{
|
}else{
|
||||||
mList = new GuiList<FileData*>(0, Renderer::getDefaultFont(Renderer::LARGE)->getHeight() + 2, Renderer::getDefaultFont(Renderer::MEDIUM));
|
mList = new GuiList<FileData*>(mWindow, 0, Renderer::getDefaultFont(Renderer::LARGE)->getHeight() + 2, Renderer::getDefaultFont(Renderer::MEDIUM));
|
||||||
mScreenshot = NULL;
|
mScreenshot = NULL;
|
||||||
mImageAnimation = NULL;
|
mImageAnimation = NULL;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +96,11 @@ void GuiGameList::render()
|
||||||
if(!desc.empty())
|
if(!desc.empty())
|
||||||
Renderer::drawWrappedText(desc, Renderer::getScreenWidth() * 0.03, mScreenshot->getOffsetY() + mScreenshot->getHeight() + 12, Renderer::getScreenWidth() * (mTheme->getFloat("listOffsetX") - 0.03), mTheme->getColor("description"), mTheme->getDescriptionFont());
|
Renderer::drawWrappedText(desc, Renderer::getScreenWidth() * 0.03, mScreenshot->getOffsetY() + mScreenshot->getHeight() + 12, Renderer::getScreenWidth() * (mTheme->getFloat("listOffsetX") - 0.03), mTheme->getColor("description"), mTheme->getDescriptionFont());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mScreenshot->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mList->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiGameList::input(InputConfig* config, Input input)
|
void GuiGameList::input(InputConfig* config, Input input)
|
||||||
|
@ -119,7 +122,7 @@ void GuiGameList::input(InputConfig* config, Input input)
|
||||||
//wait for the sound to finish or we'll never hear it...
|
//wait for the sound to finish or we'll never hear it...
|
||||||
while(mTheme->getSound("menuSelect")->isPlaying());
|
while(mTheme->getSound("menuSelect")->isPlaying());
|
||||||
|
|
||||||
mSystem->launchGame((GameData*)file);
|
mSystem->launchGame(mWindow, (GameData*)file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +154,7 @@ void GuiGameList::input(InputConfig* config, Input input)
|
||||||
//open the "start menu"
|
//open the "start menu"
|
||||||
if(config->isMappedTo("menu", input) && input.value != 0)
|
if(config->isMappedTo("menu", input) && input.value != 0)
|
||||||
{
|
{
|
||||||
new GuiMenu(this);
|
new GuiMenu(mWindow, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//open the fast select menu
|
//open the fast select menu
|
||||||
|
@ -297,5 +300,7 @@ GuiGameList* GuiGameList::create(Window* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new GuiGameList(window, detailed);
|
GuiGameList* list = new GuiGameList(window, detailed);
|
||||||
|
window->pushGui(list);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
class GuiGameList : public Gui
|
class GuiGameList : public Gui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GuiGameList(bool useDetail = false);
|
GuiGameList(Window* window, bool useDetail = false);
|
||||||
~GuiGameList();
|
~GuiGameList();
|
||||||
|
|
||||||
void setSystemId(int id);
|
void setSystemId(int id);
|
||||||
|
@ -28,13 +28,14 @@ public:
|
||||||
void onInit();
|
void onInit();
|
||||||
void onDeinit();
|
void onDeinit();
|
||||||
|
|
||||||
|
void updateDetailData();
|
||||||
|
|
||||||
static GuiGameList* create(Window* window);
|
static GuiGameList* create(Window* window);
|
||||||
|
|
||||||
static const float sInfoWidth;
|
static const float sInfoWidth;
|
||||||
private:
|
private:
|
||||||
void updateList();
|
void updateList();
|
||||||
void updateTheme();
|
void updateTheme();
|
||||||
void updateDetailData();
|
|
||||||
void clearDetailData();
|
void clearDetailData();
|
||||||
std::string getThemeFile();
|
std::string getThemeFile();
|
||||||
|
|
||||||
|
|
|
@ -3,16 +3,16 @@
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "../Log.h"
|
#include "../Log.h"
|
||||||
|
#include "../Renderer.h"
|
||||||
|
|
||||||
unsigned int GuiImage::getWidth() { return mDrawWidth; }
|
unsigned int GuiImage::getWidth() { return mDrawWidth; }
|
||||||
unsigned int GuiImage::getHeight() { return mDrawHeight; }
|
unsigned int GuiImage::getHeight() { return mDrawHeight; }
|
||||||
|
|
||||||
GuiImage::GuiImage(GuiWindow* window, int offsetX, int offsetY, std::string path, unsigned int resizeWidth, unsigned int resizeHeight, bool resizeExact) : Gui(window)
|
GuiImage::GuiImage(Window* window, int offsetX, int offsetY, std::string path, unsigned int resizeWidth, unsigned int resizeHeight, bool resizeExact) : Gui(window)
|
||||||
{
|
{
|
||||||
mTextureID = 0;
|
mTextureID = 0;
|
||||||
|
|
||||||
mOffsetX = offsetX;
|
setOffset(offsetX, offsetY);
|
||||||
mOffsetY = offsetY;
|
|
||||||
|
|
||||||
//default origin is the center of image
|
//default origin is the center of image
|
||||||
mOriginX = 0.5;
|
mOriginX = 0.5;
|
||||||
|
@ -369,8 +369,5 @@ bool GuiImage::hasImage()
|
||||||
return !mPath.empty();
|
return !mPath.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GuiImage::getOffsetX() { return mOffsetX; }
|
|
||||||
int GuiImage::getOffsetY() { return mOffsetY; }
|
|
||||||
unsigned char GuiImage::getOpacity() { return mOpacity; }
|
unsigned char GuiImage::getOpacity() { return mOpacity; }
|
||||||
void GuiImage::setOffset(int x, int y) { mOffsetX = x; mOffsetY = y; }
|
|
||||||
void GuiImage::setOpacity(unsigned char opacity) { mOpacity = opacity; }
|
void GuiImage::setOpacity(unsigned char opacity) { mOpacity = opacity; }
|
||||||
|
|
|
@ -35,11 +35,8 @@ public:
|
||||||
void onInit();
|
void onInit();
|
||||||
void onDeinit();
|
void onDeinit();
|
||||||
|
|
||||||
int getOffsetX();
|
|
||||||
int getOffsetY();
|
|
||||||
unsigned char getOpacity();
|
unsigned char getOpacity();
|
||||||
void setOpacity(unsigned char opacity);
|
void setOpacity(unsigned char opacity);
|
||||||
void setOffset(int x, int y);
|
|
||||||
private:
|
private:
|
||||||
unsigned int mResizeWidth, mResizeHeight;
|
unsigned int mResizeWidth, mResizeHeight;
|
||||||
float mOriginX, mOriginY;
|
float mOriginX, mOriginY;
|
||||||
|
|
|
@ -11,47 +11,15 @@ int GuiInputConfig::sInputCount = 10;
|
||||||
|
|
||||||
GuiInputConfig::GuiInputConfig(Window* window) : Gui(window)
|
GuiInputConfig::GuiInputConfig(Window* window) : Gui(window)
|
||||||
{
|
{
|
||||||
mInputNum = 0;
|
|
||||||
mDone = false;
|
|
||||||
|
|
||||||
if(SDL_NumJoysticks() < 1)
|
|
||||||
{
|
|
||||||
std::cerr << "Error - GuiInputConfig found no SDL joysticks!\n";
|
|
||||||
mJoystick = NULL;
|
|
||||||
mDone = true;
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
LOG(LogInfo) << "Opening joystick \"" << SDL_JoystickName(0) << "\" for configuration...";
|
|
||||||
mJoystick = SDL_JoystickOpen(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_JoystickEventState(SDL_ENABLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiInputConfig::~GuiInputConfig()
|
GuiInputConfig::~GuiInputConfig()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiInputConfig::onRender()
|
void GuiInputConfig::render()
|
||||||
{
|
{
|
||||||
Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0xFFFFFFFF);
|
Renderer::drawCenteredText("IN DEVELOPMENT", 0, 2, 0x000000FF, Renderer::getDefaultFont(Renderer::MEDIUM));
|
||||||
|
|
||||||
Font* font = Renderer::getDefaultFont(Renderer::MEDIUM);
|
|
||||||
|
|
||||||
int height = font->getHeight() + 6;
|
|
||||||
|
|
||||||
|
|
||||||
Renderer::drawCenteredText("It looks like you have a joystick plugged in!", 0, 2, 0x000000FF, font);
|
|
||||||
Renderer::drawCenteredText("POV hats (some D-Pads) are automatically mapped to directions.", 0, height, 0x000000FF, font);
|
|
||||||
Renderer::drawCenteredText("You can press a keyboard key to skip any input.", 0, height * 2, 0x000000FF, font);
|
|
||||||
Renderer::drawCenteredText("If you want to remap later, delete ~/.emulationstation/es_input.cfg.", 0, height * 3, 0x000000FF, font);
|
|
||||||
Renderer::drawCenteredText("This interface only configures the first joystick plugged in.", 0, height * 4, 0x000000FF, font);
|
|
||||||
Renderer::drawCenteredText("Remember - you'll need to set up your emulator separately!", 0, Renderer::getScreenHeight() - height, 0x000000FF, font);
|
|
||||||
|
|
||||||
if(mDone)
|
|
||||||
Renderer::drawCenteredText("All done! Press a key or button to save.", 0, height * 5, 0x00BB00FF, font);
|
|
||||||
else
|
|
||||||
Renderer::drawCenteredText("Please press the axis/button for " + sInputs[mInputNum], 0, height * 5, 0x00C000FF, font);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiInputConfig::input(InputConfig* config, Input input)
|
void GuiInputConfig::input(InputConfig* config, Input input)
|
||||||
|
|
|
@ -147,8 +147,6 @@ void GuiTheme::deleteComponents()
|
||||||
|
|
||||||
mComponentVector.clear();
|
mComponentVector.clear();
|
||||||
|
|
||||||
clearChildren();
|
|
||||||
|
|
||||||
//deletes fonts if any were created
|
//deletes fonts if any were created
|
||||||
setDefaults();
|
setDefaults();
|
||||||
}
|
}
|
||||||
|
@ -260,11 +258,11 @@ void GuiTheme::readXML(std::string path)
|
||||||
}
|
}
|
||||||
|
|
||||||
//recursively creates components (with proper parenting)
|
//recursively creates components (with proper parenting)
|
||||||
void GuiTheme::createComponentChildren(pugi::xml_node node, GuiComponent* parent)
|
void GuiTheme::createComponentChildren(pugi::xml_node node, Gui* parent)
|
||||||
{
|
{
|
||||||
for(pugi::xml_node data = node.child("component"); data; data = data.next_sibling("component"))
|
for(pugi::xml_node data = node.child("component"); data; data = data.next_sibling("component"))
|
||||||
{
|
{
|
||||||
GuiComponent* nextComp = createElement(data, parent);
|
Gui* nextComp = createElement(data, parent);
|
||||||
|
|
||||||
if(nextComp)
|
if(nextComp)
|
||||||
createComponentChildren(data, nextComp);
|
createComponentChildren(data, nextComp);
|
||||||
|
@ -272,7 +270,7 @@ void GuiTheme::createComponentChildren(pugi::xml_node node, GuiComponent* parent
|
||||||
}
|
}
|
||||||
|
|
||||||
//takes an XML element definition and creates an object from it
|
//takes an XML element definition and creates an object from it
|
||||||
GuiComponent* GuiTheme::createElement(pugi::xml_node data, GuiComponent* parent)
|
Gui* GuiTheme::createElement(pugi::xml_node data, Gui* parent)
|
||||||
{
|
{
|
||||||
std::string type = data.child("type").text().get();
|
std::string type = data.child("type").text().get();
|
||||||
|
|
||||||
|
@ -316,7 +314,6 @@ GuiComponent* GuiTheme::createElement(pugi::xml_node data, GuiComponent* parent)
|
||||||
comp->setTiling(tiled);
|
comp->setTiling(tiled);
|
||||||
comp->setImage(path);
|
comp->setImage(path);
|
||||||
|
|
||||||
parent->addChild(comp);
|
|
||||||
mComponentVector.push_back(comp);
|
mComponentVector.push_back(comp);
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
@ -426,3 +423,11 @@ Font* GuiTheme::resolveFont(pugi::xml_node node, std::string defaultPath, unsign
|
||||||
|
|
||||||
return new Font(path, size);
|
return new Font(path, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuiTheme::render()
|
||||||
|
{
|
||||||
|
for(unsigned int i = 0; i < mComponentVector.size(); i++)
|
||||||
|
{
|
||||||
|
mComponentVector.at(i)->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include "../Sound.h"
|
#include "../Sound.h"
|
||||||
#include "../Font.h"
|
#include "../Font.h"
|
||||||
|
|
||||||
//This class loads an XML-defined list of GuiComponents.
|
//This class loads an XML-defined list of Guis.
|
||||||
class GuiTheme : Gui
|
class GuiTheme : public Gui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GuiTheme(Window* window, bool detailed, std::string path = "");
|
GuiTheme(Window* window, bool detailed, std::string path = "");
|
||||||
|
@ -18,6 +18,8 @@ public:
|
||||||
|
|
||||||
GuiBoxData getBoxData();
|
GuiBoxData getBoxData();
|
||||||
|
|
||||||
|
void render();
|
||||||
|
|
||||||
unsigned int getColor(std::string name);
|
unsigned int getColor(std::string name);
|
||||||
bool getBool(std::string name);
|
bool getBool(std::string name);
|
||||||
float getFloat(std::string name);
|
float getFloat(std::string name);
|
||||||
|
@ -30,8 +32,8 @@ public:
|
||||||
private:
|
private:
|
||||||
void setDefaults();
|
void setDefaults();
|
||||||
void deleteComponents();
|
void deleteComponents();
|
||||||
void createComponentChildren(pugi::xml_node node, GuiComponent* parent);
|
void createComponentChildren(pugi::xml_node node, Gui* parent);
|
||||||
GuiComponent* createElement(pugi::xml_node data, GuiComponent* parent);
|
Gui* createElement(pugi::xml_node data, Gui* parent);
|
||||||
|
|
||||||
//utility functions
|
//utility functions
|
||||||
std::string expandPath(std::string path);
|
std::string expandPath(std::string path);
|
||||||
|
|
Loading…
Reference in a new issue