예제 #1
0
/*************************************************************************
    Creates a checkbox to let the user choose to display randomised or real FPS value
*************************************************************************/
void CustomShapesDrawingSample::createCheckboxShowRealFPS()
{
    WindowManager& winMgr = WindowManager::getSingleton();

    // We create a button and subscribe to its click events
    ToggleButton* checkboxShowRealFPS = static_cast<CEGUI::ToggleButton*>(winMgr.createWindow("WindowsLook/Checkbox"));
    checkboxShowRealFPS->setSize(CEGUI::USize(cegui_reldim(0.25f), cegui_reldim(0.035f)));
    checkboxShowRealFPS->setHorizontalAlignment(HA_CENTRE);
    checkboxShowRealFPS->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.13f)));
    checkboxShowRealFPS->setText("Show randomly generated FPS values");
    checkboxShowRealFPS->subscribeEvent(ToggleButton::EventSelectStateChanged, Event::Subscriber(&CustomShapesDrawingSample::handleToggleButtonShowRandomisedFpsSelectionChanged, this));
    checkboxShowRealFPS->setSelected(true);
    d_root->addChild(checkboxShowRealFPS);
}
예제 #2
0
void UILayer::initButtons( void )
{
    //정지 팝업띄우는 버튼
    Button* stop = Button::buttonWithFrameImageFile("stop.png", "stop.png");
    stop->setPosition(DTool::getCenter(this) + Vec2(264, 456));
    stop->addAction([this]()
    {
        PopupStop* popupStop = PopupStop::create("", "popup_stop.png");
        popupStop->showPopup(this);
    },
    TOUCH_DOWN);
    
    addChild(stop);
    
    //하트버튼
    ToggleButton* heart = ToggleButton::buttonWithFrameImageFile("btn_heart_on.png", "btn_heart_off.png");
    heart->setPosition(DTool::getCenter(this) + Vec2(254, 180));
    addChild(heart);
}