Moved Guis from src/components to src/guis.

Renamed ComponentListComponent to ComponentGrid.
Changed some older files' #ifdefs to #pragma once to be more consistent.
This commit is contained in:
Aloshi 2014-02-28 18:52:32 -06:00
parent 8e8c2fed6b
commit 139fc720ac
32 changed files with 147 additions and 197 deletions

View file

@ -161,12 +161,13 @@ set(ES_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/components/AsyncReqComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentListComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentGrid.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/DateTimeComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/HelpComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/IList.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageGridComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/MenuComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/NinePatchComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/OptionListComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/RatingComponent.h
@ -176,17 +177,18 @@ set(ES_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextEditComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextListComponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiDetectDevice.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiFastSelect.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMetaDataEd.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMsgBoxOk.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMsgBoxYesNo.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameScraper.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiInputConfig.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMenu.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiSettingsMenu.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiScraperStart.h
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiScraperLog.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiFastSelect.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBoxOk.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBoxYesNo.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMenu.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSettingsMenu.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperStart.h
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperLog.h
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/Scraper.h
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/GamesDBScraper.h
@ -241,10 +243,11 @@ set(ES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/components/AsyncReqComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentListComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentGrid.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/DateTimeComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/HelpComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ImageComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/MenuComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/NinePatchComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/RatingComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ScrollableContainer.cpp
@ -252,17 +255,18 @@ set(ES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/components/SwitchComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/TextEditComponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiDetectDevice.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiFastSelect.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMetaDataEd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMsgBoxOk.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMsgBoxYesNo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiGameScraper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiInputConfig.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiMenu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiSettingsMenu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiScraperStart.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/components/GuiScraperLog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiDetectDevice.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiFastSelect.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBoxOk.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMsgBoxYesNo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiGameScraper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiInputConfig.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMenu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiSettingsMenu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperStart.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiScraperLog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/Scraper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/GamesDBScraper.cpp

View file

@ -1,10 +1,10 @@
#include "ComponentListComponent.h"
#include "ComponentGrid.h"
#include "../Log.h"
#include "../Renderer.h"
#define INITIAL_CELL_SIZE 12
ComponentListComponent::ComponentListComponent(Window* window, Eigen::Vector2i gridDimensions) : GuiComponent(window),
ComponentGrid::ComponentGrid(Window* window, Eigen::Vector2i gridDimensions) : GuiComponent(window),
mGrid(NULL), mColumnWidths(NULL), mRowHeights(NULL),
mColumnWidthForced(NULL), mRowHeightForced(NULL),
mCursor(-1, -1)
@ -13,7 +13,7 @@ ComponentListComponent::ComponentListComponent(Window* window, Eigen::Vector2i g
makeCells(gridDimensions);
}
ComponentListComponent::~ComponentListComponent()
ComponentGrid::~ComponentGrid()
{
for(auto iter = mEntries.begin(); iter != mEntries.end(); iter++)
{
@ -21,7 +21,7 @@ ComponentListComponent::~ComponentListComponent()
}
}
void ComponentListComponent::makeCells(Eigen::Vector2i size)
void ComponentGrid::makeCells(Eigen::Vector2i size)
{
if(mGrid)
delete[] mGrid;
@ -50,7 +50,7 @@ void ComponentListComponent::makeCells(Eigen::Vector2i size)
resetCursor();
}
void ComponentListComponent::setEntry(Eigen::Vector2i pos, Eigen::Vector2i size, GuiComponent* component, bool canFocus, AlignmentType align,
void ComponentGrid::setEntry(Eigen::Vector2i pos, Eigen::Vector2i size, GuiComponent* component, bool canFocus, AlignmentType align,
Eigen::Matrix<bool, 1, 2> autoFit, UpdateBehavior updateType)
{
if(pos.x() > mGridSize.x() || pos.y() > mGridSize.y() || pos.x() < 0 || pos.y() < 0)
@ -78,7 +78,7 @@ void ComponentListComponent::setEntry(Eigen::Vector2i pos, Eigen::Vector2i size,
}
if(component->getParent() != NULL)
LOG(LogError) << "ComponentListComponent ruining an existing parent-child relationship! Call a social worker!";
LOG(LogError) << "ComponentGrid ruining an existing parent-child relationship! Call a social worker!";
component->setParent(this);
if(!cursorValid() && canFocus)
@ -96,7 +96,7 @@ void ComponentListComponent::setEntry(Eigen::Vector2i pos, Eigen::Vector2i size,
updateSize();
}
void ComponentListComponent::removeEntriesIn(Eigen::Vector2i pos, Eigen::Vector2i size)
void ComponentGrid::removeEntriesIn(Eigen::Vector2i pos, Eigen::Vector2i size)
{
auto iter = mEntries.begin();
while(iter != mEntries.end())
@ -126,7 +126,7 @@ void ComponentListComponent::removeEntriesIn(Eigen::Vector2i pos, Eigen::Vector2
resetCursor();
}
void ComponentListComponent::forceRowHeight(int row, unsigned int size)
void ComponentGrid::forceRowHeight(int row, unsigned int size)
{
mRowHeights[row] = size;
mRowHeightForced[row] = true;
@ -134,7 +134,7 @@ void ComponentListComponent::forceRowHeight(int row, unsigned int size)
updateComponentOffsets();
}
void ComponentListComponent::forceColumnWidth(int col, unsigned int size)
void ComponentGrid::forceColumnWidth(int col, unsigned int size)
{
mColumnWidths[col] = size;
mColumnWidthForced[col] = true;
@ -142,10 +142,10 @@ void ComponentListComponent::forceColumnWidth(int col, unsigned int size)
updateComponentOffsets();
}
unsigned int ComponentListComponent::getRowHeight(int row) { return mRowHeights[row]; }
unsigned int ComponentListComponent::getColumnWidth(int col) { return mColumnWidths[col]; }
unsigned int ComponentGrid::getRowHeight(int row) { return mRowHeights[row]; }
unsigned int ComponentGrid::getColumnWidth(int col) { return mColumnWidths[col]; }
Eigen::Vector3f ComponentListComponent::getCellOffset(Eigen::Vector2i pos)
Eigen::Vector3f ComponentGrid::getCellOffset(Eigen::Vector2i pos)
{
Eigen::Vector3f offset(0, 0, 0);
@ -177,7 +177,7 @@ Eigen::Vector3f ComponentListComponent::getCellOffset(Eigen::Vector2i pos)
return offset;
}
void ComponentListComponent::setCell(unsigned int x, unsigned int y, ComponentEntry* entry)
void ComponentGrid::setCell(unsigned int x, unsigned int y, ComponentEntry* entry)
{
if(x >= (unsigned int)mGridSize.x() || y >= (unsigned int)mGridSize.y())
{
@ -188,7 +188,7 @@ void ComponentListComponent::setCell(unsigned int x, unsigned int y, ComponentEn
mGrid[y * mGridSize.x() + x] = entry;
}
ComponentListComponent::ComponentEntry* ComponentListComponent::getCell(unsigned int x, unsigned int y)
ComponentGrid::ComponentEntry* ComponentGrid::getCell(unsigned int x, unsigned int y)
{
if(x >= (unsigned int)mGridSize.x() || y >= (unsigned int)mGridSize.y())
{
@ -199,7 +199,7 @@ ComponentListComponent::ComponentEntry* ComponentListComponent::getCell(unsigned
return mGrid[y * mGridSize.x() + x];
}
void ComponentListComponent::updateSize()
void ComponentGrid::updateSize()
{
mSize = Eigen::Vector2f(0, 0);
for(int x = 0; x < mGridSize.x(); x++)
@ -208,7 +208,7 @@ void ComponentListComponent::updateSize()
mSize.y() += getRowHeight(y);
}
void ComponentListComponent::updateComponentOffsets()
void ComponentGrid::updateComponentOffsets()
{
for(auto iter = mEntries.begin(); iter != mEntries.end(); iter++)
{
@ -216,7 +216,7 @@ void ComponentListComponent::updateComponentOffsets()
}
}
void ComponentListComponent::updateCellSize(ComponentEntry* e, bool updWidth, bool updHeight)
void ComponentGrid::updateCellSize(ComponentEntry* e, bool updWidth, bool updHeight)
{
if(!e)
{
@ -263,7 +263,7 @@ void ComponentListComponent::updateCellSize(ComponentEntry* e, bool updWidth, bo
updateSize();
}
void ComponentListComponent::updateComponent(GuiComponent* cmp)
void ComponentGrid::updateComponent(GuiComponent* cmp)
{
for(auto iter = mEntries.begin(); iter != mEntries.end(); iter++)
{
@ -274,7 +274,7 @@ void ComponentListComponent::updateComponent(GuiComponent* cmp)
}
}
bool ComponentListComponent::input(InputConfig* config, Input input)
bool ComponentGrid::input(InputConfig* config, Input input)
{
if(cursorValid() && getCell(mCursor.x(), mCursor.y())->component->input(config, input))
return true;
@ -306,7 +306,7 @@ bool ComponentListComponent::input(InputConfig* config, Input input)
return false;
}
void ComponentListComponent::resetCursor()
void ComponentGrid::resetCursor()
{
auto iter = mEntries.begin();
while(iter != mEntries.end())
@ -327,7 +327,7 @@ void ComponentListComponent::resetCursor()
onCursorMoved(origCursor, mCursor);
}
void ComponentListComponent::moveCursor(Eigen::Vector2i dir)
void ComponentGrid::moveCursor(Eigen::Vector2i dir)
{
if(dir.x() != 0 && dir.y() != 0)
{
@ -390,7 +390,7 @@ void ComponentListComponent::moveCursor(Eigen::Vector2i dir)
mCursor = origCursor;
}
bool ComponentListComponent::cursorValid()
bool ComponentGrid::cursorValid()
{
if(mCursor.x() < 0 || mCursor.y() < 0 || mCursor.x() >= mGridSize.x() || mCursor.y() >= mGridSize.y())
return false;
@ -398,7 +398,7 @@ bool ComponentListComponent::cursorValid()
return getCell(mCursor.x(), mCursor.y()) != NULL;
}
void ComponentListComponent::update(int deltaTime)
void ComponentGrid::update(int deltaTime)
{
for(auto iter = mEntries.begin(); iter != mEntries.end(); iter++)
{
@ -416,7 +416,7 @@ void ComponentListComponent::update(int deltaTime)
}
}
void ComponentListComponent::render(const Eigen::Affine3f& parentTrans)
void ComponentGrid::render(const Eigen::Affine3f& parentTrans)
{
Eigen::Affine3f trans = parentTrans * getTransform();
@ -459,25 +459,25 @@ void ComponentListComponent::render(const Eigen::Affine3f& parentTrans)
}
void ComponentListComponent::textInput(const char* text)
void ComponentGrid::textInput(const char* text)
{
if(getSelectedComponent() != NULL)
getSelectedComponent()->textInput(text);
}
void ComponentListComponent::onPositionChanged()
void ComponentGrid::onPositionChanged()
{
updateComponentOffsets();
}
GuiComponent* ComponentListComponent::getSelectedComponent()
GuiComponent* ComponentGrid::getSelectedComponent()
{
if(!cursorValid())
return NULL;
return getCell(mCursor.x(), mCursor.y())->component;
}
void ComponentListComponent::onCursorMoved(Eigen::Vector2i from, Eigen::Vector2i to)
void ComponentGrid::onCursorMoved(Eigen::Vector2i from, Eigen::Vector2i to)
{
if(from != Eigen::Vector2i(-1, -1))
getCell(from.x(), from.y())->component->onFocusLost();
@ -488,7 +488,7 @@ void ComponentListComponent::onCursorMoved(Eigen::Vector2i from, Eigen::Vector2i
updateHelpPrompts();
}
std::vector<HelpPrompt> ComponentListComponent::getHelpPrompts()
std::vector<HelpPrompt> ComponentGrid::getHelpPrompts()
{
std::vector<HelpPrompt> prompts;
if(cursorValid())

View file

@ -2,11 +2,12 @@
#include "../GuiComponent.h"
class ComponentListComponent : public GuiComponent
// Used to arrange a bunch of components in a spreadsheet-esque grid.
class ComponentGrid : public GuiComponent
{
public:
ComponentListComponent(Window* window, Eigen::Vector2i gridDimensions);
virtual ~ComponentListComponent();
ComponentGrid(Window* window, Eigen::Vector2i gridDimensions);
virtual ~ComponentGrid();
enum UpdateBehavior
{
@ -92,27 +93,3 @@ private:
void updateComponentOffsets();
void updateCellSize(ComponentEntry* e, bool updWidth = true, bool updHeight = true);
};
//ability to define a list of components in terms of a grid
//these comments are kinda old
//input
//pass to selected component
// if returns true, stop
// else, process:
// if input == up/down
// scroll to prev/next selectable component in grid Y
// if input == left/right
// scroll to prev/next selectable component in grid X
//entry struct/class
// GuiComponent* component - component to work with
// bool canFocus - can we pass input to this? (necessary for labels to not be selectable)
// UpdateBehavior update - how to handle updates (all the time or only when focused)
//update
//pass update to all entries with appropriate update behavior
//render
//clip rect to our size
//render a "selected" effect behind component with focus somehow

View file

@ -1,12 +0,0 @@
#pragma once
#include "IList.h"
class MenuComponent : public IList
{
public:
MenuComponent(Window* window);
private:
};

View file

@ -3,7 +3,6 @@
#include "../resources/Font.h"
#include "../Window.h"
#include "../Renderer.h"
#include "ComponentListComponent.h"
TextEditComponent::TextEditComponent(Window* window) : GuiComponent(window),
mBox(window, ":/textbox.png"), mFocused(false),

View file

@ -1,5 +1,4 @@
#ifndef _GUIDETECTDEVICE_H_
#define _GUIDETECTDEVICE_H_
#pragma once
#include "../GuiComponent.h"
@ -19,5 +18,3 @@ private:
int mFinishTimer;
int mCurrentPlayer;
};
#endif

View file

@ -3,8 +3,8 @@
#include "../GuiComponent.h"
#include "../views/gamelist/IGameListView.h"
#include "NinePatchComponent.h"
#include "TextComponent.h"
#include "../components/NinePatchComponent.h"
#include "../components/TextComponent.h"
class GuiFastSelect : public GuiComponent
{

View file

@ -49,29 +49,29 @@ GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std::
using namespace Eigen;
mList.setEntry(Vector2i(0, 0), Vector2i(2, 1), &mHeader, false, ComponentListComponent::AlignCenter);
mList.setEntry(Vector2i(0, 0), Vector2i(2, 1), &mHeader, false, ComponentGrid::AlignCenter);
//y = 1 is a spacer row
mResultName.setText(params.game->getName());
mResultName.setColor(0x3B56CCFF);
mList.setEntry(Vector2i(0, 1), Vector2i(1, 1), &mResultName, false, ComponentListComponent::AlignLeft);
mList.setEntry(Vector2i(0, 1), Vector2i(1, 1), &mResultName, false, ComponentGrid::AlignLeft);
mResultDesc.setText(params.game->metadata.get("desc"));
mResultDesc.setSize(col1Width, 0);
mResultInfo.addChild(&mResultDesc);
mResultInfo.setSize(mResultDesc.getSize().x(), mResultDesc.getFont()->getHeight() * 3.0f);
mList.setEntry(Vector2i(0, 2), Vector2i(1, 1), &mResultInfo, false, ComponentListComponent::AlignLeft);
mList.setEntry(Vector2i(0, 2), Vector2i(1, 1), &mResultInfo, false, ComponentGrid::AlignLeft);
mResultThumbnail.setMaxSize(col2Width, mResultInfo.getSize().y());
mList.setEntry(Vector2i(1, 2), Vector2i(1, 1), &mResultThumbnail, false, ComponentListComponent::AlignCenter);
mList.setEntry(Vector2i(1, 2), Vector2i(1, 1), &mResultThumbnail, false, ComponentGrid::AlignCenter);
//y = 3 is a spacer row
mList.setEntry(Vector2i(0, 4), Vector2i(1, 1), &mSearchLabel, false, ComponentListComponent::AlignLeft);
mList.setEntry(Vector2i(0, 4), Vector2i(1, 1), &mSearchLabel, false, ComponentGrid::AlignLeft);
mSearchText.setValue(!params.nameOverride.empty() ? params.nameOverride : getCleanFileName(params.game->getPath()));
mSearchText.setSize(listWidth - mSearchLabel.getSize().x() - 20, mSearchText.getSize().y());
mList.setEntry(Vector2i(1, 4), Vector2i(1, 1), &mSearchText, true, ComponentListComponent::AlignRight);
mList.setEntry(Vector2i(1, 4), Vector2i(1, 1), &mSearchText, true, ComponentGrid::AlignRight);
//y = 5 is a spacer row
@ -112,12 +112,12 @@ void GuiGameScraper::onSearchDone(std::vector<MetaDataList> results)
if(end == 0)
{
mResultNames.at(0).setText("No games found!");
mList.setEntry(Eigen::Vector2i(0, 6), Eigen::Vector2i(1, 1), &mResultNames.at(0), false, ComponentListComponent::AlignLeft);
mList.setEntry(Eigen::Vector2i(0, 6), Eigen::Vector2i(1, 1), &mResultNames.at(0), false, ComponentGrid::AlignLeft);
}else{
for(int i = 0; i < end; i++)
{
mResultNames.at(i).setText(results.at(i).get("name"));
mList.setEntry(Eigen::Vector2i(0, 6 + i), Eigen::Vector2i(1, 1), &mResultNames.at(i), true, ComponentListComponent::AlignLeft);
mList.setEntry(Eigen::Vector2i(0, 6 + i), Eigen::Vector2i(1, 1), &mResultNames.at(i), true, ComponentGrid::AlignLeft);
}
}

View file

@ -2,14 +2,14 @@
#include "../GuiComponent.h"
#include "../scrapers/Scraper.h"
#include "ComponentListComponent.h"
#include "TextComponent.h"
#include "ScrollableContainer.h"
#include "TextEditComponent.h"
#include "NinePatchComponent.h"
#include "../components/ComponentGrid.h"
#include "../components/TextComponent.h"
#include "../components/ScrollableContainer.h"
#include "../components/TextEditComponent.h"
#include "../components/NinePatchComponent.h"
#include "../components/ImageComponent.h"
#include "../Settings.h"
#include "../HttpReq.h"
#include "ImageComponent.h"
#define MAX_SCRAPER_RESULTS 5
@ -31,7 +31,7 @@ private:
void updateInfoPane();
void updateThumbnail();
ComponentListComponent mList;
ComponentGrid mList;
NinePatchComponent mBox;
TextComponent mHeader;

View file

@ -1,5 +1,4 @@
#ifndef _GUIINPUTCONFIG_H_
#define _GUIINPUTCONFIG_H_
#pragma once
#include "../GuiComponent.h"
#include <string>
@ -19,5 +18,3 @@ private:
int mCurInputId;
bool mCanSkip;
};
#endif

View file

@ -1,8 +1,8 @@
#pragma once
#include "../GuiComponent.h"
#include "TextListComponent.h"
#include "NinePatchComponent.h"
#include "../components/TextListComponent.h"
#include "../components/NinePatchComponent.h"
#include <functional>
class GuiMenu : public GuiComponent

View file

@ -1,11 +1,11 @@
#include "GuiMetaDataEd.h"
#include "../Renderer.h"
#include "../Log.h"
#include "AsyncReqComponent.h"
#include "../components/AsyncReqComponent.h"
#include "../Settings.h"
#include "GuiGameScraper.h"
#include <boost/filesystem.hpp>
#include "GuiMsgBoxYesNo.h"
#include <boost/filesystem.hpp>
#define MDED_RESERVED_ROWS 3
@ -84,10 +84,10 @@ void GuiMetaDataEd::populateList(const std::vector<MetaDataDecl>& mdd)
int y = 0;
//fetch button
mList.setEntry(Vector2i(0, y), Vector2i(1, 1), &mFetchButton, true, ComponentListComponent::AlignLeft);
mList.setEntry(Vector2i(0, y), Vector2i(1, 1), &mFetchButton, true, ComponentGrid::AlignLeft);
//delete button
mList.setEntry(Vector2i(1, y), Vector2i(1, 1), &mDeleteButton, true, ComponentListComponent::AlignRight);
mList.setEntry(Vector2i(1, y), Vector2i(1, 1), &mDeleteButton, true, ComponentGrid::AlignRight);
y++;
@ -95,20 +95,20 @@ void GuiMetaDataEd::populateList(const std::vector<MetaDataDecl>& mdd)
{
TextComponent* label = new TextComponent(mWindow);
label->setText(iter->key);
mList.setEntry(Vector2i(0, y), Vector2i(1, 1), label, false, ComponentListComponent::AlignLeft);
mList.setEntry(Vector2i(0, y), Vector2i(1, 1), label, false, ComponentGrid::AlignLeft);
mLabels.push_back(label);
GuiComponent* ed = MetaDataList::makeEditor(mWindow, iter->type);
ed->setSize(Renderer::getScreenWidth() * 0.4f, ed->getSize().y());
ed->setValue(mMetaData->get(iter->key));
mList.setEntry(Vector2i(1, y), Vector2i(1, 1), ed, true, ComponentListComponent::AlignRight);
mList.setEntry(Vector2i(1, y), Vector2i(1, 1), ed, true, ComponentGrid::AlignRight);
mEditors.push_back(ed);
y++;
}
//save button
mList.setEntry(Vector2i(0, y), Vector2i(2, 1), &mSaveButton, true, ComponentListComponent::AlignCenter);
mList.setEntry(Vector2i(0, y), Vector2i(2, 1), &mSaveButton, true, ComponentGrid::AlignCenter);
}
void GuiMetaDataEd::save()

View file

@ -1,14 +1,15 @@
#pragma once
#include "../GuiComponent.h"
#include "ComponentListComponent.h"
#include "../components/ComponentGrid.h"
#include "../MetaData.h"
#include "TextComponent.h"
#include "NinePatchComponent.h"
#include "ButtonComponent.h"
#include <functional>
#include "../components/TextComponent.h"
#include "../components/NinePatchComponent.h"
#include "../components/ButtonComponent.h"
#include "../scrapers/Scraper.h"
#include <functional>
class GuiMetaDataEd : public GuiComponent
{
public:
@ -31,7 +32,7 @@ private:
NinePatchComponent mBox;
ComponentListComponent mList;
ComponentGrid mList;
TextComponent mHeader;

View file

@ -1,7 +1,7 @@
#pragma once
#include "../GuiComponent.h"
#include "TextComponent.h"
#include "../components/TextComponent.h"
#include <functional>
//A simple popup message box with callbacks for when the user dismisses it.

View file

@ -1,7 +1,7 @@
#pragma once
#include "../GuiComponent.h"
#include "TextComponent.h"
#include "../components/TextComponent.h"
#include <functional>
//A simple "yes or no" popup box with callbacks for yes or no.

View file

@ -1,6 +1,6 @@
#include "GuiScraperLog.h"
#include "../Settings.h"
#include "GuiGameScraper.h"
#include "../Settings.h"
#include "../Renderer.h"
#include "../Log.h"
#include "../XMLReader.h"

View file

@ -1,11 +1,12 @@
#pragma once
#include "../GuiComponent.h"
#include "NinePatchComponent.h"
#include <queue>
#include "../components/NinePatchComponent.h"
#include "../scrapers/Scraper.h"
#include "../components/TextComponent.h"
#include <queue>
#include <boost/circular_buffer.hpp>
#include "TextComponent.h"
//A "terminal" of sorts for scraping.
//Doesn't accept input, but renders log-style messages and handles the callback chain for multi-game scraping.

View file

@ -28,8 +28,8 @@ GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window),
mFiltersOpt.addEntry(mFiltersOpt.makeEntry("Missing Image",
[](SystemData*, FileData* g) -> bool { return g->metadata.get("image").empty(); }));
mList.setEntry(Vector2i(0, 0), Vector2i(1, 1), &mFilterLabel, false, ComponentListComponent::AlignRight);
mList.setEntry(Vector2i(1, 0), Vector2i(1, 1), &mFiltersOpt, true, ComponentListComponent::AlignLeft);
mList.setEntry(Vector2i(0, 0), Vector2i(1, 1), &mFilterLabel, false, ComponentGrid::AlignRight);
mList.setEntry(Vector2i(1, 0), Vector2i(1, 1), &mFiltersOpt, true, ComponentGrid::AlignLeft);
//add systems (all with a platformid specified selected)
std::vector<SystemData*> sys = SystemData::sSystemVector;
@ -38,15 +38,15 @@ GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window),
return mSystemsOpt.makeEntry(s->getName(), s, s->getPlatformId() != PlatformIds::PLATFORM_UNKNOWN);
});
mList.setEntry(Vector2i(0, 1), Vector2i(1, 1), &mSystemsLabel, false, ComponentListComponent::AlignRight);
mList.setEntry(Vector2i(1, 1), Vector2i(1, 1), &mSystemsOpt, true, ComponentListComponent::AlignLeft);
mList.setEntry(Vector2i(0, 1), Vector2i(1, 1), &mSystemsLabel, false, ComponentGrid::AlignRight);
mList.setEntry(Vector2i(1, 1), Vector2i(1, 1), &mSystemsOpt, true, ComponentGrid::AlignLeft);
mList.setEntry(Vector2i(0, 2), Vector2i(1, 1), &mManualLabel, false, ComponentListComponent::AlignRight);
mList.setEntry(Vector2i(1, 2), Vector2i(1, 1), &mManualSwitch, true, ComponentListComponent::AlignLeft);
mList.setEntry(Vector2i(0, 2), Vector2i(1, 1), &mManualLabel, false, ComponentGrid::AlignRight);
mList.setEntry(Vector2i(1, 2), Vector2i(1, 1), &mManualSwitch, true, ComponentGrid::AlignLeft);
mStartButton.setText("GO GO GO GO", "begin", 0x00FF00FF);
mStartButton.setPressedFunc(std::bind(&GuiScraperStart::pressedStart, this));
mList.setEntry(Vector2i(0, 3), Vector2i(2, 1), &mStartButton, true, ComponentListComponent::AlignCenter);
mList.setEntry(Vector2i(0, 3), Vector2i(2, 1), &mStartButton, true, ComponentGrid::AlignCenter);
mList.setPosition(Renderer::getScreenWidth() / 2 - mList.getSize().x() / 2, Renderer::getScreenHeight() / 2 - mList.getSize().y() / 2);

View file

@ -2,11 +2,11 @@
#include "../GuiComponent.h"
#include "../SystemData.h"
#include "TextComponent.h"
#include "ComponentListComponent.h"
#include "OptionListComponent.h"
#include "SwitchComponent.h"
#include "ButtonComponent.h"
#include "../components/TextComponent.h"
#include "../components/ComponentGrid.h"
#include "../components/OptionListComponent.h"
#include "../components/SwitchComponent.h"
#include "../components/ButtonComponent.h"
#include "../scrapers/Scraper.h"
#include <queue>
@ -30,7 +30,7 @@ private:
std::queue<ScraperSearchParams> getSearches(std::vector<SystemData*> systems, GameFilterFunc selector);
NinePatchComponent mBox;
ComponentListComponent mList;
ComponentGrid mList;
TextComponent mFilterLabel;
TextComponent mSystemsLabel;
@ -42,13 +42,3 @@ private:
ButtonComponent mStartButton;
};
/*
Filter: [MISSING IMAGES | ALL]
Systems: [# selected]
Manual Mode: [ON | OFF]
GO GO GO
*/

View file

@ -31,37 +31,37 @@ GuiSettingsMenu::GuiSettingsMenu(Window* window) : GuiComponent(window),
TextComponent* label = new TextComponent(mWindow);
label->setText("Draw Framerate: ");
label->setColor(0x0000FFFF);
mList.setEntry(Vector2i(0, 0), Vector2i(1, 1), label, false, ComponentListComponent::AlignRight, Matrix<bool, 1, 2>(true, true));
mList.setEntry(Vector2i(0, 0), Vector2i(1, 1), label, false, ComponentGrid::AlignRight, Matrix<bool, 1, 2>(true, true));
mLabels.push_back(label);
//drawFramerate switch
mList.setEntry(Vector2i(1, 0), Vector2i(1, 1), &mDrawFramerateSwitch, true, ComponentListComponent::AlignCenter, Matrix<bool, 1, 2>(true, true));
mList.setEntry(Vector2i(1, 0), Vector2i(1, 1), &mDrawFramerateSwitch, true, ComponentGrid::AlignCenter, Matrix<bool, 1, 2>(true, true));
//volume label
label = new TextComponent(mWindow);
label->setText("System volume: ");
label->setColor(0x0000FFFF);
mLabels.push_back(label);
mList.setEntry(Vector2i(0, 1), Vector2i(1, 1), label, false, ComponentListComponent::AlignRight, Matrix<bool, 1, 2>(true, true));
mList.setEntry(Vector2i(0, 1), Vector2i(1, 1), label, false, ComponentGrid::AlignRight, Matrix<bool, 1, 2>(true, true));
//volume slider
mList.setEntry(Vector2i(1, 1), Vector2i(1, 1), &mVolumeSlider, true, ComponentListComponent::AlignCenter, Matrix<bool, 1, 2>(true, true));
mList.setEntry(Vector2i(1, 1), Vector2i(1, 1), &mVolumeSlider, true, ComponentGrid::AlignCenter, Matrix<bool, 1, 2>(true, true));
//disable sounds
label = new TextComponent(mWindow);
label->setText("Disable sounds: ");
label->setColor(0x0000FFFF);
mLabels.push_back(label);
mList.setEntry(Vector2i(0, 2), Vector2i(1, 1), label, false, ComponentListComponent::AlignRight, Matrix<bool, 1, 2>(true, true));
mList.setEntry(Vector2i(0, 2), Vector2i(1, 1), label, false, ComponentGrid::AlignRight, Matrix<bool, 1, 2>(true, true));
mList.setEntry(Vector2i(1, 2), Vector2i(1, 1), &mDisableSoundsSwitch, true, ComponentListComponent::AlignCenter, Matrix<bool, 1, 2>(true, true));
mList.setEntry(Vector2i(1, 2), Vector2i(1, 1), &mDisableSoundsSwitch, true, ComponentGrid::AlignCenter, Matrix<bool, 1, 2>(true, true));
//scraper label
label = new TextComponent(mWindow);
label->setText("Scraper: ");
label->setColor(0x0000FFFF);
mLabels.push_back(label);
mList.setEntry(Vector2i(0, 3), Vector2i(1, 1), label, false, ComponentListComponent::AlignRight);
mList.setEntry(Vector2i(0, 3), Vector2i(1, 1), label, false, ComponentGrid::AlignRight);
//fill scraper list
std::vector< std::shared_ptr<Scraper> > scrapers;
@ -71,37 +71,37 @@ GuiSettingsMenu::GuiSettingsMenu(Window* window) : GuiComponent(window),
return mScraperOptList.makeEntry(s->getName(), s, s->getName() == Settings::getInstance()->getScraper()->getName());
} );
mList.setEntry(Vector2i(1, 3), Vector2i(1, 1), &mScraperOptList, true, ComponentListComponent::AlignCenter);
mList.setEntry(Vector2i(1, 3), Vector2i(1, 1), &mScraperOptList, true, ComponentGrid::AlignCenter);
//scrape ratings label
label = new TextComponent(mWindow);
label->setText("Scrape ratings? ");
label->setColor(0x0000FFFF);
mLabels.push_back(label);
mList.setEntry(Vector2i(0, 4), Vector2i(1, 1), label, false, ComponentListComponent::AlignRight);
mList.setEntry(Vector2i(0, 4), Vector2i(1, 1), label, false, ComponentGrid::AlignRight);
mList.setEntry(Vector2i(1, 4), Vector2i(1, 1), &mScrapeRatingsSwitch, true, ComponentListComponent::AlignCenter);
mList.setEntry(Vector2i(1, 4), Vector2i(1, 1), &mScrapeRatingsSwitch, true, ComponentGrid::AlignCenter);
// dim time label
label = new TextComponent(mWindow);
label->setText("Dim after: ");
label->setColor(0x0000FFFF);
mLabels.push_back(label);
mList.setEntry(Vector2i(0, 5), Vector2i(1, 1), label, false, ComponentListComponent::AlignRight);
mList.setEntry(Vector2i(1, 5), Vector2i(1, 1), &mDimSlider, true, ComponentListComponent::AlignCenter);
mList.setEntry(Vector2i(0, 5), Vector2i(1, 1), label, false, ComponentGrid::AlignRight);
mList.setEntry(Vector2i(1, 5), Vector2i(1, 1), &mDimSlider, true, ComponentGrid::AlignCenter);
// disable help switch
label = new TextComponent(mWindow);
label->setText("Disable help: ");
label->setColor(0x0000FFFF);
mLabels.push_back(label);
mList.setEntry(Vector2i(0, 6), Vector2i(1, 1), label, false, ComponentListComponent::AlignRight);
mList.setEntry(Vector2i(1, 6), Vector2i(1, 1), &mDisableHelpSwitch, true, ComponentListComponent::AlignCenter);
mList.setEntry(Vector2i(0, 6), Vector2i(1, 1), label, false, ComponentGrid::AlignRight);
mList.setEntry(Vector2i(1, 6), Vector2i(1, 1), &mDisableHelpSwitch, true, ComponentGrid::AlignCenter);
//save button
mSaveButton.setText("SAVE", "apply & save", 0x00FF00FF);
mSaveButton.setPressedFunc([this] () { applyStates(); delete this; });
mList.setEntry(Vector2i(0, 7), Vector2i(2, 1), &mSaveButton, true, ComponentListComponent::AlignCenter, Matrix<bool, 1, 2>(false, true));
mList.setEntry(Vector2i(0, 7), Vector2i(2, 1), &mSaveButton, true, ComponentGrid::AlignCenter, Matrix<bool, 1, 2>(false, true));
//center list
mList.setPosition(Renderer::getScreenWidth() / 2 - mList.getSize().x() / 2, Renderer::getScreenHeight() / 2 - mList.getSize().y() / 2);

View file

@ -1,15 +1,13 @@
#ifndef _SETTINGSMENU_H_
#define _SETTINGSMENU_H_
#pragma once
#include "../GuiComponent.h"
#include "ComponentListComponent.h"
#include <vector>
#include "SwitchComponent.h"
#include "SliderComponent.h"
#include "TextComponent.h"
#include "NinePatchComponent.h"
#include "OptionListComponent.h"
#include "ButtonComponent.h"
#include "../components/ComponentGrid.h"
#include "../components/SwitchComponent.h"
#include "../components/SliderComponent.h"
#include "../components/TextComponent.h"
#include "../components/NinePatchComponent.h"
#include "../components/OptionListComponent.h"
#include "../components/ButtonComponent.h"
#include "../scrapers/Scraper.h"
class GuiSettingsMenu : public GuiComponent
@ -26,7 +24,7 @@ private:
void loadStates();
void applyStates();
ComponentListComponent mList;
ComponentGrid mList;
NinePatchComponent mBox;
@ -41,5 +39,3 @@ private:
std::vector<GuiComponent*> mLabels;
};
#endif

View file

@ -8,7 +8,7 @@
#include "views/ViewController.h"
#include "SystemData.h"
#include <boost/filesystem.hpp>
#include "components/GuiDetectDevice.h"
#include "guis/GuiDetectDevice.h"
#include "AudioManager.h"
#include "platform.h"
#include "Log.h"

View file

@ -1,5 +1,5 @@
#include "GamesDBScraper.h"
#include "../components/GuiGameScraper.h"
#include "../guis/GuiGameScraper.h"
#include "../components/AsyncReqComponent.h"
#include "../Log.h"
#include "../pugiXML/pugixml.hpp"

View file

@ -1,5 +1,5 @@
#include "TheArchiveScraper.h"
#include "../components/GuiGameScraper.h"
#include "../guis/GuiGameScraper.h"
#include "../components/AsyncReqComponent.h"
#include "../Log.h"
#include "../pugiXML/pugixml.hpp"

View file

@ -5,7 +5,7 @@
#include "gamelist/BasicGameListView.h"
#include "gamelist/DetailedGameListView.h"
#include "gamelist/GridGameListView.h"
#include "../components/GuiMenu.h"
#include "../guis/GuiMenu.h"
#include "../animations/LaunchAnimation.h"
#include "../animations/MoveCameraAnimation.h"
#include "../animations/LambdaAnimation.h"

View file

@ -1,8 +1,8 @@
#include "IGameListView.h"
#include "../../Window.h"
#include "../../components/GuiMetaDataEd.h"
#include "../../components/GuiMenu.h"
#include "../../components/GuiFastSelect.h"
#include "../../guis/GuiMetaDataEd.h"
#include "../../guis/GuiMenu.h"
#include "../../guis/GuiFastSelect.h"
#include "../ViewController.h"
#include "../../Settings.h"