*Fixes for Grid (not yet completly done)

This commit is contained in:
dimok321 2009-05-25 17:59:28 +00:00
parent 305dc85fc3
commit 1c0ecfd589
4 changed files with 53 additions and 97 deletions

File diff suppressed because one or more lines are too long

View File

@ -18,9 +18,7 @@
#define GAMESELECTSIZE 30
extern const int vol;
//int txtscroll = 0;
int changed = 0;
int tooMuch;
/**
* Constructor for the GuiGameGrid class.
*/
@ -51,7 +49,8 @@ GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int gameCnt, const ch
trigMinus = new GuiTrigger;
trigMinus->SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
btnSoundClick = new GuiSound(button_click_pcm, button_click_pcm_size, SOUND_PCM, vol);
btnSoundClick = new GuiSound(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, vol);
btnSoundOver = new GuiSound(button_over_pcm, button_over_pcm_size, SOUND_PCM, vol);
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_left.png", CFG.theme_path);
imgLeft = new GuiImageData(imgPath, startgame_arrow_left_png);
@ -65,6 +64,7 @@ GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int gameCnt, const ch
btnLeft->SetParent(this);
btnLeft->SetImage(btnLeftImg);
btnLeft->SetSoundOver(btnSoundOver);
btnLeft->SetSoundClick(btnSoundClick);
btnLeft->SetTrigger(trigA);
btnLeft->SetTrigger(trigL);
btnLeft->SetTrigger(trigMinus);
@ -77,6 +77,7 @@ GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int gameCnt, const ch
btnRight->SetPosition(-20, -30);
btnRight->SetImage(btnRightImg);
btnRight->SetSoundOver(btnSoundOver);
btnRight->SetSoundClick(btnSoundClick);
btnRight->SetTrigger(trigA);
btnRight->SetTrigger(trigR);
btnRight->SetTrigger(trigPlus);
@ -128,12 +129,16 @@ GuiGameGrid::GuiGameGrid(int w, int h, struct discHdr * l, int gameCnt, const ch
if (i>3)game[i]->SetPosition(117+(i-4)*110,185);
game[i]->SetRumble(false);
game[i]->SetTrigger(trigA);
game[i]->SetSoundOver(btnSoundOver);
game[i]->SetSoundClick(btnSoundClick);
game[i]->SetEffectGrow();
game[i]->SetVisible(true);
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
game[i]->SetVisible(false);
game[i]->SetClickable(true);
coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1))) {
game[i]->SetVisible(false);
game[i]->SetClickable(false);
}
}
}
@ -297,7 +302,6 @@ void GuiGameGrid::Update(GuiTrigger * t)
game[i]->SetVisible(true);
game[i]->SetState(STATE_DEFAULT);
}
gameIndex[i] = next;
next = this->FindMenuItem(next, 1);
}
@ -312,9 +316,8 @@ void GuiGameGrid::Update(GuiTrigger * t)
if(i != selectedItem && game[i]->GetState() == STATE_SELECTED)
game[i]->ResetState();
else if(i == selectedItem && game[i]->GetState() == STATE_DEFAULT)
game[selectedItem]->SetState(STATE_SELECTED);
game[selectedItem]->SetState(STATE_SELECTED, t->chan);
}
game[i]->Update(t);
if(game[i]->GetState() == STATE_SELECTED)
@ -327,7 +330,7 @@ void GuiGameGrid::Update(GuiTrigger * t)
if(!focus)
return; // skip navigation
if ((t->Right() || btnRight->GetState() == STATE_CLICKED) ) {
if ((t->Right() || btnRight->GetState() == STATE_CLICKED)) {
changed += pagesize;
if (changed>gameCnt-1)
@ -371,9 +374,12 @@ void GuiGameGrid::Update(GuiTrigger * t)
coverImg[i]->SetPosition(-10,-35);
game[i]->SetImage(coverImg[i]);
game[i]->SetVisible(true);
coverImg[i]->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 65);
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
game[i]->SetVisible(false);//}
game[i]->SetClickable(true);
coverImg[i]->SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 65);
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1))) {
game[i]->SetVisible(false);
game[i]->SetClickable(false);
}
}
btnRight->ResetState();
@ -424,14 +430,16 @@ void GuiGameGrid::Update(GuiTrigger * t)
game[i]->ResetState();
game[i]->SetVisible(true);
game[i]->SetImage(coverImg[i]);
coverImg[i]->SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 65);//}
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
game[i]->SetClickable(true);
coverImg[i]->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 65);
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1))) {
game[i]->SetVisible(false);
game[i]->SetClickable(false);
}
}
btnLeft->ResetState();
}
if(updateCB)
updateCB(this);
}
@ -442,7 +450,6 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
gameList = l;
gameCnt = count;
changed=0;
tooMuch=(gameCnt-(gameCnt%12));
scrollbaron = (gameCnt > pagesize) ? 1 : 0;
selectedItem = 0;
listOffset = 0;
@ -450,9 +457,7 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
char IDfull[7];
char imgPath[100];
for(int i=0; i<pagesize; i++)
{
coverImg[i]->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
for(int i=0; i<pagesize; i++) {
if(coverImg[i]) {
delete coverImg[i];
@ -492,9 +497,11 @@ void GuiGameGrid::Reload(struct discHdr * l, int count)
game[i]->ResetState();
game[i]->SetVisible(true);
game[i]->SetImage(coverImg[i]);
coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);//}
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1)))
game[i]->SetClickable(true);
coverImg[i]->SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
if (((changed+pagesize)>gameCnt)&&(i>((gameCnt-changed)-1))) {
game[i]->SetVisible(false);
game[i]->ResetState();}
game[i]->SetClickable(false);
}
}
}

View File

@ -3,31 +3,6 @@
#include "gui.h"
#include "../disc.h"
/*
class GameBrowserList {
public:
GameBrowserList(int size) {
name = new char * [size];
for (int i = 0; i < size; i++)
{
name[i] = new char[50];
}
length = size;
};
~GameBrowserList(){
for (int i = 0; i < length; i++)
{
delete [] name[i];
}
delete [] name;
};
public:
int length;
char ** name;
};
*/
class GuiGameGrid : public GuiElement
{
@ -49,6 +24,7 @@ class GuiGameGrid : public GuiElement
int listOffset;
int scrollbaron;
int pagesize;
int changed;
struct discHdr * gameList;
int gameCnt;
@ -56,43 +32,16 @@ class GuiGameGrid : public GuiElement
int * gameIndex;
GuiButton ** game;
GuiText ** gameTxt;
//GuiImage ** gameBg;
GuiImage ** coverImg;
GuiImageData ** cover;
//GuiButton * arrowUpBtn;
//GuiButton * arrowDownBtn;
//GuiButton * scrollbarBoxBtn;
GuiButton * btnRight;
GuiButton * btnLeft;
//GuiImage * bgGameImg;
//GuiImage * scrollbarImg;
//GuiImage * arrowDownImg;
//GuiImage * arrowDownOverImg;
//GuiImage * ttarrowUpImg;
//GuiImage * ttarrowDownImg;
//GuiImage * arrowUpImg;
//GuiImage * arrowUpOverImg;
//GuiImage * scrollbarBoxImg;
//GuiImage * scrollbarBoxOverImg;
GuiImage * btnLeftImg;
GuiImage * btnRightImg;
GuiText * ttarrowDownTxt;
GuiText * ttarrowUpTxt;
//GuiImageData * bgGames;
//GuiImageData * bgGamesEntry;
//GuiImageData * scrollbar;
//GuiImageData * arrowDown;
//GuiImageData * arrowDownOver;
//GuiImageData * ttarrow;
//GuiImageData * arrowUp;
//GuiImageData * arrowUpOver;
//GuiImageData * scrollbarBox;
//GuiImageData * scrollbarBoxOver;
GuiImageData * imgLeft;
GuiImageData * imgRight;

View File

@ -3124,7 +3124,9 @@ static int MenuDiscList()
w.Append(&installBtn);
w.Append(&homeBtn);
w.Append(&settingsBtn);
if (Settings.gameDisplay==list){
w.Append(&DownloadBtn);
}
w.Append(&favoriteBtn);
w.Append(&abcBtn);
w.Append(&countBtn);
@ -3411,39 +3413,36 @@ static int MenuDiscList()
countBtn.SetAlpha(255);
}
countBtn.ResetState();
}
else if(gridBtn.GetState() == STATE_CLICKED)
{
} else if(gridBtn.GetState() == STATE_CLICKED) {
if (Settings.gameDisplay==list){
Settings.gameDisplay=grid;
mainWindow->Remove(&gameBrowser);
mainWindow->Append(&gameGrid);
if (GameIDTxt)w.Remove(GameIDTxt);
if (GameRegionTxt)w.Remove(GameRegionTxt);
if (coverImg)w.Remove(&DownloadBtn);
w.Remove(&DownloadBtn);
gridBtn.SetImage(&listBtnImg_g);
favoriteBtn.SetPosition(-80,13);
abcBtn.SetPosition(-48,13);
countBtn.SetPosition(-16,13);
gridBtn.SetPosition(16,13);
carosselleBtn.SetPosition(48,13);
if((Settings.hddinfo == hr12)||(Settings.hddinfo == hr24)) {
clockTime.SetPosition(THEME.clock_x, THEME.clock_y+3);
clockTimeBack.SetPosition(THEME.clock_x, THEME.clock_y+3);
w.Append(&clockTime);
w.Append(&clockTimeBack);
}
w.Append(&favoriteBtn);
w.Append(&abcBtn);
w.Append(&countBtn);
w.Append(&gridBtn);
w.Append(&carosselleBtn);}
w.Append(&carosselleBtn);
else if (Settings.gameDisplay==grid){
} else if (Settings.gameDisplay==grid){
Settings.gameDisplay=list;
mainWindow->Remove(&gameGrid);
@ -3465,12 +3464,12 @@ static int MenuDiscList()
w.Append(&abcBtn);
w.Append(&countBtn);
w.Append(&gridBtn);
w.Append(&carosselleBtn);}
w.Append(&carosselleBtn);
w.Append(&DownloadBtn);
}
if(isSdInserted()) {
cfg_save_global();
}
//menu = MENU_DISCLIST;
gridBtn.ResetState();
}
@ -3478,7 +3477,8 @@ static int MenuDiscList()
if (Settings.gameDisplay==grid){
int selectimg;
selectimg = gameGrid.GetSelectedOption();
gameSelected = gameGrid.GetClickedOption();}
gameSelected = gameGrid.GetClickedOption();
}
if (Settings.gameDisplay==list) {
//Get selected game under cursor