cocos2d-x中ccui.checkbox的使用方法

   local checkbox = ccui.CheckBox:create()
 
   checkbox:setAnchorPoint(cc.p(0,0))
   checkbox:setPosition(cc.p(size.width/2, size.height/2))
   checkbox:setSelected(false)
   checkbox:loadTextures("sliderThumb.png","CloseNormal.png","dog.png","sliderThumb.png","CloseNormal.png",ccui.TextureResType.localType)
   checkbox:setEnabled(true)
   scene:addChild(checkbox)
   
    localfunction tick(Ref,type)
       if Ref == checkbox and type == ccui.CheckBoxEventType.selectedthen
     print("Hello, checkbox isselected")
    end
    end

   checkbox:addEventListener(tick)

你可能感兴趣的:(lua,cocos2dx)