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 + +)