GButton protected members #1983
paulocoutinhox
started this conversation in
General
Replies: 1 comment 5 replies
-
My temporary workaround: #include "gui/MenuWindowGUI.h"
namespace game::gui {
USING_NS_FGUI;
class GButton2 : public GButton {
public:
void xyz() {
setState(GButton::SELECTED_OVER);
}
};
void MenuWindowGUI::onInit() {
setContentPane(UIPackage::createObject("Main", "GameMenuWindow")->as<GComponent>());
center();
getContentPane()->getChildByPath("btStart")->addClickListener(CC_CALLBACK_1(MenuWindowGUI::onBtStartClick, this));
}
void MenuWindowGUI::onShown() {
auto button =static_cast<GButton2 *>(getContentPane()->getChildByPath("btStart"));
button->xyz();
}
void MenuWindowGUI::onBtStartClick(fairygui::EventContext *context) {
btStartClickCallback(context);
}
} // namespace game::gui |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Can we turn two protected members as public?
axmol/extensions/fairygui/src/fairygui/GButton.h
Lines 67 to 68 in 6304c88
I can't change control state manually using gamepad controller without access it.
This line is making the
setSelected
unusable, since it start in COMMON state when initialize.Ref:
axmol/extensions/fairygui/src/fairygui/GButton.cpp
Lines 103 to 106 in 6304c88
The common mode is the default button behavior, but i can't simulate hover/selected effect without have access to update it state:
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions