Align keyboard with background better

This commit is contained in:
giantpune 2009-05-05 09:06:11 +00:00
parent 20cb3c9e93
commit 8edbd2e1b1
2 changed files with 21 additions and 18 deletions

View File

@ -87,12 +87,12 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
keyTextbox = new GuiImageData(keyboard_textbox_png); keyTextbox = new GuiImageData(keyboard_textbox_png);
keyTextboxImg = new GuiImage(keyTextbox); keyTextboxImg = new GuiImage(keyTextbox);
keyTextboxImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); keyTextboxImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
keyTextboxImg->SetPosition(0, 0); keyTextboxImg->SetPosition(0, 40);//(0,0);
this->Append(keyTextboxImg); this->Append(keyTextboxImg);
kbText = new GuiText(kbtextstr, 20, (GXColor){0, 0, 0, 0xff}); kbText = new GuiText(kbtextstr, 20, (GXColor){0, 0, 0, 0xff});
kbText->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); kbText->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
kbText->SetPosition(0, 13); kbText->SetPosition(0, 53);//(0, 13);
this->Append(kbText); this->Append(kbText);
key = new GuiImageData(keyboard_key_png); key = new GuiImageData(keyboard_key_png);
@ -120,7 +120,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
keyBack->SetSoundClick(keySoundClick); keyBack->SetSoundClick(keySoundClick);
keyBack->SetTrigger(trigA); keyBack->SetTrigger(trigA);
keyBack->SetTrigger(trigB); keyBack->SetTrigger(trigB);
keyBack->SetPosition(10*42+40, 0*42+80); keyBack->SetPosition(10*42+40, 0*42+120);//(10*42+40, 0*42+80);
keyBack->SetEffectGrow(); keyBack->SetEffectGrow();
this->Append(keyBack); this->Append(keyBack);
@ -134,7 +134,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
keyCaps->SetSoundOver(keySoundOver); keyCaps->SetSoundOver(keySoundOver);
keyCaps->SetSoundClick(keySoundClick); keyCaps->SetSoundClick(keySoundClick);
keyCaps->SetTrigger(trigA); keyCaps->SetTrigger(trigA);
keyCaps->SetPosition(0, 2*42+80); keyCaps->SetPosition(0, 2*42+120);//(0, 2*42+80);
keyCaps->SetEffectGrow(); keyCaps->SetEffectGrow();
this->Append(keyCaps); this->Append(keyCaps);
@ -148,7 +148,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
keyShift->SetSoundOver(keySoundOver); keyShift->SetSoundOver(keySoundOver);
keyShift->SetSoundClick(keySoundClick); keyShift->SetSoundClick(keySoundClick);
keyShift->SetTrigger(trigA); keyShift->SetTrigger(trigA);
keyShift->SetPosition(21, 3*42+80); keyShift->SetPosition(21, 3*42+120);//(21, 3*42+80);
keyShift->SetEffectGrow(); keyShift->SetEffectGrow();
this->Append(keyShift); this->Append(keyShift);
@ -160,7 +160,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
keySpace->SetSoundOver(keySoundOver); keySpace->SetSoundOver(keySoundOver);
keySpace->SetSoundClick(keySoundClick); keySpace->SetSoundClick(keySoundClick);
keySpace->SetTrigger(trigA); keySpace->SetTrigger(trigA);
keySpace->SetPosition(0, 4*42+80); keySpace->SetPosition(0, 4*42+120);//(0, 4*42+80);
keySpace->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); keySpace->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
keySpace->SetEffectGrow(); keySpace->SetEffectGrow();
this->Append(keySpace); this->Append(keySpace);
@ -183,7 +183,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
keyBtn[i][j]->SetSoundClick(keySoundClick); keyBtn[i][j]->SetSoundClick(keySoundClick);
keyBtn[i][j]->SetTrigger(trigA); 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, i*42+80); keyBtn[i][j]->SetPosition(j*42+21*i+40, 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

@ -895,7 +895,7 @@ int GameWindowPrompt()
btnLeft.SetPosition(20, 0); btnLeft.SetPosition(20, 0);
btnLeft.SetImage(&btnLeftImg); btnLeft.SetImage(&btnLeftImg);
btnLeft.SetSoundOver(&btnSoundOver); btnLeft.SetSoundOver(&btnSoundOver);
btnLeft.SetSoundClick(&btnClick); //btnLeft.SetSoundClick(&btnClick);
btnLeft.SetTrigger(&trigA); btnLeft.SetTrigger(&trigA);
btnLeft.SetTrigger(&trigL); btnLeft.SetTrigger(&trigL);
btnLeft.SetTrigger(&trigMinus); btnLeft.SetTrigger(&trigMinus);
@ -907,7 +907,7 @@ int GameWindowPrompt()
btnRight.SetPosition(-20, 0); btnRight.SetPosition(-20, 0);
btnRight.SetImage(&btnRightImg); btnRight.SetImage(&btnRightImg);
btnRight.SetSoundOver(&btnSoundOver); btnRight.SetSoundOver(&btnSoundOver);
btnRight.SetSoundClick(&btnClick); //btnRight.SetSoundClick(&btnClick);
btnRight.SetTrigger(&trigA); btnRight.SetTrigger(&trigA);
btnRight.SetTrigger(&trigR); btnRight.SetTrigger(&trigR);
btnRight.SetTrigger(&trigPlus); btnRight.SetTrigger(&trigPlus);
@ -1047,6 +1047,7 @@ int GameWindowPrompt()
else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == no)){//next game else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == no)){//next game
promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50); promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
changed = 1; changed = 1;
btnClick.Play();
gameSelected = (gameSelected + 1) % gameCnt; gameSelected = (gameSelected + 1) % gameCnt;
btnRight.ResetState(); btnRight.ResetState();
break; break;
@ -1055,27 +1056,29 @@ int GameWindowPrompt()
else if((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == no)){//previous game else if((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == no)){//previous game
promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50); promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
changed = 2; changed = 2;
btnClick.Play();
gameSelected = (gameSelected - 1 + gameCnt) % gameCnt; gameSelected = (gameSelected - 1 + gameCnt) % gameCnt;
btnLeft.ResetState(); btnLeft.ResetState();
break; break;
} }
else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == yes)){//next game else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == yes)){//previous game
promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50); promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50);
changed = 1; changed = 2;
btnClick.Play();
gameSelected = (gameSelected - 1 + gameCnt) % gameCnt; gameSelected = (gameSelected - 1 + gameCnt) % gameCnt;
btnRight.ResetState(); btnRight.ResetState();
break; break;
} }
else if((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == yes)){//previous game else if((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == yes)){//netx game
promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 50); promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_OUT, 50);
changed = 2; changed = 1;
btnClick.Play();
gameSelected = (gameSelected + 1) % gameCnt; gameSelected = (gameSelected + 1) % gameCnt;
btnLeft.ResetState(); btnLeft.ResetState();
break; break;
} }
} }
@ -1858,7 +1861,7 @@ static int OnScreenKeyboard(char * var, u16 maxlen)
GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
okBtn.SetPosition(25, -25); okBtn.SetPosition(5, 15);//(25, -25);
okBtn.SetLabel(&okBtnTxt); okBtn.SetLabel(&okBtnTxt);
okBtn.SetImage(&okBtnImg); okBtn.SetImage(&okBtnImg);
@ -1871,7 +1874,7 @@ static int OnScreenKeyboard(char * var, u16 maxlen)
GuiImage cancelBtnImg(&btnOutline); GuiImage cancelBtnImg(&btnOutline);
GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
cancelBtn.SetPosition(-25, -25); cancelBtn.SetPosition(-5, 15);//(-25, -25);
cancelBtn.SetLabel(&cancelBtnTxt); cancelBtn.SetLabel(&cancelBtnTxt);
cancelBtn.SetImage(&cancelBtnImg); cancelBtn.SetImage(&cancelBtnImg);
cancelBtn.SetSoundOver(&btnSoundOver); cancelBtn.SetSoundOver(&btnSoundOver);