mirror of
https://github.com/Maschell/SDL2_Playground.git
synced 2024-11-23 13:19:16 +01:00
GuiButton: Process children
This commit is contained in:
parent
804aa6b7ce
commit
0ca699b4e7
@ -241,7 +241,7 @@ void GuiButton::update(GuiController *c) {
|
||||
} else if ((isStateSet(STATE_CLICKED, c->chanIdx) || isStateSet(STATE_CLICKED_TOUCH, c->chanIdx)) && (clickedTrigger == trigger[i]) && !isStateSet(STATE_HELD, c->chanIdx) && !trigger[i]->held(c) &&
|
||||
((isClicked == GuiTrigger::CLICKED_NONE) || trigger[i]->released(c))) {
|
||||
if ((isStateSet(STATE_CLICKED_TOUCH, c->chanIdx) && this->isInside(c->data.x, c->data.y)) || (isStateSet(STATE_CLICKED, c->chanIdx))) {
|
||||
clickedTrigger = NULL;
|
||||
clickedTrigger = nullptr;
|
||||
clearState(STATE_CLICKED, c->chanIdx);
|
||||
released(this, c, trigger[i]);
|
||||
}
|
||||
@ -263,13 +263,34 @@ void GuiButton::update(GuiController *c) {
|
||||
} else if (isStateSet(STATE_HELD, c->chanIdx) && (heldTrigger == trigger[i]) && (!isHeld || trigger[i]->released(c))) {
|
||||
//! click is removed at this point and converted to held
|
||||
if (clickedTrigger == trigger[i]) {
|
||||
clickedTrigger = NULL;
|
||||
clickedTrigger = nullptr;
|
||||
clearState(STATE_CLICKED, c->chanIdx);
|
||||
}
|
||||
heldTrigger = NULL;
|
||||
heldTrigger = nullptr;
|
||||
clearState(STATE_HELD, c->chanIdx);
|
||||
released(this, c, trigger[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GuiButton::process() {
|
||||
GuiElement::process();
|
||||
|
||||
if(image) { image->process(); }
|
||||
if(imageOver) { imageOver->process(); }
|
||||
if(imageHold) { imageHold->process(); }
|
||||
if(imageClick) { imageClick->process(); }
|
||||
if(icon) { icon->process(); }
|
||||
if(iconOver) { iconOver->process(); }
|
||||
if(soundOver) { soundOver->process(); }
|
||||
if(soundHold) { soundHold->process(); }
|
||||
if(soundClick) { soundClick->process(); }
|
||||
|
||||
for(int i = 0;i<4;i++){
|
||||
if(label[i]) { label[i]->process(); }
|
||||
if(labelOver[i]) { labelOver[i]->process(); }
|
||||
if(labelHold[i]) { labelHold[i]->process(); }
|
||||
if(labelClick[i]) { labelClick[i]->process(); }
|
||||
}
|
||||
}
|
||||
|
@ -100,6 +100,8 @@ public:
|
||||
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
|
||||
void update(GuiController *c) override;
|
||||
|
||||
void process() override;
|
||||
|
||||
sigslot::signal2<GuiButton *, const GuiController *> selected;
|
||||
sigslot::signal2<GuiButton *, const GuiController *> deSelected;
|
||||
sigslot::signal2<GuiButton *, const GuiController *> pointedOn;
|
||||
|
Loading…
Reference in New Issue
Block a user