24 btnSoundOver =
new GuiSound(button_over_pcm, button_over_pcm_size, SOUND::PCM);
25 btnSoundClick =
new GuiSound(button_click_pcm, button_click_pcm_size, SOUND::PCM);
28 bgOptionsImg =
new GuiImage(bgOptions);
29 bgOptionsImg->setParent(
this);
30 bgOptionsImg->setAlignment(ALIGN_H::LEFT, ALIGN_V::MIDDLE);
35 scrollbarImg =
new GuiImage(scrollbar);
36 scrollbarImg->setParent(
this);
37 scrollbarImg->setAlignment(ALIGN_H::RIGHT, ALIGN_V::TOP);
38 scrollbarImg->setPosition(0, 30);
41 arrowDownImg =
new GuiImage(arrowDown);
42 arrowDownOver =
new GuiImageData(scrollbar_arrowdown_over_png);
43 arrowDownOverImg =
new GuiImage(arrowDownOver);
46 arrowUpOver =
new GuiImageData(scrollbar_arrowup_over_png);
47 arrowUpOverImg =
new GuiImage(arrowUpOver);
49 arrowUpBtn =
new GuiButton(arrowUpImg->getWidth(), arrowUpImg->getHeight());
50 arrowUpBtn->setParent(
this);
51 arrowUpBtn->setImage(arrowUpImg);
52 arrowUpBtn->setImageOver(arrowUpOverImg);
53 arrowUpBtn->setAlignment(ALIGN_H::RIGHT, ALIGN_V::TOP);
54 arrowUpBtn->setSelectable(
false);
55 arrowUpBtn->setTrigger(trigA);
56 arrowUpBtn->setSoundOver(btnSoundOver);
57 arrowUpBtn->setSoundClick(btnSoundClick);
59 arrowDownBtn =
new GuiButton(arrowDownImg->getWidth(), arrowDownImg->getHeight());
60 arrowDownBtn->setParent(
this);
61 arrowDownBtn->setImage(arrowDownImg);
62 arrowDownBtn->setImageOver(arrowDownOverImg);
63 arrowDownBtn->setAlignment(ALIGN_H::RIGHT, ALIGN_V::BOTTOM);
64 arrowDownBtn->setSelectable(
false);
65 arrowDownBtn->setTrigger(trigA);
66 arrowDownBtn->setSoundOver(btnSoundOver);
67 arrowDownBtn->setSoundClick(btnSoundClick);
69 for(
int i=0; i<OPTION_PAGESIZE; i++)
72 optionTxt[i]->
setAlignment(ALIGN_H::LEFT, ALIGN_V::MIDDLE);
73 optionTxt[i]->setPosition(8,4);
74 optionTxt[i]->setMaxWidth(235);
77 optionVal[i]->setAlignment(ALIGN_H::LEFT, ALIGN_V::MIDDLE);
81 optionBg[i] =
new GuiImage(bgOptionsEntry);
84 optionBtn[i]->setParent(
this);
85 optionBtn[i]->setLabel(optionTxt[i], 0);
87 optionBtn[i]->setImageOver(optionBg[i]);
88 optionBtn[i]->setPosition(2,30*i+3);
89 optionBtn[i]->setTrigger(trigA);
90 optionBtn[i]->setSoundClick(btnSoundClick);
251 if(
state == STATE::DISABLED || !controller)
256 arrowUpBtn->update(controller);
257 arrowDownBtn->update(controller);
264 for(
int i=0; i<OPTION_PAGESIZE; ++i)
268 if(optionBtn[i]->
getState() == STATE::DISABLED)
270 optionBtn[i]->setVisible(
true);
271 optionBtn[i]->setState(STATE::DEFAULT);
274 optionTxt[i]->setText(options->name[next]);
275 optionVal[i]->setText(options->value[next]);
276 optionIndex[i] = next;
281 optionBtn[i]->setVisible(
false);
282 optionBtn[i]->setState(STATE::DISABLED);
287 auto pad = controller->getPadData();
288 int currentChan = controller->getChannel();
294 bool channelActive = pad.validPointer || pad.buttons_d != 0 || pad.buttons_h != 0;
296 for(
int i=0; i<OPTION_PAGESIZE; ++i)
298 if(i != selectedItem && optionBtn[i]->
getState() == STATE::SELECTED)
299 optionBtn[i]->resetState();
300 else if(
focus && channelActive && i == selectedItem && optionBtn[i]->
getState() == STATE::DEFAULT)
301 optionBtn[selectedItem]->setState(STATE::SELECTED, currentChan);
302 else if(
focus && channelActive && i == selectedItem && optionBtn[i]->
getState() == STATE::SELECTED &&
309 optionBtn[i]->resetState();
315 if(pad.validPointer && !optionBtn[i]->isInside(pad.cursor_x, pad.cursor_y))
316 controller->setChannel(-1);
318 optionBtn[i]->update(controller);
319 controller->setChannel(currentChan);
321 if(optionBtn[i]->
getState() == STATE::SELECTED)
324 if(selectedItem == i) {
325 optionTxt[i]->setScroll(SCROLL::HORIZONTAL);
326 optionVal[i]->setScroll(SCROLL::HORIZONTAL);
330 optionTxt[i]->setScroll(SCROLL::NONE);
339 if(controller->down() || arrowDownBtn->getState() == STATE::CLICKED)
341 next = this->
findMenuItem(optionIndex[selectedItem], 1);
345 if(selectedItem == OPTION_PAGESIZE-1)
351 else if(optionBtn[selectedItem+1]->
isVisible())
353 optionBtn[selectedItem]->resetState();
354 optionBtn[selectedItem+1]->setState(STATE::SELECTED, controller->getChannel());
358 arrowDownBtn->resetState();
360 else if(controller->up() || arrowUpBtn->getState() == STATE::CLICKED)
362 prev = this->
findMenuItem(optionIndex[selectedItem], -1);
366 if(selectedItem == 0)
374 optionBtn[selectedItem]->resetState();
375 optionBtn[selectedItem-1]->setState(STATE::SELECTED, controller->getChannel());
379 arrowUpBtn->resetState();
Display, manage, and manipulate text in the GUI.
void setAlignment(ALIGN_H hor, ALIGN_V vert)
Sets the text alignment.