changed the keyboard to use the new button constructors. fixed bug in one of the button over image. commented and documented the new button shit.

This commit is contained in:
giantpune 2009-05-28 22:23:20 +00:00
parent b81c8af3e9
commit 518858a351
3 changed files with 93 additions and 65 deletions

View File

@ -751,7 +751,21 @@ class GuiButton : public GuiElement
//!\param w Width //!\param w Width
//!\param h Height //!\param h Height
GuiButton(int w, int h); GuiButton(int w, int h);
//!\param img is the button GuiImage. it uses the height & width of this image for the button
//!\param imgOver is the button's over GuiImage
//!\param hor is horizontal alingment of the button
//!\param vert is verticle alignment of the button
//!\param x is xposition of the button
//!\param y is yposition of the button
//!\param trig is a GuiTrigger to assign to this button
//!\param sndOver is a GuiSound used for soundOnOver for this button
//!\param sndClick is a GuiSound used for clickSound of this button
//!\param grow sets effect grow for this button. 1 for yes ;0 for no
GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, int y, GuiTrigger* trig, GuiSound* sndOver, GuiSound* sndClick, u8 grow); GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, int y, GuiTrigger* trig, GuiSound* sndOver, GuiSound* sndClick, u8 grow);
//!\param same as all the parameters for the above button plus the following
//!\param tt is a GuiTooltip assigned to this button
//!\param ttx and tty are the xPOS and yPOS for this tooltip in relationship to the button
//!\param h_align and v_align are horizontal and verticle alignment for the tooltip in relationship to the button
GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, int y, GuiTrigger* trig, GuiSound* sndOver, GuiSound* sndClick, u8 grow, GuiTooltip* tt, int ttx, int tty, int h_align, int v_align); GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, int y, GuiTrigger* trig, GuiSound* sndOver, GuiSound* sndClick, u8 grow, GuiTooltip* tt, int ttx, int tty, int h_align, int v_align);
//!Destructor //!Destructor
~GuiButton(); ~GuiButton();

View File

@ -301,102 +301,111 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
keyBackImg = new GuiImage(keyMedium); keyBackImg = new GuiImage(keyMedium);
keyBackOverImg = new GuiImage(keyMediumOver); keyBackOverImg = new GuiImage(keyMediumOver);
keyBackText = new GuiText("Back", 20, (GXColor){0, 0, 0, 0xff}); keyBackText = new GuiText("Back", 20, (GXColor){0, 0, 0, 0xff});
keyBack = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); //GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, int y, GuiTrigger* trig, GuiSound* sndOver, GuiSound* sndClick, u8 grow);
keyBack->SetImage(keyBackImg);
keyBack->SetImageOver(keyBackOverImg); //keyBack = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
keyBack = new GuiButton(keyBackImg, keyBackOverImg, 0, 3, 11*42+40+eurocheck, 0*42+120, trigA, keySoundOver, keySoundClick,1);
//keyBack->SetImage(keyBackImg);
//keyBack->SetImageOver(keyBackOverImg);
keyBack->SetLabel(keyBackText); keyBack->SetLabel(keyBackText);
keyBack->SetSoundOver(keySoundOver); //keyBack->SetSoundOver(keySoundOver);
keyBack->SetSoundClick(keySoundClick); //keyBack->SetSoundClick(keySoundClick);
keyBack->SetTrigger(trigA); //keyBack->SetTrigger(trigA);
keyBack->SetTrigger(trigB); keyBack->SetTrigger(trigB);
if (mode > 1){ if (mode > 1){
keyBack->SetPosition(11*42+40+eurocheck, 0*42+120);} keyBack->SetPosition(11*42+40+eurocheck, 0*42+120);}
else{ else{
keyBack->SetPosition(10*42+40+eurocheck, 0*42+120);}//(10*42+40, 0*42+80); keyBack->SetPosition(10*42+40+eurocheck, 0*42+120);}//(10*42+40, 0*42+80);
keyBack->SetEffectGrow(); //keyBack->SetEffectGrow();
this->Append(keyBack); this->Append(keyBack);
keyClearImg = new GuiImage(keyMedium); keyClearImg = new GuiImage(keyMedium);
keyClearOverImg = new GuiImage(keyMediumOver); keyClearOverImg = new GuiImage(keyMediumOver);
keyClearText = new GuiText("clear", 20, (GXColor){0, 0, 0, 0xff}); keyClearText = new GuiText("clear", 20, (GXColor){0, 0, 0, 0xff});
keyClear = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); keyClear = new GuiButton(keyClearImg, keyClearOverImg, 0, 3, (10*42+40)+eurocheck, 4*42+120, trigA, keySoundOver, keySoundClick,1);
keyClear->SetImage(keyClearImg); //keyClear = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
keyClear->SetImageOver(keyClearOverImg); //keyClear->SetImage(keyClearImg);
//keyClear->SetImageOver(keyClearOverImg);
keyClear->SetLabel(keyClearText); keyClear->SetLabel(keyClearText);
keyClear->SetSoundOver(keySoundOver); //keyClear->SetSoundOver(keySoundOver);
keyClear->SetSoundClick(keySoundClick); //keyClear->SetSoundClick(keySoundClick);
keyClear->SetTrigger(trigA); //keyClear->SetTrigger(trigA);
keyClear->SetPosition((10*42+40)+eurocheck, 4*42+120);//(10*42+40, 0*42+80); //keyClear->SetPosition((10*42+40)+eurocheck, 4*42+120);//(10*42+40, 0*42+80);
keyClear->SetEffectGrow(); //keyClear->SetEffectGrow();
this->Append(keyClear); this->Append(keyClear);
keyAltImg = new GuiImage(keyMedium); keyAltImg = new GuiImage(keyMedium);
keyAltOverImg = new GuiImage(keyMediumOver); keyAltOverImg = new GuiImage(keyMediumOver);
keyAltText = new GuiText("Alt Gr", 20, (GXColor){0, 0, 0, 0xff}); keyAltText = new GuiText("Alt Gr", 20, (GXColor){0, 0, 0, 0xff});
keyAlt = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); keyAlt = new GuiButton(keyAltImg, keyAltOverImg, 0, 3, 84+eurocheck, 4*42+120, trigA, keySoundOver, keySoundClick,1);
keyAlt->SetImage(keyAltImg); //keyAlt = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
keyAlt->SetImageOver(keyAltOverImg); //keyAlt->SetImage(keyAltImg);
//keyAlt->SetImageOver(keyAltOverImg);
keyAlt->SetLabel(keyAltText); keyAlt->SetLabel(keyAltText);
keyAlt->SetSoundOver(keySoundOver); //keyAlt->SetSoundOver(keySoundOver);
keyAlt->SetSoundClick(keySoundClick); //keyAlt->SetSoundClick(keySoundClick);
keyAlt->SetTrigger(trigA); //keyAlt->SetTrigger(trigA);
keyAlt->SetPosition(84+eurocheck, 4*42+120);//(10*42+40, 4*42+120); //keyAlt->SetPosition(84+eurocheck, 4*42+120);//(10*42+40, 4*42+120);
keyAlt->SetEffectGrow(); //keyAlt->SetEffectGrow();
if (mode > 1){this->Append(keyAlt);} if (mode > 1){this->Append(keyAlt);}
keyAlt2Img = new GuiImage(keyMedium); keyAlt2Img = new GuiImage(keyMedium);
keyAlt2OverImg = new GuiImage(keyMediumOver); keyAlt2OverImg = new GuiImage(keyMediumOver);
keyAlt2Text = new GuiText("Accent", 20, (GXColor){0, 0, 0, 0xff}); keyAlt2Text = new GuiText("Accent", 20, (GXColor){0, 0, 0, 0xff});
keyAlt2 = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); keyAlt2 = new GuiButton(keyAlt2Img, keyAlt2OverImg, 0, 3, (8*42+40)+eurocheck, 4*42+120, trigA, keySoundOver, keySoundClick,1);
keyAlt2->SetImage(keyAlt2Img); //keyAlt2 = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
keyAlt2->SetImageOver(keyAlt2OverImg); //keyAlt2->SetImage(keyAlt2Img);
//keyAlt2->SetImageOver(keyAlt2OverImg);
keyAlt2->SetLabel(keyAlt2Text); keyAlt2->SetLabel(keyAlt2Text);
keyAlt2->SetSoundOver(keySoundOver); //keyAlt2->SetSoundOver(keySoundOver);
keyAlt2->SetSoundClick(keySoundClick); //keyAlt2->SetSoundClick(keySoundClick);
keyAlt2->SetTrigger(trigA); //keyAlt2->SetTrigger(trigA);
keyAlt2->SetPosition((8*42+40)+eurocheck, 4*42+120);//(10*42+40, 4*42+120); //keyAlt2->SetPosition((8*42+40)+eurocheck, 4*42+120);//(10*42+40, 4*42+120);
keyAlt2->SetEffectGrow(); //keyAlt2->SetEffectGrow();
if (mode > 1){this->Append(keyAlt2);} if (mode > 1){this->Append(keyAlt2);}
keyCapsImg = new GuiImage(keyMedium); keyCapsImg = new GuiImage(keyMedium);
keyCapsOverImg = new GuiImage(keyMediumOver); keyCapsOverImg = new GuiImage(keyMediumOver);
keyCapsText = new GuiText("Caps", 20, (GXColor){0, 0, 0, 0xff}); keyCapsText = new GuiText("Caps", 20, (GXColor){0, 0, 0, 0xff});
keyCaps = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); keyCaps = new GuiButton(keyCapsImg, keyCapsOverImg, 0, 3, 0+eurocheck, 2*42+120, trigA, keySoundOver, keySoundClick,1);
keyCaps->SetImage(keyCapsImg); //keyCaps = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
keyCaps->SetImageOver(keyCapsOverImg); //keyCaps->SetImage(keyCapsImg);
//keyCaps->SetImageOver(keyCapsOverImg);
keyCaps->SetLabel(keyCapsText); keyCaps->SetLabel(keyCapsText);
keyCaps->SetSoundOver(keySoundOver); //keyCaps->SetSoundOver(keySoundOver);
keyCaps->SetSoundClick(keySoundClick); //keyCaps->SetSoundClick(keySoundClick);
keyCaps->SetTrigger(trigA); //keyCaps->SetTrigger(trigA);
keyCaps->SetPosition(0+eurocheck, 2*42+120);//(0, 2*42+80); //keyCaps->SetPosition(0+eurocheck, 2*42+120);//(0, 2*42+80);
keyCaps->SetEffectGrow(); //keyCaps->SetEffectGrow();
this->Append(keyCaps); this->Append(keyCaps);
keyShiftImg = new GuiImage(keyMedium); keyShiftImg = new GuiImage(keyMedium);
keyShiftOverImg = new GuiImage(keyMediumOver); keyShiftOverImg = new GuiImage(keyMediumOver);
keyShiftText = new GuiText("Shift", 20, (GXColor){0, 0, 0, 0xff}); keyShiftText = new GuiText("Shift", 20, (GXColor){0, 0, 0, 0xff});
keyShift = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); keyShift = new GuiButton(keyShiftImg, keyShiftOverImg, 0, 3, 21+eurocheck, 3*42+120, trigA, keySoundOver, keySoundClick,1);
keyShift->SetImage(keyShiftImg); //keyShift = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
keyShift->SetImageOver(keyShiftOverImg); //keyShift->SetImage(keyShiftImg);
//keyShift->SetImageOver(keyShiftOverImg);
keyShift->SetLabel(keyShiftText); keyShift->SetLabel(keyShiftText);
keyShift->SetSoundOver(keySoundOver); //keyShift->SetSoundOver(keySoundOver);
keyShift->SetSoundClick(keySoundClick); //keyShift->SetSoundClick(keySoundClick);
keyShift->SetTrigger(trigA); //keyShift->SetTrigger(trigA);
keyShift->SetPosition(21+eurocheck, 3*42+120);//(21, 3*42+80); //keyShift->SetPosition(21+eurocheck, 3*42+120);//(21, 3*42+80);
keyShift->SetEffectGrow(); //keyShift->SetEffectGrow();
this->Append(keyShift); this->Append(keyShift);
keySpaceImg = new GuiImage(keyLarge); keySpaceImg = new GuiImage(keyLarge);
keySpaceOverImg = new GuiImage(keyLargeOver); keySpaceOverImg = new GuiImage(keyLargeOver);
keySpace = new GuiButton(keyLarge->GetWidth(), keyLarge->GetHeight()); keySpace = new GuiButton(keySpaceImg, keySpaceOverImg, 2, 3, 0+eurocheck, 4*42+120, trigA, keySoundOver, keySoundClick,1);
keySpace->SetImage(keySpaceImg); //keySpace = new GuiButton(keyLarge->GetWidth(), keyLarge->GetHeight());
keySpace->SetImageOver(keySpaceOverImg); //keySpace->SetImage(keySpaceImg);
keySpace->SetSoundOver(keySoundOver); //keySpace->SetImageOver(keySpaceOverImg);
keySpace->SetSoundClick(keySoundClick); //keySpace->SetSoundOver(keySoundOver);
keySpace->SetTrigger(trigA); //keySpace->SetSoundClick(keySoundClick);
keySpace->SetPosition(0+eurocheck, 4*42+120);//(0, 4*42+80); //keySpace->SetTrigger(trigA);
keySpace->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); //keySpace->SetPosition(0+eurocheck, 4*42+120);//(0, 4*42+80);
keySpace->SetEffectGrow(); //keySpace->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
//keySpace->SetEffectGrow();
this->Append(keySpace); this->Append(keySpace);
for(int i=0; i<4; i++) for(int i=0; i<4; i++)
@ -410,15 +419,16 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
keyTxt[i][j] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff}); keyTxt[i][j] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff});
keyTxt[i][j]->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); keyTxt[i][j]->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
keyTxt[i][j]->SetPosition(0, -10); keyTxt[i][j]->SetPosition(0, -10);
keyBtn[i][j] = new GuiButton(key->GetWidth(), key->GetHeight()); keyBtn[i][j] = new GuiButton(keyImg[i][j], keyImgOver[i][j], 0, 3, (j*42+21*i+40)+eurocheck, i*42+120, trigA, keySoundOver, keySoundClick,1);
keyBtn[i][j]->SetImage(keyImg[i][j]); //keyBtn[i][j] = new GuiButton(key->GetWidth(), key->GetHeight());
keyBtn[i][j]->SetImageOver(keyImgOver[i][j]); //keyBtn[i][j]->SetImage(keyImg[i][j]);
keyBtn[i][j]->SetSoundOver(keySoundOver); //keyBtn[i][j]->SetImageOver(keyImgOver[i][j]);
keyBtn[i][j]->SetSoundClick(keySoundClick); //keyBtn[i][j]->SetSoundOver(keySoundOver);
keyBtn[i][j]->SetTrigger(trigA); //keyBtn[i][j]->SetSoundClick(keySoundClick);
//keyBtn[i][j]->SetTrigger(trigA);
keyBtn[i][j]->SetLabel(keyTxt[i][j]); keyBtn[i][j]->SetLabel(keyTxt[i][j]);
keyBtn[i][j]->SetPosition((j*42+21*i+40)+eurocheck, i*42+120);//SetPosition(j*42+21*i+40, i*42+80); //keyBtn[i][j]->SetPosition((j*42+21*i+40)+eurocheck, i*42+120);//SetPosition(j*42+21*i+40, i*42+80);
keyBtn[i][j]->SetEffectGrow(); //keyBtn[i][j]->SetEffectGrow();
this->Append(keyBtn[i][j]); this->Append(keyBtn[i][j]);
} }
} }

View File

@ -3144,7 +3144,8 @@ static int MenuDiscList()
listBtnImg_g.SetWidescreen(CFG.widescreen); listBtnImg_g.SetWidescreen(CFG.widescreen);
GuiButton gridBtn(&gridBtnImg_g,&gridBtnImg_g, 2, 3, 116, 15, &trigA, &btnSoundOver, &btnClick,1); GuiButton gridBtn(&gridBtnImg_g,&gridBtnImg_g, 2, 3, 116, 15, &trigA, &btnSoundOver, &btnClick,1);
gridBtn.SetAlpha(180); gridBtn.SetAlpha(180);
if (Settings.gameDisplay==grid)gridBtn.SetImage(&listBtnImg_g); if (Settings.gameDisplay==grid){gridBtn.SetImage(&listBtnImg_g);
gridBtn.SetImageOver(&listBtnImg_g);}
GuiImage carosselleBtnImg(&imgarrangeCarosselle); GuiImage carosselleBtnImg(&imgarrangeCarosselle);
carosselleBtnImg.SetWidescreen(CFG.widescreen); carosselleBtnImg.SetWidescreen(CFG.widescreen);
@ -3186,6 +3187,7 @@ static int MenuDiscList()
gridBtn.SetPosition(20,13); gridBtn.SetPosition(20,13);
carosselleBtn.SetPosition(60,13); carosselleBtn.SetPosition(60,13);
} }
} }
else // List-Mode else // List-Mode
{ {
@ -3584,6 +3586,7 @@ static int MenuDiscList()
w.Remove(&DownloadBtn); w.Remove(&DownloadBtn);
gridBtn.SetImage(&listBtnImg_g); gridBtn.SetImage(&listBtnImg_g);
gridBtn.SetImageOver(&listBtnImg_g);
if(CFG.widescreen) if(CFG.widescreen)
{ {
favoriteBtn.SetPosition(-80,13); favoriteBtn.SetPosition(-80,13);
@ -3619,6 +3622,7 @@ static int MenuDiscList()
gameBrowser.Reload(gameList, gameCnt); // initialize before append gameBrowser.Reload(gameList, gameCnt); // initialize before append
mainWindow->Append(&gameBrowser); mainWindow->Append(&gameBrowser);
gridBtn.SetImage(&gridBtnImg_g); gridBtn.SetImage(&gridBtnImg_g);
gridBtn.SetImageOver(&gridBtnImg_g);
if(CFG.widescreen) if(CFG.widescreen)
{ {
favoriteBtn.SetPosition(20,15); favoriteBtn.SetPosition(20,15);