From 518858a3517041ab9860b1f4c81a267cdeabb034 Mon Sep 17 00:00:00 2001 From: giantpune Date: Thu, 28 May 2009 22:23:20 +0000 Subject: [PATCH] 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. --- source/libwiigui/gui.h | 14 +++ source/libwiigui/gui_keyboard.cpp | 138 ++++++++++++++++-------------- source/menu.cpp | 6 +- 3 files changed, 93 insertions(+), 65 deletions(-) diff --git a/source/libwiigui/gui.h b/source/libwiigui/gui.h index 7f6fd4f8..165361d2 100644 --- a/source/libwiigui/gui.h +++ b/source/libwiigui/gui.h @@ -751,7 +751,21 @@ class GuiButton : public GuiElement //!\param w Width //!\param h Height 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); + //!\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); //!Destructor ~GuiButton(); diff --git a/source/libwiigui/gui_keyboard.cpp b/source/libwiigui/gui_keyboard.cpp index 1c336d79..effb8810 100644 --- a/source/libwiigui/gui_keyboard.cpp +++ b/source/libwiigui/gui_keyboard.cpp @@ -301,102 +301,111 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang) keyBackImg = new GuiImage(keyMedium); keyBackOverImg = new GuiImage(keyMediumOver); keyBackText = new GuiText("Back", 20, (GXColor){0, 0, 0, 0xff}); - keyBack = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); - keyBack->SetImage(keyBackImg); - keyBack->SetImageOver(keyBackOverImg); + //GuiButton(GuiImage* img, GuiImage* imgOver, int hor, int vert, int x, int y, GuiTrigger* trig, GuiSound* sndOver, GuiSound* sndClick, u8 grow); + + //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->SetSoundOver(keySoundOver); - keyBack->SetSoundClick(keySoundClick); - keyBack->SetTrigger(trigA); + //keyBack->SetSoundOver(keySoundOver); + //keyBack->SetSoundClick(keySoundClick); + //keyBack->SetTrigger(trigA); keyBack->SetTrigger(trigB); if (mode > 1){ keyBack->SetPosition(11*42+40+eurocheck, 0*42+120);} else{ keyBack->SetPosition(10*42+40+eurocheck, 0*42+120);}//(10*42+40, 0*42+80); - keyBack->SetEffectGrow(); + //keyBack->SetEffectGrow(); this->Append(keyBack); keyClearImg = new GuiImage(keyMedium); keyClearOverImg = new GuiImage(keyMediumOver); keyClearText = new GuiText("clear", 20, (GXColor){0, 0, 0, 0xff}); - keyClear = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); - keyClear->SetImage(keyClearImg); - keyClear->SetImageOver(keyClearOverImg); + keyClear = new GuiButton(keyClearImg, keyClearOverImg, 0, 3, (10*42+40)+eurocheck, 4*42+120, trigA, keySoundOver, keySoundClick,1); + //keyClear = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); + //keyClear->SetImage(keyClearImg); + //keyClear->SetImageOver(keyClearOverImg); keyClear->SetLabel(keyClearText); - keyClear->SetSoundOver(keySoundOver); - keyClear->SetSoundClick(keySoundClick); - keyClear->SetTrigger(trigA); - keyClear->SetPosition((10*42+40)+eurocheck, 4*42+120);//(10*42+40, 0*42+80); - keyClear->SetEffectGrow(); + //keyClear->SetSoundOver(keySoundOver); + //keyClear->SetSoundClick(keySoundClick); + //keyClear->SetTrigger(trigA); + //keyClear->SetPosition((10*42+40)+eurocheck, 4*42+120);//(10*42+40, 0*42+80); + //keyClear->SetEffectGrow(); this->Append(keyClear); keyAltImg = new GuiImage(keyMedium); keyAltOverImg = new GuiImage(keyMediumOver); keyAltText = new GuiText("Alt Gr", 20, (GXColor){0, 0, 0, 0xff}); - keyAlt = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); - keyAlt->SetImage(keyAltImg); - keyAlt->SetImageOver(keyAltOverImg); + keyAlt = new GuiButton(keyAltImg, keyAltOverImg, 0, 3, 84+eurocheck, 4*42+120, trigA, keySoundOver, keySoundClick,1); + //keyAlt = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); + //keyAlt->SetImage(keyAltImg); + //keyAlt->SetImageOver(keyAltOverImg); keyAlt->SetLabel(keyAltText); - keyAlt->SetSoundOver(keySoundOver); - keyAlt->SetSoundClick(keySoundClick); - keyAlt->SetTrigger(trigA); - keyAlt->SetPosition(84+eurocheck, 4*42+120);//(10*42+40, 4*42+120); - keyAlt->SetEffectGrow(); + //keyAlt->SetSoundOver(keySoundOver); + //keyAlt->SetSoundClick(keySoundClick); + //keyAlt->SetTrigger(trigA); + //keyAlt->SetPosition(84+eurocheck, 4*42+120);//(10*42+40, 4*42+120); + //keyAlt->SetEffectGrow(); if (mode > 1){this->Append(keyAlt);} keyAlt2Img = new GuiImage(keyMedium); keyAlt2OverImg = new GuiImage(keyMediumOver); keyAlt2Text = new GuiText("Accent", 20, (GXColor){0, 0, 0, 0xff}); - keyAlt2 = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); - keyAlt2->SetImage(keyAlt2Img); - keyAlt2->SetImageOver(keyAlt2OverImg); + keyAlt2 = new GuiButton(keyAlt2Img, keyAlt2OverImg, 0, 3, (8*42+40)+eurocheck, 4*42+120, trigA, keySoundOver, keySoundClick,1); + //keyAlt2 = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); + //keyAlt2->SetImage(keyAlt2Img); + //keyAlt2->SetImageOver(keyAlt2OverImg); keyAlt2->SetLabel(keyAlt2Text); - keyAlt2->SetSoundOver(keySoundOver); - keyAlt2->SetSoundClick(keySoundClick); - keyAlt2->SetTrigger(trigA); - keyAlt2->SetPosition((8*42+40)+eurocheck, 4*42+120);//(10*42+40, 4*42+120); - keyAlt2->SetEffectGrow(); + //keyAlt2->SetSoundOver(keySoundOver); + //keyAlt2->SetSoundClick(keySoundClick); + //keyAlt2->SetTrigger(trigA); + //keyAlt2->SetPosition((8*42+40)+eurocheck, 4*42+120);//(10*42+40, 4*42+120); + //keyAlt2->SetEffectGrow(); if (mode > 1){this->Append(keyAlt2);} keyCapsImg = new GuiImage(keyMedium); keyCapsOverImg = new GuiImage(keyMediumOver); keyCapsText = new GuiText("Caps", 20, (GXColor){0, 0, 0, 0xff}); - keyCaps = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); - keyCaps->SetImage(keyCapsImg); - keyCaps->SetImageOver(keyCapsOverImg); + keyCaps = new GuiButton(keyCapsImg, keyCapsOverImg, 0, 3, 0+eurocheck, 2*42+120, trigA, keySoundOver, keySoundClick,1); + //keyCaps = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); + //keyCaps->SetImage(keyCapsImg); + //keyCaps->SetImageOver(keyCapsOverImg); keyCaps->SetLabel(keyCapsText); - keyCaps->SetSoundOver(keySoundOver); - keyCaps->SetSoundClick(keySoundClick); - keyCaps->SetTrigger(trigA); - keyCaps->SetPosition(0+eurocheck, 2*42+120);//(0, 2*42+80); - keyCaps->SetEffectGrow(); + //keyCaps->SetSoundOver(keySoundOver); + //keyCaps->SetSoundClick(keySoundClick); + //keyCaps->SetTrigger(trigA); + //keyCaps->SetPosition(0+eurocheck, 2*42+120);//(0, 2*42+80); + //keyCaps->SetEffectGrow(); this->Append(keyCaps); keyShiftImg = new GuiImage(keyMedium); keyShiftOverImg = new GuiImage(keyMediumOver); keyShiftText = new GuiText("Shift", 20, (GXColor){0, 0, 0, 0xff}); - keyShift = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); - keyShift->SetImage(keyShiftImg); - keyShift->SetImageOver(keyShiftOverImg); + keyShift = new GuiButton(keyShiftImg, keyShiftOverImg, 0, 3, 21+eurocheck, 3*42+120, trigA, keySoundOver, keySoundClick,1); + //keyShift = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight()); + //keyShift->SetImage(keyShiftImg); + //keyShift->SetImageOver(keyShiftOverImg); keyShift->SetLabel(keyShiftText); - keyShift->SetSoundOver(keySoundOver); - keyShift->SetSoundClick(keySoundClick); - keyShift->SetTrigger(trigA); - keyShift->SetPosition(21+eurocheck, 3*42+120);//(21, 3*42+80); - keyShift->SetEffectGrow(); + //keyShift->SetSoundOver(keySoundOver); + //keyShift->SetSoundClick(keySoundClick); + //keyShift->SetTrigger(trigA); + //keyShift->SetPosition(21+eurocheck, 3*42+120);//(21, 3*42+80); + //keyShift->SetEffectGrow(); this->Append(keyShift); keySpaceImg = new GuiImage(keyLarge); keySpaceOverImg = new GuiImage(keyLargeOver); - keySpace = new GuiButton(keyLarge->GetWidth(), keyLarge->GetHeight()); - keySpace->SetImage(keySpaceImg); - keySpace->SetImageOver(keySpaceOverImg); - keySpace->SetSoundOver(keySoundOver); - keySpace->SetSoundClick(keySoundClick); - keySpace->SetTrigger(trigA); - keySpace->SetPosition(0+eurocheck, 4*42+120);//(0, 4*42+80); - keySpace->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); - keySpace->SetEffectGrow(); + keySpace = new GuiButton(keySpaceImg, keySpaceOverImg, 2, 3, 0+eurocheck, 4*42+120, trigA, keySoundOver, keySoundClick,1); + //keySpace = new GuiButton(keyLarge->GetWidth(), keyLarge->GetHeight()); + //keySpace->SetImage(keySpaceImg); + //keySpace->SetImageOver(keySpaceOverImg); + //keySpace->SetSoundOver(keySoundOver); + //keySpace->SetSoundClick(keySoundClick); + //keySpace->SetTrigger(trigA); + //keySpace->SetPosition(0+eurocheck, 4*42+120);//(0, 4*42+80); + //keySpace->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); + //keySpace->SetEffectGrow(); this->Append(keySpace); 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]->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); keyTxt[i][j]->SetPosition(0, -10); - keyBtn[i][j] = new GuiButton(key->GetWidth(), key->GetHeight()); - keyBtn[i][j]->SetImage(keyImg[i][j]); - keyBtn[i][j]->SetImageOver(keyImgOver[i][j]); - keyBtn[i][j]->SetSoundOver(keySoundOver); - keyBtn[i][j]->SetSoundClick(keySoundClick); - keyBtn[i][j]->SetTrigger(trigA); + 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] = new GuiButton(key->GetWidth(), key->GetHeight()); + //keyBtn[i][j]->SetImage(keyImg[i][j]); + //keyBtn[i][j]->SetImageOver(keyImgOver[i][j]); + //keyBtn[i][j]->SetSoundOver(keySoundOver); + //keyBtn[i][j]->SetSoundClick(keySoundClick); + //keyBtn[i][j]->SetTrigger(trigA); 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]->SetEffectGrow(); + //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(); this->Append(keyBtn[i][j]); } } diff --git a/source/menu.cpp b/source/menu.cpp index 32758bc5..5f9502e5 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -3144,7 +3144,8 @@ static int MenuDiscList() listBtnImg_g.SetWidescreen(CFG.widescreen); GuiButton gridBtn(&gridBtnImg_g,&gridBtnImg_g, 2, 3, 116, 15, &trigA, &btnSoundOver, &btnClick,1); 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); carosselleBtnImg.SetWidescreen(CFG.widescreen); @@ -3186,6 +3187,7 @@ static int MenuDiscList() gridBtn.SetPosition(20,13); carosselleBtn.SetPosition(60,13); } + } else // List-Mode { @@ -3584,6 +3586,7 @@ static int MenuDiscList() w.Remove(&DownloadBtn); gridBtn.SetImage(&listBtnImg_g); + gridBtn.SetImageOver(&listBtnImg_g); if(CFG.widescreen) { favoriteBtn.SetPosition(-80,13); @@ -3619,6 +3622,7 @@ static int MenuDiscList() gameBrowser.Reload(gameList, gameCnt); // initialize before append mainWindow->Append(&gameBrowser); gridBtn.SetImage(&gridBtnImg_g); + gridBtn.SetImageOver(&gridBtnImg_g); if(CFG.widescreen) { favoriteBtn.SetPosition(20,15);