Create a bunch of empty icons for later usage

This commit is contained in:
Maschell 2020-02-21 15:01:14 +01:00
parent 477efedf24
commit d7ed76e9f6
3 changed files with 19 additions and 3 deletions

BIN
data/images/iconEmpty.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -49,7 +49,8 @@ GuiIconGrid::GuiIconGrid(int32_t w, int32_t h, uint64_t GameIndex,bool sortByNam
, arrowLeftImage(arrowLeftImageData)
, arrowRightButton(arrowRightImage.getWidth(), arrowRightImage.getHeight())
, arrowLeftButton(arrowLeftImage.getWidth(), arrowLeftImage.getHeight())
, noIcon(Resources::GetFile("noGameIcon.png"), Resources::GetFileSize("noGameIcon.png"), GX2_TEX_CLAMP_MODE_MIRROR) {
, noIcon(Resources::GetFile("noGameIcon.png"), Resources::GetFileSize("noGameIcon.png"), GX2_TEX_CLAMP_MODE_MIRROR)
, emptyIcon(Resources::GetFile("iconEmpty.png"), Resources::GetFileSize("iconEmpty.png"), GX2_TEX_CLAMP_MODE_MIRROR) {
particleBgImage.setParent(this);
selectedGame = GameIndex;
@ -76,6 +77,11 @@ GuiIconGrid::GuiIconGrid(int32_t w, int32_t h, uint64_t GameIndex,bool sortByNam
arrowRightButton.setTrigger(&buttonRTrigger);
arrowRightButton.setSoundClick(buttonClickSound);
arrowRightButton.clicked.connect(this, &GuiIconGrid::OnRightArrowClick);
for(int i = 0; i< MAX_COLS * MAX_ROWS *2; i++) {
GameIcon * image = new GameIcon(&emptyIcon);
emptyIcons.push_back(image);
}
}
GuiIconGrid::~GuiIconGrid() {
@ -86,6 +92,12 @@ GuiIconGrid::~GuiIconGrid() {
}
gameInfoContainers.clear();
containerMutex.unlock();
for (auto const& x : emptyIcons) {
AsyncExecutor::pushForDelete(x);
}
emptyIcons.clear();
}
void GuiIconGrid::setSelectedGame(uint64_t idx) {
@ -113,7 +125,6 @@ uint64_t GuiIconGrid::getSelectedGame(void) {
}
void GuiIconGrid::OnGameTitleListUpdated(GameList * gameList) {
gameList->lock();
containerMutex.lock();
// At first delete the ones that were deleted;

View File

@ -72,6 +72,7 @@ private:
GuiButton arrowLeftButton;
GuiImageData noIcon;
GuiImageData emptyIcon;
void OnLeftArrowClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
void OnRightArrowClick(GuiButton *button, const GuiController *controller, GuiTrigger *trigger);
@ -122,4 +123,8 @@ private:
std::recursive_mutex containerMutex;
std::map<uint64_t, GameInfoContainer *> gameInfoContainers;
std::vector<GuiImage *> emptyIcons;
};