Cocos2d-x Cccontrol Controls

Source: Internet
Author: User
Tags addchild
Thanks for the comments and attention, welcome to reprint and share.
Hard work and perseverance.
Cccontrolslider Slide Bar
void Helloworld::myinit10 () {ccsize size = Ccdirector::shareddirector ()->getwinsize (); Cccontrolslider::create (const char* bgfile, const char* progressfile, const char* thumbfile)//slider three parameters not: Bgfile slide A background map, progressfile that map that covers the background, thumbfile slider diagram cccontrolslider* slider = cccontrolslider::create ("Slidertrack.png", "slid
    Erprogress.png "," sliderthumb.png ");
    Slider->setposition (CCP (size.width*0.5, size.height*0.5));
    This->addchild (slider);
    Minimum value of slider->setminimumvalue (0);
    Maximum value of slider->setmaximumvalue (100);
    Set the current value Slider->setvalue (50); callback function Slider->addtargetwithactionforcontrolevents (this, Cccontrol_selector (helloworld::slideraction),
    
    cccontroleventvaluechanged);
    Used to show the sliding value of the current slider Cclabelttf *ttf=cclabelttf::create ("", "Helvetica", 20);
    Ttf->setposition (CCP (200, 210));
    Ttf->setstring (Ccstring::createwithformat ("Slide bar Current value =%.02f", Slider->getvalue ())->getcstring ()); AddchiLD (ttf,0,999); } void Helloworld::slideraction (ccobject* psender, cccontrolevent controlevent) {cccontrolslider* PSliderCtl = (CCCo
    
    ntrolslider*) Psender;
    Cclabelttf *ttf= (Cclabelttf *) This->getchildbytag (999);
Ttf->setstring (Ccstring::createwithformat ("Slide bar Current value =%.02f", Psliderctl->getvalue ())->getcstring ()); }





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.