Baoulettes

Untitled

Jun 9th, 2020
1,579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.70 KB | None | 0 0
  1. //Here the base layout I use :
  2.     auto Wallpaper_List_Layout = Layout("background_ori_layout", scene, cocos2d::ui::Layout::Type::ABSOLUTE,10000);
  3.     Wallpaper_List_Layout.setPosition({Ori_Pos_X, Ori_Pos_Y});
  4.     Wallpaper_List_Layout.setContentSize(grid_size_ori);
  5.     // Wallpaper_List_Layout.setBackgroundColor(cocos2d::Color3B::RED, 60);
  6.     Wallpaper_List_Layout.setAnchorPoint(cocos2d::Vec2::ANCHOR_MIDDLE);
  7.  
  8. // here the grid view generation
  9.     GridView Wallpaper_List_lrs("background_lr", Wallpaper_List_Layout, 1); //Will hold lrs wallpapers list
  10.     Wallpaper_List_lrs.setBackgroundColor(cocos2d::Color3B::BLUE, 60);
  11.     Wallpaper_List_lrs.setContentSize(grid_size_ori);
  12.     Wallpaper_List_lrs.setCellPadding(Ori_padding_W,Ori_padding_H);
  13.     Wallpaper_List_lrs.setCellSize(cell_size_ori);
  14.  
  15. Here how I add it (with a loop)
  16.                 Button Wallpaper_btn_lrs(curr_id_str_btn, Wallpaper_List_lrs, 2);
  17.                 std::string Path_thumbs =   layout_image_thumb_path + "cha_base_0" + std::to_string(element_id_int_LD) + "_05.png";
  18.                 Wallpaper_btn_lrs.setDefaultImage(Path_thumbs);
  19.                 Wallpaper_btn_lrs.setPressedImage(Path_thumbs);
  20.                 Wallpaper_btn_lrs.setScale(Icons_scale,Icons_scale);
  21.                 Wallpaper_btn_lrs.setDisabledImage(Path_thumbs);
  22.                 Wallpaper_btn_lrs.addClickEventListener([=](void *) mutable {
  23.                     Wallpaper_List_lrs.setVisible(false);
  24.                     PreviewWallpaper(Card_bg_effect_id_int, scene, Wallpaper_List_lrs);
  25.                 });
  26.                 ImageView Wallpaper_btn_image(curr_id_str_icon, Wallpaper_btn_lrs, 55);
  27.                 Wallpaper_btn_image.setScale(Icons_scale,Icons_scale);
  28.                 Wallpaper_btn_image.loadImage(Icon_Path);
  29.                 Wallpaper_btn_image.setAnchorPoint(cocos2d::Vec2::ANCHOR_MIDDLE);
  30.                 Wallpaper_List_lrs.addCustomItem(Wallpaper_btn_lrs);
Advertisement
Add Comment
Please, Sign In to add comment