Cocos2d-x3.3final (4) ImageView common member functions (c + +)

Source: Internet
Author: User

This series only provides the familiarity and convenience of functions, there is no technical content--

ImageView * ImageView = imageview::create ("Cocosui/ccicon.png"); //New picture

Imageview->setscale9enabled (TRUE); //Whether to enable the nine Gongge display mode

Imageviewchild->setsizetype (widget::sizetype::P ercent); //Set Size type

Imageviewchild->setsizepercent (Vec2::anchor_middle); //Set size ratio

Imageviewchild->setpositiontype (Widget::P ositiontype::P ercent); //Set Location type

Imageviewchild->setpositionpercent (Vec2::anchor_middle); //Set position ratio

Imageviewchild->setposition (VEC2 (widgetsize.width/2.0f,
widgetsize.height/2.0f)); //Set Location

Imageview->addtoucheventlistener ([=] (REF * sender, Widget::toucheventtype type) {

if (type = = widget::toucheventtype::ended) {

Float width = ccrandom_0_1 () * 200 + 50;

float height = ccrandom_0_1 () * 80 + 30;

Imageview->setcontentsize (Size (width, height));

Imageviewchild->setpositionpercent (VEC2 (Ccrandom_0_1 (), ccrandom_0_1 ());

}

});

Imageview->setcolor (color3b (159, 168, 187); Set Picture color

Imageview->setcontentsize (Size (250, 115)); //Set Picture size

Imageview->setfilppedx (TRUE); //Flip on X-axis

Imageview->setscale (0.5); //Set image magnification factor, current factor +1

Imageview->ignorecontentadaptwithsize (FALSE); //If set to True, ignore content adaptation, use system default render size regardless of actual picture resource size





Cocos2d-x3.3final (4) ImageView common member functions (c + +)

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.