コード例 #1
0
        public override void TouchesBegan(List <CCTouch> touches)
        {
            CCTouch touch   = touches[0];
            CCNode  clipper = this.GetChildByTag(kTagClipperNode);
            CCPoint point   = clipper.ConvertToNodeSpace(touch.Location);
            CCRect  rect    = new CCRect(0, 0, clipper.ContentSize.Width, clipper.ContentSize.Height);

            m_bScrolling = rect.ContainsPoint(point);
            m_lastPoint  = point;
        }
コード例 #2
0
        public override void TouchesMoved(List <CCTouch> touches)
        {
            if (!m_bScrolling)
            {
                return;
            }
            CCTouch touch   = touches[0];
            CCNode  clipper = this.GetChildByTag(kTagClipperNode);
            CCPoint point   = clipper.ConvertToNodeSpace(touch.Location);
            CCPoint diff    = point - m_lastPoint;
            CCNode  content = clipper.GetChildByTag(kTagContentNode);

            content.Position = content.Position + diff;
            m_lastPoint      = point;
        }