本文整理汇总了C++中GuiTrigger类的典型用法代码示例。如果您正苦于以下问题:C++ GuiTrigger类的具体用法?C++ GuiTrigger怎么用?C++ GuiTrigger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GuiTrigger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnScreenKeyboard
/****************************************************************************
* OnScreenKeyboard
*
* Opens an on-screen keyboard window, with the data entered being stored
* into the specified variable.
***************************************************************************/
static void OnScreenKeyboard(char * var, u16 maxlen) {
int save = -1;
GuiKeyboard keyboard(var, maxlen);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiImageData btnOutline(xenon_button_png);
GuiImageData btnOutlineOver(xenon_button_over_png);
GuiTrigger trigA;
// trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
trigA.SetSimpleTrigger(-1, 0, PAD_BUTTON_A);
GuiText okBtnTxt("OK", 22, (GXColor) {
0, 0, 0, 255
});
GuiImage okBtnImg(&btnOutline);
GuiImage okBtnImgOver(&btnOutlineOver);
GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
okBtn.SetPosition(25, -25);
okBtn.SetLabel(&okBtnTxt);
okBtn.SetImage(&okBtnImg);
okBtn.SetImageOver(&okBtnImgOver);
okBtn.SetSoundOver(&btnSoundOver);
okBtn.SetTrigger(&trigA);
okBtn.SetEffectGrow();
GuiText cancelBtnTxt("Cancel", 22, (GXColor) {
0, 0, 0, 255
});
GuiImage cancelBtnImg(&btnOutline);
GuiImage cancelBtnImgOver(&btnOutlineOver);
GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
cancelBtn.SetPosition(-25, -25);
cancelBtn.SetLabel(&cancelBtnTxt);
cancelBtn.SetImage(&cancelBtnImg);
cancelBtn.SetImageOver(&cancelBtnImgOver);
cancelBtn.SetSoundOver(&btnSoundOver);
cancelBtn.SetTrigger(&trigA);
cancelBtn.SetEffectGrow();
keyboard.Append(&okBtn);
keyboard.Append(&cancelBtn);
HaltGui();
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&keyboard);
mainWindow->ChangeFocus(&keyboard);
ResumeGui();
while (save == -1) {
UGUI();
usleep(THREAD_SLEEP);
if (okBtn.GetState() == STATE_CLICKED)
save = 1;
else if (cancelBtn.GetState() == STATE_CLICKED)
save = 0;
}
if (save) {
snprintf(var, maxlen, "%s", keyboard.kbtextstr);
}
HaltGui();
mainWindow->Remove(&keyboard);
mainWindow->SetState(STATE_DEFAULT);
ResumeGui();
}
示例2: revtext
/****************************************************************************
* WindowPrompt
*
* Displays a prompt window to user, with information, an error message, or
* presenting a user with a choice
***************************************************************************/
void
revtext(const char *msg)
{
bool stop = false;
GuiWindow promptWindow(520,360);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiImageData btnOutline(Theme.button_small);
GuiImageData btnOutlineOver(Theme.button_small_focus);
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiImageData dialogBox(Theme.dialog_background);
GuiImage dialogBoxImg(&dialogBox);
TextLine revtext;
revtext.text(msg, 18, 400);
int i = 0;
int y = 90;
int place = 25;
int number = 7;
GuiText upTxt("c", 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
upTxt.SetFont(symbol_ttf, symbol_ttf_size);
upTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
upTxt.SetPosition(0, y -20);
GuiText downTxt("d", 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
downTxt.SetFont(symbol_ttf, symbol_ttf_size);
downTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
downTxt.SetPosition(0, y + (place * (number-1)) + 15);
GuiText * Entrie[number];
for(i=0; i < number && i < (signed)revtext.line.size(); i++)
{
Entrie[i] = new GuiText(revtext.line[i].c_str(), 20, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
Entrie[i]->SetPosition(50, y);
y += place;
}
GuiText titleTxt(tr("Info"), 26, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,40);
GuiText backTxt(tr("OK"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
GuiImage backImg(&btnOutline);
GuiImage backImgOver(&btnOutlineOver);
GuiButton back(btnOutline.GetWidth(), btnOutline.GetHeight());
back.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
back.SetPosition(0, -25);
back.SetLabel(&backTxt);
back.SetImage(&backImg);
back.SetImageOver(&backImgOver);
back.SetTrigger(&trigA);
back.SetState(STATE_SELECTED);
promptWindow.Append(&dialogBoxImg);
promptWindow.Append(&titleTxt);
for(int x=0; x < i; x++)
promptWindow.Append(Entrie[x]);
if((signed)revtext.line.size() >= number)
{
promptWindow.Append(&upTxt);
promptWindow.Append(&downTxt);
}
promptWindow.Append(&back);
HaltGui();
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&promptWindow);
mainWindow->ChangeFocus(&promptWindow);
ResumeGui();
while(!stop)
{
usleep(100);
if(WPAD_ButtonsDown(0) & (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP) || PAD_ButtonsDown(0) & PAD_BUTTON_UP)
{
int z = revtext.text_up();
for(int x=0; x < i; x++)
Entrie[x]->SetText(revtext.line[x + z].c_str());
//.........这里部分代码省略.........
示例3: MenuSettingsTheme
int MenuSettingsTheme()
{
int menu = MENU_NONE;
int ret = -1;
int activated = -1;
int i = 0;
int focus = 0;
OptionList options;
sprintf(options.name[i], tr("STANDARD"));
if(stricmp(Options.temp_theme.c_str(), tr("STANDARD")) == 0)
{
sprintf (options.value[i], tr("activated"));
activated = i;
}
else
sprintf (options.value[i], " ");
i++;
DIR *dirHandle;
struct dirent * dirEntry;
dirHandle = opendir(check_path(Settings.device_dat + ":/config/HBF/Themes").c_str());
if (dirHandle) {
while (0 != (dirEntry = readdir(dirHandle)))
{
if(stricmp(dirEntry->d_name, ".") != 0 && stricmp(dirEntry->d_name, "..") != 0)
{
sprintf(options.name[i], dirEntry->d_name);
if(stricmp(Options.temp_theme.c_str(), dirEntry->d_name) == 0)
{
sprintf (options.value[i], tr("activated"));
activated = i;
}
else
sprintf (options.value[i], " ");
i++;
}
}
closedir(dirHandle);
}
options.length = i;
GuiImageData bgImgData(Theme.background);
GuiImageData btnOutline(Theme.button_small);
GuiImageData btnOutlineOver(Theme.button_small_focus);
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiImage bgImg(&bgImgData);
GuiText titleTxt(tr("Themes"), 28, (GXColor){Theme.title_1, Theme.title_2, Theme.title_3, 255});
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
titleTxt.SetPosition(50,50);
GuiText downloadBtnTxt(tr("Download"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
GuiImage downloadBtnImg(&btnOutline);
GuiImage downloadBtnImgOver(&btnOutlineOver);
GuiButton downloadBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
downloadBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
downloadBtn.SetPosition(-100, 38);
downloadBtn.SetLabel(&downloadBtnTxt);
downloadBtn.SetImage(&downloadBtnImg);
downloadBtn.SetImageOver(&downloadBtnImgOver);
downloadBtn.SetTrigger(&trigA);
downloadBtn.SetEffectGrow();
GuiText okBtnTxt(tr("OK"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
GuiImage okBtnImg(&btnOutline);
GuiImage okBtnImgOver(&btnOutlineOver);
GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
okBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
okBtn.SetPosition(100, -35);
okBtn.SetLabel(&okBtnTxt);
okBtn.SetImage(&okBtnImg);
okBtn.SetImageOver(&okBtnImgOver);
okBtn.SetTrigger(&trigA);
okBtn.SetEffectGrow();
GuiText backBtnTxt(tr("Stop"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
GuiImage backBtnImg(&btnOutline);
GuiImage backBtnImgOver(&btnOutlineOver);
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
backBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
backBtn.SetPosition(-100, -35);
backBtn.SetLabel(&backBtnTxt);
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
GuiOptionBrowser optionBrowser(552, 248, &options);
optionBrowser.SetPosition(0, 108);
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
//.........这里部分代码省略.........
示例4: eraseCategory
/****************************************************************************
* Kategorie entfernen
***************************************************************************/
string eraseCategory()
{
bool stop = true;
int kategorieInt = 1;
string kategoriename = AvailableCategory.categories[kategorieInt];
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiTrigger trigB;
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
GuiWindow promptWindow(520,360);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiImageData dialogBox(Theme.dialog_background);
GuiImage dialogBoxImg(&dialogBox);
GuiImageData btnOutline(Theme.button_small);
GuiImageData btnOutlineOver(Theme.button_small_focus);
GuiText zeile1Txt(tr("Remove Category"), 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
zeile1Txt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
zeile1Txt.SetPosition(0, -100);
GuiText zeile2Txt(AvailableCategory.categories[1].c_str(), 24, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
zeile2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
zeile2Txt.SetPosition(0, -10);
GuiText zeile4Txt(tr("Select Category (-/+)"), 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
zeile4Txt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
zeile4Txt.SetPosition(0, 60);
GuiText okTxt(tr("Yes"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
GuiImage okImg(&btnOutline);
GuiImage okImgOver(&btnOutlineOver);
GuiButton ok(btnOutline.GetWidth(), btnOutline.GetHeight());
ok.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
ok.SetPosition(-120, -25);
ok.SetLabel(&okTxt);
ok.SetImage(&okImg);
ok.SetImageOver(&okImgOver);
ok.SetTrigger(&trigA);
GuiText backTxt(tr("No"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
GuiImage backImg(&btnOutline);
GuiImage backImgOver(&btnOutlineOver);
GuiButton back(btnOutline.GetWidth(), btnOutline.GetHeight());
back.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
back.SetPosition(120, -25);
back.SetLabel(&backTxt);
back.SetImage(&backImg);
back.SetImageOver(&backImgOver);
back.SetTrigger(&trigA);
back.SetTrigger(&trigB);
back.SetState(STATE_SELECTED);
promptWindow.Append(&dialogBoxImg);
promptWindow.Append(&zeile1Txt);
promptWindow.Append(&zeile2Txt);
promptWindow.Append(&zeile4Txt);
promptWindow.Append(&ok);
promptWindow.Append(&back);
HaltGui();
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&promptWindow);
mainWindow->ChangeFocus(&promptWindow);
ResumeGui();
while(stop)
{
usleep(100);
if(WPAD_ButtonsDown(0) & (WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS) || PAD_ButtonsDown(0) & PAD_TRIGGER_R
|| WUPC_ButtonsDown(0) & WPAD_CLASSIC_BUTTON_PLUS)
{
kategorieInt++;
if ( kategorieInt >= (signed)AvailableCategory.categories.size() )
kategorieInt = 1;
kategoriename = AvailableCategory.categories[kategorieInt];
zeile2Txt.SetText(kategoriename.c_str());
HaltResumeGui();
}
if(WPAD_ButtonsDown(0) & (WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS) || PAD_ButtonsDown(0) & PAD_TRIGGER_L
|| WUPC_ButtonsDown(0) & WPAD_CLASSIC_BUTTON_MINUS)
{
kategorieInt--;
if ( kategorieInt < 1 )
kategorieInt = AvailableCategory.categories.size() -1;
kategoriename = AvailableCategory.categories[kategorieInt];
zeile2Txt.SetText(kategoriename.c_str());
HaltResumeGui();
}
//.........这里部分代码省略.........
示例5: Wad_Uninstall
s32 Wad_Uninstall(FILE *fp)
{
//////start the gui shit
GuiWindow promptWindow(472,320);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100];
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path);
GuiImageData dialogBox(imgPath, dialogue_box_png);
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiImage dialogBoxImg(&dialogBox);
if (Settings.wsprompt == yes){
dialogBoxImg.SetWidescreen(CFG.widescreen);}
GuiText btn1Txt(tr("OK"), 22, THEME.prompttext);
GuiImage btn1Img(&btnOutline);
if (Settings.wsprompt == yes){
btn1Txt.SetWidescreen(CFG.widescreen);
btn1Img.SetWidescreen(CFG.widescreen);}
GuiButton btn1(&btn1Img,&btn1Img, 2, 4, 0, -55, &trigA, &btnSoundOver, btnClick2,1);
btn1.SetLabel(&btn1Txt);
btn1.SetState(STATE_SELECTED);
char title[50];
sprintf(title, "%s", tr("Uninstalling wad"));
GuiText titleTxt(title, 26, THEME.prompttext);
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,40);
GuiText msg1Txt(NULL, 18, THEME.prompttext);
msg1Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
msg1Txt.SetPosition(50,75);
GuiText msg2Txt(NULL, 18, THEME.prompttext);
msg2Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
msg2Txt.SetPosition(50, 98);
GuiText msg3Txt(NULL, 18, THEME.prompttext);
msg3Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
msg3Txt.SetPosition(50, 121);
GuiText msg4Txt(NULL, 18, THEME.prompttext);
msg4Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
msg4Txt.SetPosition(50, 144);
GuiText msg5Txt(NULL, 18, THEME.prompttext);
msg5Txt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
msg5Txt.SetPosition(50, 167);
if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust for widescreen
msg1Txt.SetPosition(70,95);
msg2Txt.SetPosition(70, 118);
msg3Txt.SetPosition(70, 141);
msg4Txt.SetPosition(70, 164);
msg5Txt.SetPosition(70, 187);
}
promptWindow.Append(&dialogBoxImg);
promptWindow.Append(&titleTxt);
promptWindow.Append(&msg5Txt);
promptWindow.Append(&msg4Txt);
promptWindow.Append(&msg3Txt);
promptWindow.Append(&msg1Txt);
promptWindow.Append(&msg2Txt);
HaltGui();
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&promptWindow);
mainWindow->ChangeFocus(&promptWindow);
ResumeGui();
//sleep(3);
///start the wad shit
wadHeader *header = NULL;
void *pvoid = NULL;
tikview *viewData = NULL;
u64 tid;
u32 viewCnt;
s32 ret;
msg1Txt.SetText(tr(">> Reading WAD data..."));
// WAD header
ret = __Wad_ReadAlloc(fp, &pvoid, 0, sizeof(wadHeader));
if (ret < 0) {
char errTxt[50];
//.........这里部分代码省略.........
示例6: MetaEdit
/****************************************************************************
* MetaEdit
*
* meta bearbeiten
***************************************************************************/
bool
MetaEdit(string dir)
{
int choice = -1;
bool changed = false;
dir += "meta.xml";
string line, quelltext;
ifstream in(dir.c_str());
while(getline(in, line))
quelltext += line + "\n";
GuiWindow promptWindow(520,360);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiImageData btnOutline(Theme.button_small);
GuiImageData btnOutlineOver(Theme.button_small_focus);
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiImageData dialogBox(Theme.dialog_background);
GuiImage dialogBoxImg(&dialogBox);
TextLine meta;
meta.text(quelltext, 18, 440);
int i = 0;
int y = 90;
int place = 25;
int number = 7;
int startline = 0;
GuiText upTxt("c", 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
upTxt.SetFont(symbol_ttf, symbol_ttf_size);
upTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
upTxt.SetPosition(0, y -20);
GuiText downTxt("d", 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
downTxt.SetFont(symbol_ttf, symbol_ttf_size);
downTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
downTxt.SetPosition(0, y + (place * (number-1)) + 15);
GuiButton * Entrie[number];
GuiText * EntrieTxt[number];
for(i=0; i < number && i < (signed)meta.line.size(); i++)
{
EntrieTxt[i] = new GuiText(meta.line[i].c_str(), 18, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
EntrieTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
Entrie[i] = new GuiButton(440, 18);
Entrie[i]->SetLabel(EntrieTxt[i]);
Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
Entrie[i]->SetPosition(40, y);
Entrie[i]->SetTrigger(&trigA);
y += place;
}
GuiText titleTxt("meta.xml", 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,40);
GuiText backTxt(tr("OK"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
GuiImage backImg(&btnOutline);
GuiImage backImgOver(&btnOutlineOver);
GuiButton back(btnOutline.GetWidth(), btnOutline.GetHeight());
back.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
back.SetPosition(0, -25);
back.SetLabel(&backTxt);
back.SetImage(&backImg);
back.SetImageOver(&backImgOver);
back.SetTrigger(&trigA);
back.SetState(STATE_SELECTED);
promptWindow.Append(&dialogBoxImg);
promptWindow.Append(&titleTxt);
for(int x=0; x < i; x++)
promptWindow.Append(Entrie[x]);
if((signed)meta.line.size() >= number)
{
promptWindow.Append(&upTxt);
promptWindow.Append(&downTxt);
}
promptWindow.Append(&back);
HaltGui();
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&promptWindow);
mainWindow->ChangeFocus(&promptWindow);
//.........这里部分代码省略.........
示例7: checkUpdatePrompt
string checkUpdatePrompt()
{
GuiWindow promptWindow(520,360);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiImageData dialogBox(Theme.dialog_background);
GuiImage dialogBoxImg(&dialogBox);
GuiImageData btnOutline(Theme.button_small);
GuiImage btn1Img(&btnOutline);
GuiImageData btnOutlineOver(Theme.button_small_focus);
GuiImage btn1ImgOver(&btnOutlineOver);
// ok button
GuiText backTxt(tr("OK"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
GuiImage backImg(&btnOutline);
GuiImage backImgOver(&btnOutlineOver);
GuiButton back(btnOutline.GetWidth(), btnOutline.GetHeight());
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
back.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
back.SetPosition(0, -25);
back.SetLabel(&backTxt);
back.SetImage(&backImg);
back.SetImageOver(&backImgOver);
back.SetTrigger(&trigA);
back.SetState(STATE_SELECTED);
GuiText titleTxt(tr("Update"), 26, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0, 40);
GuiText msgTxt(tr("Initialise network..."), 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.Append(&dialogBoxImg);
promptWindow.Append(&titleTxt);
promptWindow.Append(&msgTxt);
HaltGui();
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&promptWindow);
mainWindow->ChangeFocus(&promptWindow);
ResumeGui();
string rev = "NULL";
// berprfen, ob netzwerk initialisiert wird
Initialize_Network();
if(!IsNetworkInit())
{
msgTxt.SetText(tr("No network connection"));
bool stop = false;
promptWindow.Append(&back);
while(!stop)
{
usleep(100);
if(back.GetState() == STATE_CLICKED)
stop = true;
}
promptWindow.Remove(&back);
}
else
{
string revs = CheckNewVersions();
if(revs == "error")
{
msgTxt.SetText(tr("Error while reading file"));
bool stop = false;
promptWindow.Append(&back);
while(!stop)
{
usleep(100);
if(back.GetState() == STATE_CLICKED)
stop = true;
}
promptWindow.Remove(&back);
}
else
rev = choiceRev(revs);
}
HaltGui();
mainWindow->Remove(&promptWindow);
mainWindow->SetState(STATE_DEFAULT);
ResumeGui();
return rev;
}
示例8: TitleBrowser
//.........这里部分代码省略.........
options3.SetName(i, "%s",text);
options3.SetValue(i, "%s",name[i]);
//options3.SetValue(i, " (%08x) %s",titles[i],name[i]);//use this line to show the number to call to launch the channel
//move on to the next title
i++;
}
if (i == num_titles+num_sys_titles) {
options3.SetName(i, " ");
options3.SetValue(i, "%s",tr("Wii Settings"));
}
//we have all the titles we need so close the database and stop poking around in the wii
fclose(f);
//get rid of our footprints in there
Uninstall_FromTitle(TITLE_ID(1, 0));
ISFS_Deinitialize();
bool exit = false;
if (IsNetworkInit())
ResumeNetworkWait();
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
if(!btnClick2) btnClick2=new GuiSound(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
// GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, Settings.sfxvolume);
char imgPath[100];
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", CFG.theme_path);
GuiImageData settingsbg(imgPath, settings_background_png);
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiTrigger trigHome;
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
GuiTrigger trigB;
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
GuiText titleTxt(tr("Title Launcher"), 28, (GXColor) {0, 0, 0, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(12,40);
titleTxt.SetMaxWidth(356, GuiText::SCROLL);
GuiImage settingsbackground(&settingsbg);
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
settingsbackgroundbtn.SetPosition(0, 0);
settingsbackgroundbtn.SetImage(&settingsbackground);
GuiText cancelBtnTxt(tr("Back"), 22, THEME.prompttext);
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
GuiImage cancelBtnImg(&btnOutline);
if (Settings.wsprompt == yes) {
cancelBtnTxt.SetWidescreen(CFG.widescreen);
cancelBtnImg.SetWidescreen(CFG.widescreen);
}
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, btnClick2,1);
cancelBtn.SetScale(0.9);
cancelBtn.SetLabel(&cancelBtnTxt);
cancelBtn.SetTrigger(&trigB);
u8 scrollbaron = 0;
if (num_titles > 9)
scrollbaron = 1;
示例9: InternalShowGameInfo
//.........这里部分代码省略.........
GuiImageData * wiispeakImgData = NULL;
//GuiImageData * vitalitysensorImgData = NULL;
GuiImageData * gamecubeImgData = NULL;
GuiImageData * ratingImgData = NULL;
GuiImageData * cover = NULL;
GuiText * releasedTxt = NULL;
GuiText * publisherTxt = NULL;
GuiText * developerTxt = NULL;
GuiText * titleTxt = NULL;
Text * synopsisTxt = NULL;
GuiText * genreTitleTxt = NULL;
GuiText ** genreTxt = NULL;
GuiText ** wifiTxt = NULL;
GuiText * gametdb1Txt = NULL;
GuiText * memTxt = NULL;
GuiWindow gameinfoWindow(600, 308);
gameinfoWindow.SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
gameinfoWindow.SetPosition(0, -50);
GuiWindow InfoWindow(600, 308);
InfoWindow.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
GuiWindow txtWindow(350, 270);
txtWindow.SetAlignment(ALIGN_CENTER, ALIGN_TOP);
txtWindow.SetPosition(95, 40);
GuiImageData dialogBox1(Resources::GetFile("gameinfo1.png"), Resources::GetFileSize("gameinfo1.png"));
GuiImageData dialogBox2(Resources::GetFile("gameinfo1a.png"), Resources::GetFileSize("gameinfo1a.png"));
GuiImageData dialogBox3(Resources::GetFile("gameinfo2.png"), Resources::GetFileSize("gameinfo2.png"));
GuiImageData dialogBox4(Resources::GetFile("gameinfo2a.png"), Resources::GetFileSize("gameinfo2a.png"));
GuiTrigger trig1;
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_X, 0);
GuiTrigger trigA;
trigA.SetButtonOnlyTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiTrigger trigB;
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
GuiTrigger trigU;
trigU.SetButtonOnlyTrigger(-1, WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP, PAD_BUTTON_UP);
GuiTrigger trigD;
trigD.SetButtonOnlyTrigger(-1, WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN, PAD_BUTTON_DOWN);
GuiTrigger trigH;
trigH.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
//buttons for changing between synopsis and other info
GuiButton backBtn(0, 0);
backBtn.SetPosition(-20, -20);
backBtn.SetTrigger(&trigB);
gameinfoWindow.Append(&backBtn);
GuiTrigger trigA_Simple;
trigA_Simple.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiTrigger trigLeft;
trigLeft.SetButtonOnlyTrigger(-1, WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT, PAD_BUTTON_LEFT);
GuiTrigger trigRight;
trigRight.SetButtonOnlyTrigger(-1, WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT, PAD_BUTTON_RIGHT);
GuiButton LeftBtn(0, 0);
LeftBtn.SetTrigger(&trigLeft);
if(header->type != TYPE_GAME_WII_DISC && header->type != TYPE_GAME_GC_DISC)
gameinfoWindow.Append(&LeftBtn);
示例10: MainMenu
/****************************************************************************
* MainMenu
***************************************************************************/
void MainMenu(int menu) {
TR;
int currentMenu = menu;
#ifdef HW_RVL
pointer[0] = new GuiImageData(player1_point_png);
pointer[1] = new GuiImageData(player2_point_png);
pointer[2] = new GuiImageData(player3_point_png);
pointer[3] = new GuiImageData(player4_point_png);
#endif
GuiImageData * background = new GuiImageData(xenon_bg_png);
mainWindow = new GuiWindow(screenwidth, screenheight);
bgImg = new GuiImage(background);
// bgImg = new GuiImage(screenwidth, screenheight, (GXColor) {
// 50, 50, 50, 255
// });
// bgImg->ColorStripe(30);
mainWindow->Append(bgImg);
GuiTrigger trigA;
// trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
trigA.SetSimpleTrigger(-1, 0, PAD_BUTTON_A);
ResumeGui();
bgMusic = new GuiSound(bg_music_ogg, bg_music_ogg_size, SOUND_OGG);
bgMusic->SetVolume(50);
bgMusic->Play(); // startup music
while (currentMenu != MENU_EXIT) {
switch (currentMenu) {
case MENU_SETTINGS:
currentMenu = MenuSettings();
break;
case MENU_SETTINGS_FILE:
currentMenu = MenuSettingsFile();
break;
case MENU_BROWSE_DEVICE:
currentMenu = MenuBrowseDevice();
break;
default: // unrecognized menu
currentMenu = MenuSettings();
break;
}
// currentMenu=MenuTest();
// currentMenu = MenuBrowseDevice();
}
ResumeGui();
ExitRequested = 1;
while (1) {
UGUI();
usleep(THREAD_SLEEP);
}
HaltGui();
bgMusic->Stop();
delete bgMusic;
delete bgImg;
delete mainWindow;
delete pointer[0];
delete pointer[1];
delete pointer[2];
delete pointer[3];
mainWindow = NULL;
}
示例11: WindowPrompt
/****************************************************************************
* WindowPrompt
*
* Displays a prompt window to user, with information, an error message, or
* presenting a user with a choice
***************************************************************************/
int
WindowPrompt(const char *title, const char *msg, const char *btn1Label, const char *btn2Label) {
int choice = -1;
// GuiWindow promptWindow(448, 288);
GuiWindow promptWindow(640, 360);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiImageData btnOutline(xenon_button_png);
GuiImageData btnOutlineOver(xenon_button_over_png);
GuiTrigger trigA;
// trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
trigA.SetSimpleTrigger(-1, 0, PAD_BUTTON_A);
// GuiImageData dialogBox(dialogue_box_png);
GuiImageData dialogBox(xenon_popup_png);
GuiImage dialogBoxImg(&dialogBox);
GuiText titleTxt(title, 26, ColorGrey);
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0, 40);
GuiText msgTxt(msg, 22, ColorGrey);
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
msgTxt.SetPosition(0, -20);
msgTxt.SetWrap(true, 600);
GuiText btn1Txt(btn1Label, 22, ColorGrey);
GuiImage btn1Img(&btnOutline);
GuiImage btn1ImgOver(&btnOutlineOver);
GuiButton btn1(btnOutline.GetWidth(), btnOutline.GetHeight());
if (btn2Label) {
btn1.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
btn1.SetPosition(20, -25);
} else {
btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
btn1.SetPosition(0, -25);
}
btn1.SetLabel(&btn1Txt);
btn1.SetImage(&btn1Img);
btn1.SetImageOver(&btn1ImgOver);
btn1.SetSoundOver(&btnSoundOver);
btn1.SetTrigger(&trigA);
btn1.SetState(STATE_SELECTED);
btn1.SetEffectGrow();
GuiText btn2Txt(btn2Label, 22, ColorGrey);
GuiImage btn2Img(&btnOutline);
GuiImage btn2ImgOver(&btnOutlineOver);
GuiButton btn2(btnOutline.GetWidth(), btnOutline.GetHeight());
btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
btn2.SetPosition(-20, -25);
btn2.SetLabel(&btn2Txt);
btn2.SetImage(&btn2Img);
btn2.SetImageOver(&btn2ImgOver);
btn2.SetSoundOver(&btnSoundOver);
btn2.SetTrigger(&trigA);
btn2.SetEffectGrow();
promptWindow.Append(&dialogBoxImg);
promptWindow.Append(&titleTxt);
promptWindow.Append(&msgTxt);
promptWindow.Append(&btn1);
if (btn2Label)
promptWindow.Append(&btn2);
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
HaltGui();
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&promptWindow);
mainWindow->ChangeFocus(&promptWindow);
ResumeGui();
while (choice == -1) {
UGUI();
usleep(THREAD_SLEEP);
if (btn1.GetState() == STATE_CLICKED)
choice = 1;
else if (btn2.GetState() == STATE_CLICKED)
choice = 0;
}
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
while (promptWindow.GetEffect() > 0) {
UGUI();
usleep(THREAD_SLEEP);
}
HaltGui();
mainWindow->Remove(&promptWindow);
//.........这里部分代码省略.........
示例12: MenuSettingsFile
static int MenuSettingsFile() {
int menu = MENU_NONE;
int ret;
int i = 0;
bool firstRun = true;
OptionList options;
sprintf(options.name[i++], "Load Device");
sprintf(options.name[i++], "Save Device");
sprintf(options.name[i++], "Folder 1");
sprintf(options.name[i++], "Folder 2");
sprintf(options.name[i++], "Folder 3");
sprintf(options.name[i++], "Auto Load");
sprintf(options.name[i++], "Auto Save");
options.length = i;
GuiText titleTxt("Settings - Saving & Loading", 28, ColorGrey);
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
titleTxt.SetPosition(50, 50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiImageData btnOutline(xenon_button_png);
GuiImageData btnOutlineOver(xenon_button_over_png);
GuiTrigger trigA;
// trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
trigA.SetSimpleTrigger(-1, 0, PAD_BUTTON_A);
GuiText backBtnTxt("Go Back", 22, ColorGrey2);
GuiImage backBtnImg(&btnOutline);
GuiImage backBtnImgOver(&btnOutlineOver);
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
backBtn.SetPosition(100, -35);
backBtn.SetLabel(&backBtnTxt);
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetSoundOver(&btnSoundOver);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
GuiOptionBrowser optionBrowser(552, 248, &options);
optionBrowser.SetPosition(0, 108);
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
optionBrowser.SetCol2Position(185);
HaltGui();
GuiWindow w(screenwidth, screenheight);
w.Append(&backBtn);
mainWindow->Append(&optionBrowser);
mainWindow->Append(&w);
mainWindow->Append(&titleTxt);
ResumeGui();
while (menu == MENU_NONE) {
UGUI();
usleep(THREAD_SLEEP);
ret = optionBrowser.GetClickedOption();
switch (ret) {
case 0:
Settings.LoadMethod++;
break;
case 1:
Settings.SaveMethod++;
break;
case 2:
OnScreenKeyboard(Settings.Folder1, 256);
break;
case 3:
OnScreenKeyboard(Settings.Folder2, 256);
break;
case 4:
OnScreenKeyboard(Settings.Folder3, 256);
break;
case 5:
Settings.AutoLoad++;
if (Settings.AutoLoad > 2)
Settings.AutoLoad = 0;
break;
case 6:
Settings.AutoSave++;
if (Settings.AutoSave > 3)
Settings.AutoSave = 0;
break;
}
if (ret >= 0 || firstRun) {
firstRun = false;
// correct load/save methods out of bounds
if (Settings.LoadMethod > 4)
Settings.LoadMethod = 0;
if (Settings.SaveMethod > 6)
//.........这里部分代码省略.........
示例13: MenuSettings
/****************************************************************************
* MenuSettings
***************************************************************************/
static int MenuSettings() {
int menu = MENU_NONE;
GuiText titleTxt("Settings", 28, ColorGrey);
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
titleTxt.SetPosition(50, 50);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiImageData btnOutline(xenon_button_png);
GuiImageData btnOutlineOver(xenon_button_over_png);
GuiImageData btnLargeOutline(xenon_button_large_png);
GuiImageData btnLargeOutlineOver(xenon_button_large_over_png);
GuiTrigger trigA;
// trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
trigA.SetSimpleTrigger(-1, 0, PAD_BUTTON_A);
GuiTrigger trigHome;
// trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
trigHome.SetButtonOnlyTrigger(-1, 0, 0);
GuiText fileBtnTxt("File Browser", 22, ColorGrey2);
fileBtnTxt.SetWrap(true, btnLargeOutline.GetWidth() - 30);
GuiImage fileBtnImg(&btnLargeOutline);
GuiImage fileBtnImgOver(&btnLargeOutlineOver);
GuiButton fileBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
fileBtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
fileBtn.SetPosition(50, 120);
fileBtn.SetLabel(&fileBtnTxt);
fileBtn.SetImage(&fileBtnImg);
fileBtn.SetImageOver(&fileBtnImgOver);
fileBtn.SetSoundOver(&btnSoundOver);
fileBtn.SetTrigger(&trigA);
fileBtn.SetEffectGrow();
GuiText videoBtnTxt("Video", 22, ColorGrey2);
videoBtnTxt.SetWrap(true, btnLargeOutline.GetWidth() - 30);
GuiImage videoBtnImg(&btnLargeOutline);
GuiImage videoBtnImgOver(&btnLargeOutlineOver);
GuiButton videoBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
videoBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
videoBtn.SetPosition(0, 120);
videoBtn.SetLabel(&videoBtnTxt);
videoBtn.SetImage(&videoBtnImg);
videoBtn.SetImageOver(&videoBtnImgOver);
videoBtn.SetSoundOver(&btnSoundOver);
videoBtn.SetTrigger(&trigA);
videoBtn.SetEffectGrow();
GuiText savingBtnTxt1("Saving", 22, ColorGrey2);
GuiText savingBtnTxt2("&", 18, ColorGrey2);
GuiText savingBtnTxt3("Loading", 22, ColorGrey2);
savingBtnTxt1.SetPosition(0, -20);
savingBtnTxt3.SetPosition(0, +20);
GuiImage savingBtnImg(&btnLargeOutline);
GuiImage savingBtnImgOver(&btnLargeOutlineOver);
GuiButton savingBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
savingBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
savingBtn.SetPosition(-50, 120);
savingBtn.SetLabel(&savingBtnTxt1, 0);
savingBtn.SetLabel(&savingBtnTxt2, 1);
savingBtn.SetLabel(&savingBtnTxt3, 2);
savingBtn.SetImage(&savingBtnImg);
savingBtn.SetImageOver(&savingBtnImgOver);
savingBtn.SetSoundOver(&btnSoundOver);
savingBtn.SetTrigger(&trigA);
savingBtn.SetEffectGrow();
GuiText menuBtnTxt("Menu", 22, ColorGrey2);
menuBtnTxt.SetWrap(true, btnLargeOutline.GetWidth() - 30);
GuiImage menuBtnImg(&btnLargeOutline);
GuiImage menuBtnImgOver(&btnLargeOutlineOver);
GuiButton menuBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
menuBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
menuBtn.SetPosition(-125, 250);
menuBtn.SetLabel(&menuBtnTxt);
menuBtn.SetImage(&menuBtnImg);
menuBtn.SetImageOver(&menuBtnImgOver);
menuBtn.SetSoundOver(&btnSoundOver);
menuBtn.SetTrigger(&trigA);
menuBtn.SetEffectGrow();
GuiText networkBtnTxt("Network", 22, ColorGrey2);
networkBtnTxt.SetWrap(true, btnLargeOutline.GetWidth() - 30);
GuiImage networkBtnImg(&btnLargeOutline);
GuiImage networkBtnImgOver(&btnLargeOutlineOver);
GuiButton networkBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
networkBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
networkBtn.SetPosition(125, 250);
networkBtn.SetLabel(&networkBtnTxt);
networkBtn.SetImage(&networkBtnImg);
networkBtn.SetImageOver(&networkBtnImgOver);
networkBtn.SetSoundOver(&btnSoundOver);
networkBtn.SetTrigger(&trigA);
networkBtn.SetEffectGrow();
//.........这里部分代码省略.........
示例14: MenuBrowseDevice
/****************************************************************************
* MenuBrowseDevice
***************************************************************************/
static int MenuBrowseDevice() {
char title[100];
int i;
ShutoffRumble();
// populate initial directory listing
if (BrowseDevice() <= 0) {
int choice = WindowPrompt(
"Error",
"Unable to display files on selected load device.",
"Retry",
"Check Settings");
if (choice)
return MENU_BROWSE_DEVICE;
else
return MENU_SETTINGS;
}
int menu = MENU_NONE;
sprintf(title, "Browse Files");
GuiText titleTxt(title, 28, ColorGrey);
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
titleTxt.SetPosition(100, 50);
GuiTrigger trigA;
// trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
trigA.SetSimpleTrigger(-1, 0, PAD_BUTTON_A);
GuiFileBrowser fileBrowser(1080, 496);
fileBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
fileBrowser.SetPosition(0, 100);
GuiImageData btnOutline(xenon_button_png);
GuiImageData btnOutlineOver(xenon_button_over_png);
GuiText backBtnTxt("Go Back", 24, ColorGrey2);
GuiImage backBtnImg(&btnOutline);
GuiImage backBtnImgOver(&btnOutlineOver);
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
backBtn.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
backBtn.SetPosition(30, -35);
backBtn.SetLabel(&backBtnTxt);
backBtn.SetImage(&backBtnImg);
backBtn.SetImageOver(&backBtnImgOver);
backBtn.SetTrigger(&trigA);
backBtn.SetEffectGrow();
GuiWindow xenon_buttonWindow(screenwidth, screenheight);
xenon_buttonWindow.Append(&backBtn);
HaltGui();
mainWindow->Append(&titleTxt);
mainWindow->Append(&fileBrowser);
mainWindow->Append(&xenon_buttonWindow);
ResumeGui();
while (menu == MENU_NONE) {
UGUI();
usleep(THREAD_SLEEP);
// update file browser based on arrow xenon_buttons
// set MENU_EXIT if A xenon_button pressed on a file
for (i = 0; i < FILE_PAGESIZE; i++) {
if (fileBrowser.fileList[i]->GetState() == STATE_CLICKED) {
fileBrowser.fileList[i]->ResetState();
// check corresponding browser entry
if (browserList[browser.selIndex].isdir) {
if (BrowserChangeFolder()) {
fileBrowser.ResetState();
fileBrowser.fileList[0]->SetState(STATE_SELECTED);
fileBrowser.TriggerUpdate();
} else {
menu = MENU_BROWSE_DEVICE;
break;
}
} else {
ShutoffRumble();
mainWindow->SetState(STATE_DISABLED);
// load file
printf("Launch : %s\r\n",browserList[browser.selIndex].filename);
mainWindow->SetState(STATE_DEFAULT);
}
}
}
if (backBtn.GetState() == STATE_CLICKED)
menu = MENU_SETTINGS;
}
HaltGui();
mainWindow->Remove(&titleTxt);
mainWindow->Remove(&xenon_buttonWindow);
mainWindow->Remove(&fileBrowser);
return menu;
}
示例15: TitleBrowser
//.........这里部分代码省略.........
NandTitles.AsciiTID(tid, (char*) &id);
const char* name = NULL;
std::string TitleName;
if(XML_DB->GetTitle(id, TitleName))
name = TitleName.c_str();
else
name = NandTitles.NameOf(tid);
options3.SetName(i, "%s", id);
options3.SetValue(i, "%s", name ? name : tr( "Unknown" ));
titleList[i] = tid;
i++;
}
delete XML_DB;
XML_DB = NULL;
if (i == num_titles + num_sys_titles)
{
options3.SetName(i, " ");
options3.SetValue(i, "%s", tr( "Wii Settings" ));
}
bool exit = false;
int total = num_titles + num_sys_titles;
if (IsNetworkInit()) ResumeNetworkWait();
GuiImageData btnOutline(Resources::GetFile("button_dialogue_box.png"), Resources::GetFileSize("button_dialogue_box.png"));
GuiImageData settingsbg(Resources::GetFile("settings_background.png"), Resources::GetFileSize("settings_background.png"));
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiTrigger trigHome;
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
GuiTrigger trigB;
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
GuiText titleTxt(tr( "Title Launcher" ), 28, ( GXColor )
{ 0, 0, 0, 255});
titleTxt.SetAlignment(ALIGN_CENTER, ALIGN_TOP);
titleTxt.SetPosition(12, 40);
titleTxt.SetMaxWidth(356, SCROLL_HORIZONTAL);
GuiImage settingsbackground(&settingsbg);
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
settingsbackgroundbtn.SetPosition(0, 0);
settingsbackgroundbtn.SetImage(&settingsbackground);
GuiText cancelBtnTxt(tr( "Back" ), 22, thColor("r=0 g=0 b=0 a=255 - prompt windows button text color"));
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth() - 30);
GuiImage cancelBtnImg(&btnOutline);
if (Settings.wsprompt)
{
cancelBtnTxt.SetWidescreen(Settings.widescreen);
cancelBtnImg.SetWidescreen(Settings.widescreen);
}
GuiButton cancelBtn(&cancelBtnImg, &cancelBtnImg, 2, 3, 180, 400, &trigA, btnSoundOver, btnSoundClick2, 1);
cancelBtn.SetScale(0.9);
cancelBtn.SetLabel(&cancelBtnTxt);
cancelBtn.SetTrigger(&trigB);
GuiOptionBrowser optionBrowser3(396, 280, &options3, "bg_options_settings.png");