diff --git a/changelog.txt b/changelog.txt index 7d351cd91..66a972e09 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +October 7 +-Fixed borders for GuiBox. Still need to flip the right border and bottom border. + October 5 -GuiFastSelect is working, but ugly. -Began work on GuiBox for theming the fast select dialog. diff --git a/src/XMLReader.cpp b/src/XMLReader.cpp index 3cb3d6c98..3132a7319 100644 --- a/src/XMLReader.cpp +++ b/src/XMLReader.cpp @@ -107,7 +107,7 @@ void parseGamelist(SystemData* system) std::string xmlpath = system->getRootFolder()->getPath() + "/gamelist.xml"; - std::cout << "Parsing XML file \"" << xmlpath << "\"...\n"; + std::cout << "Parsing XML file \"" << xmlpath << "\"..."; pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(xmlpath.c_str()); @@ -177,5 +177,5 @@ void parseGamelist(SystemData* system) } } - std::cout << "XML parsing complete.\n"; + std::cout << "done.\n"; } diff --git a/src/components/GuiBox.cpp b/src/components/GuiBox.cpp index 9a617666c..d76c5f354 100644 --- a/src/components/GuiBox.cpp +++ b/src/components/GuiBox.cpp @@ -11,33 +11,63 @@ GuiBox::GuiBox(int offsetX, int offsetY, unsigned int width, unsigned int height void GuiBox::setHorizontalImage(std::string path, bool tiled) { + mHorizontalImage.setResize(12, mHeight, true); + mHorizontalImage.setTiling(tiled); + mHorizontalImage.setOrigin(0, 0); + mHorizontalImage.setImage(path); } void GuiBox::setVerticalImage(std::string path, bool tiled) { + mVerticalImage.setResize(mWidth, 12, true); + mVerticalImage.setTiling(tiled); + mVerticalImage.setOrigin(0, 0); + mVerticalImage.setImage(path); } void GuiBox::setBackgroundImage(std::string path, bool tiled) { - mBackgroundImage.setImage(path); + mBackgroundImage.setResize(mWidth, mHeight, true); mBackgroundImage.setTiling(tiled); + mBackgroundImage.setOffsetX(getOffsetX()); + mBackgroundImage.setOffsetY(getOffsetY()); + + mBackgroundImage.setImage(path); +} + +void GuiBox::setCornerImage(std::string path) +{ + mCornerImage.setResize(getHorizontalBorderWidth(), getVerticalBorderWidth(), true); } void GuiBox::onRender() { //left border - mHorizontalImage.setOffsetX(getOffsetX()); + mHorizontalImage.setOffsetX(getOffsetX() - getHorizontalBorderWidth()); mHorizontalImage.setOffsetY(getOffsetY()); - mHorizontalImage.setOrigin(0.5, 0); - mHorizontalImage.setResize(12, mHeight, true); mHorizontalImage.render(); + //Renderer::drawRect(getOffsetX() - getHorizontalBorderWidth(), getOffsetY(), getHorizontalBorderWidth(), mHeight, 0xFF0000); //right border mHorizontalImage.setOffsetX(getOffsetX() + mWidth); - mHorizontalImage.setOffsetY(getOffsetY()); + //same Y mHorizontalImage.render(); + //Renderer::drawRect(getOffsetX() + mWidth, getOffsetY(), getHorizontalBorderWidth(), mHeight, 0xFF0000); + + //top border + mVerticalImage.setOffsetX(getOffsetX()); + mVerticalImage.setOffsetY(getOffsetY() - getVerticalBorderWidth()); + mVerticalImage.render(); + //Renderer::drawRect(getOffsetX(), getOffsetY() - getVerticalBorderWidth(), mWidth, getVerticalBorderWidth(), 0x00FF00); + + //bottom border + //same X + mVerticalImage.setOffsetY(getOffsetY() + mHeight); + mVerticalImage.render(); + //Renderer::drawRect(getOffsetX(), getOffsetY() + mHeight, mWidth, getVerticalBorderWidth(), 0x00FF00); + } void GuiBox::onInit() @@ -51,3 +81,14 @@ void GuiBox::onDeinit() mHorizontalImage.deinit(); mVerticalImage.deinit(); } + + +int GuiBox::getHorizontalBorderWidth() +{ + return 12; +} + +int GuiBox::getVerticalBorderWidth() +{ + return 12; +} diff --git a/src/components/GuiBox.h b/src/components/GuiBox.h index 720880341..64af57bd1 100644 --- a/src/components/GuiBox.h +++ b/src/components/GuiBox.h @@ -13,13 +13,17 @@ public: void setBackgroundImage(std::string path, bool tiled = true); void setHorizontalImage(std::string path, bool tiled = false); void setVerticalImage(std::string path, bool tiled = false); + void setCornerImage(std::string path); void onRender(); void onInit(); void onDeinit(); private: - GuiImage mBackgroundImage, mHorizontalImage, mVerticalImage; + GuiImage mBackgroundImage, mHorizontalImage, mVerticalImage, mCornerImage; + + int getHorizontalBorderWidth(); + int getVerticalBorderWidth(); unsigned int mWidth, mHeight; }; diff --git a/src/components/GuiFastSelect.cpp b/src/components/GuiFastSelect.cpp index 980663ec7..e00e0bf7b 100644 --- a/src/components/GuiFastSelect.cpp +++ b/src/components/GuiFastSelect.cpp @@ -27,7 +27,8 @@ GuiFastSelect::GuiFastSelect(GuiComponent* parent, GuiList* list, cha addChild(mBox); //set test mBox info - //mBox->setHorizontalImage("test.jpg"); + //mBox->setHorizontalImage("test.jpg", false); + //mBox->setVerticalImage("test.jpg", false); mParent->pause(); } diff --git a/src/components/GuiGameList.cpp b/src/components/GuiGameList.cpp index 7ab5c30d9..e21147b5c 100644 --- a/src/components/GuiGameList.cpp +++ b/src/components/GuiGameList.cpp @@ -11,7 +11,7 @@ const float GuiGameList::sInfoWidth = 0.5; GuiGameList::GuiGameList(bool useDetail) { - std::cout << "Creating GuiGameList\n"; + //std::cout << "Creating GuiGameList\n"; mDetailed = useDetail; mTheme = new GuiTheme(); //not a child because it's rendered manually by GuiGameList::onRender (to make sure it's rendered first)