예제 #1
0
		void onTouchMoved(CCTouch touch, CCEvent touchEvent)
        {
            CCPoint touchLocation = touch.LocationOnScreen;
            CCPoint nodePosition = Layer.ScreenToWorldspace(touchLocation);

            m_test.MouseMove(new b2Vec2(nodePosition.X, nodePosition.Y));
        }
예제 #2
0
		void onTouchMoved(CCTouch touch, CCEvent touchEvent)
        {
            CCPoint touchLocation = touch.Location;
            CCPoint nodePosition = ConvertToNodeSpace(touchLocation);

            m_test.MouseMove(new Vector2(nodePosition.X, nodePosition.Y));
        }
 void OnTouchEnded(CCTouch  touch, CCEvent  touchEvent)
 {
     bool hits = touchHits(touch);
     if (hits && Triggered != null)
         Triggered(this, EventArgs.Empty);
     scaleButtonTo(1);
 }
예제 #4
0
        /**
         * Returns a point corresponding to the touh location converted into the
         * control space coordinates.
         * @param touch A CCTouch object that represents a touch.
         */

        public virtual CCPoint GetTouchLocation(CCTouch touch)
        {
            CCPoint touchLocation = touch.LocationOnScreen;                              // Get the touch position

            touchLocation = WorldToParentspace(Layer.ScreenToWorldspace(touchLocation)); // Convert to the node space of this class

            return(touchLocation);
        }
예제 #5
0
        public override bool IsTouchInside(CCTouch touch)
        {
            CCPoint touchLocation = GetTouchLocation(touch);

            float distance = DistanceBetweenPointAndPoint(ProgressTimer.Position, touchLocation);

            return(distance < Math.Min(ContentSize.Width / 2, ContentSize.Height / 2));
        }
        public CCPoint LocationFromTouch(CCTouch touch)
        {
            CCPoint touchLocation = touch.LocationOnScreen;

            touchLocation = WorldToParentspace(Layer.ScreenToWorldspace(touchLocation));

            return(touchLocation);
        }
예제 #7
0
            bool OnTouchBegan(CCTouch touch, CCEvent touchEvent)
            {
                bool hits = touchHits(touch);
                if (hits)
                    scaleButtonTo(0.9f);

                return hits;
            }
예제 #8
0
		bool onTouchBegan(CCTouch touch, CCEvent touchEvent)
        {
            if (m_state != PaddleState.kPaddleStateUngrabbed) return false;
            if (!containsTouchLocation(touch)) return false;

            m_state = PaddleState.kPaddleStateGrabbed;
            return true;
        }
예제 #9
0
 void TouchCancelled(CCTouch touch, CCEvent touchEvent)
 {
     Debug.Assert(MenuState == CCMenuState.TrackingTouch, "[Menu ccTouchCancelled] -- invalid state");
     if (SelectedMenuItem != null)
     {
         SelectedMenuItem.Selected = false;
     }
     MenuState = CCMenuState.Waiting;
 }
예제 #10
0
        public void TouchEnded(CCTouch touch)
        {
            var pos = Layer.ScreenToWorldspace(touch.LocationOnScreen);

            if (pos.X >= 0 && pos.X < ContentSize.Width && pos.Y >= 0 && pos.Y <= ContentSize.Height)
            {
                Edit();
            }
        }
예제 #11
0
 public void OnTouchesEnded(List<CCTouch> touches, CCEvent touchEvent)
 {
     foreach (CCTouch touch in touches) {
         if (touch == Touch) {
             Touch = null;
             return;
         }
     }
 }
예제 #12
0
        /**
         * Returns a boolean value that indicates whether a touch is inside the bounds
         * of the receiver. The given touch must be relative to the world.
         *
         * @param touch A CCTouch object that represents a touch.
         *
         * @return YES whether a touch is inside the receivers rect.
         */

        public virtual bool IsTouchInside(CCTouch touch)
        {
            CCPoint touchLocation = touch.LocationOnScreen;

            touchLocation = Parent.Layer.ScreenToWorldspace(touchLocation);
            CCRect bBox = BoundingBoxTransformedToWorld;

            return(bBox.ContainsPoint(touchLocation));
        }
예제 #13
0
        public bool TouchBegan(CCTouch touch)
        {
            var pos = Layer.ScreenToWorldspace(touch.LocationOnScreen);

            if (pos.X >= 0 && pos.X < ContentSize.Width && pos.Y >= 0 && pos.Y <= ContentSize.Height)
            {
                return(true);
            }
            return(false);
        }
예제 #14
0
		bool onTouchBegan(CCTouch touch, CCEvent touchEvent)
        {
            CCPoint touchLocation = touch.LocationOnScreen;

            CCPoint nodePosition = Layer.ScreenToWorldspace(touchLocation);
            //    NSLog(@"pos: %f,%f -> %f,%f", touchLocation.x, touchLocation.y, nodePosition.x, nodePosition.y);
            CCLog.Log("OnTouchBegan: " + nodePosition);
			return m_test.MouseDown(new b2Vec2(nodePosition.X, nodePosition.Y));

        }
        void OnTouchMoved(CCTouch pTouch, CCEvent touchEvent)
        {
            CCPoint location = LocationFromTouch(pTouch);

            location = new CCPoint(location.X - initialTouchXPosition, 0);

            HasMoved = true;

            switchSprite.SliderXPosition = location.X;
        }
예제 #16
0
        public void OnTouchMoved(CCTouch touch, CCNode container)
        {
            OnInterfaceMoveLocation(touch.LocationOnScreen.X, touch.LocationOnScreen.Y, container);
            OnInterfaceDragMove(touch.LocationOnScreen.X, touch.LocationOnScreen.Y, container);


#if WINDOWS_PHONE
            //Position = nodePosition.ToCpVect();
#endif
        }
        void OnTouchMoved(CCTouch pTouch, CCEvent touchEvent)
        {
            // Get the touch location
            CCPoint touchLocation = GetTouchLocation(pTouch);

            //small modification: this allows changing of the colour, even if the touch leaves the bounding area
            //     UpdateSliderPosition(touchLocation);
            //     sendActionsForControlEvents(ControlEventValueChanged);
            // Check the touch position on the Slider
            CheckSliderPosition(touchLocation);
        }
        public override bool IsTouchInside(CCTouch touch)
        {
            CCPoint touchLocation = touch.Location;

            CCRect rect = BoundingBoxTransformedToWorld;

            rect.Size.Width += ThumbSprite.ContentSize.Width;
            rect.Origin.X   -= ThumbSprite.ContentSize.Width / 2;

            return(rect.ContainsPoint(touchLocation));
        }
예제 #19
0
		bool onTouchBegan(CCTouch touch, CCEvent touchEvent)
        {
            CCPoint touchLocation = touch.Location;

            CCPoint nodePosition = ConvertToNodeSpace(touchLocation);
            //    NSLog(@"pos: %f,%f -> %f,%f", touchLocation.x, touchLocation.y, nodePosition.x, nodePosition.y);

            m_test.MouseDown(new Vector2(nodePosition.X, nodePosition.Y));

            return true;
        }
예제 #20
0
 void AddIncomingNewTouch(int touchId, ref CCPoint position)
 {
     lock (touchLock)
     {
         if (!touchMap.ContainsKey(touchId))
         {
             var touch = new CCTouch(touchId, position, gameTime.TotalGameTime);
             touchMap.Add(touchId, touch);
             incomingNewTouches.Add(touch);
         }
     }
 }
예제 #21
0
 public void OnTouchesBegan(List<CCTouch> touches, CCEvent touchEvent)
 {
     foreach (CCTouch touch in touches) {
         if (touch!=null) {
             // AirHockey uses layer.ScreenToWorldspace(touch.LocationOnScreen)
             if (BoundingBox.ContainsPoint(touch.Location)) {
                 Touch = touch;
                 return;
             }
         }
     }
 }
        bool OnTouchBegan(CCTouch touch, CCEvent touchEvent)
        {
            if (!IsTouchInside(touch) || !Enabled || !Visible)
            {
                return(false);
            }

            CCPoint location = LocationFromTouch(touch);

            SliderBegan(location);
            return(true);
        }
        bool OnTouchBegan(CCTouch touch, CCEvent touchEvent)
        {
            if (!Enabled || !Visible)
            {
                return(false);
            }

            // Get the touch location
            CCPoint touchLocation = GetTouchLocation(touch);

            // Check the touch position on the Slider
            return(CheckSliderPosition(touchLocation));
        }
예제 #24
0
        //events
        bool onTouchBegan(CCTouch pTouch, CCEvent touchEvent)
        {
            if (!IsTouchInside(pTouch) || !Enabled)
            {
                return(false);
            }

            State       = CCControlState.Highlighted;
            isPushed    = true;
            Highlighted = true;
            SendActionsForControlEvents(CCControlEvent.TouchDown);
            return(true);
        }
예제 #25
0
 public virtual void TouchCancelled(CCTouch touch, CCEvent touchEvent)
 {
     if (!Visible)
     {
         return;
     }
     touches.Remove(touch);
     if (touches.Count == 0)
     {
         Dragging     = false;
         IsTouchMoved = false;
     }
 }
예제 #26
0
        bool OnTouchBegan(CCTouch touch, CCEvent touchEvent)
        {
            if (!IsTouchInside(touch) || !Enabled || !Visible)
            {
                return(false);
            }

            previousLocation = GetTouchLocation(touch);

            PotentiometerBegan(previousLocation);

            return(true);
        }
        void OnTouchCancelled(CCTouch pTouch, CCEvent touchEvent)
        {
            CCPoint location = LocationFromTouch(pTouch);

            switchSprite.ThumbSprite.Color = new CCColor3B(255, 255, 255);

            if (HasMoved)
            {
                On = !(location.X < switchSprite.ContentSize.Width / 2);
            }
            else
            {
                On = !on;
            }
        }
예제 #28
0
        protected virtual CCPoint LocationFromTouch(CCTouch touch)
        {
            CCPoint touchLocation = touch.LocationOnScreen;                              // Get the touch position

            touchLocation = WorldToParentspace(Layer.ScreenToWorldspace(touchLocation)); // Convert to the node space of this class

            if (touchLocation.X < 0)
            {
                touchLocation.X = 0;
            }
            else if (touchLocation.X > BackgroundSprite.ContentSize.Width)
            {
                touchLocation.X = BackgroundSprite.ContentSize.Width;
            }
            return(touchLocation);
        }
예제 #29
0
 public void OnTouchEnded(CCTouch touch, CCEvent e)
 {
     if (Enable)
     {
         foreach (var control in ControlList)
         {
             var p = control.PositionWorldspace;
             var rect = new CCRect(p.X, p.Y, control.ContentSize.Width, control.ContentSize.Height);
             if (rect.ContainsPoint(Target.Layer.ScreenToWorldspace(touch.LocationOnScreen)))
             {
                 control.OnTouchEnded(touch, e);
                 return;
             }
         }
     }
 }
예제 #30
0
        void OnTouchEnded(CCTouch pTouch, CCEvent touchEvent)
        {
            MinusSprite.Color = CCColor3B.White;
            PlusSprite.Color  = CCColor3B.White;

            if (autorepeat)
            {
                StopAutorepeat();
            }

            if (IsTouchInside(pTouch))
            {
                CCPoint location = GetTouchLocation(pTouch);

                Value = this.value + ((location.X < MinusSprite.ContentSize.Width) ? (0.0f - stepValue) : stepValue);
            }
        }
        bool OnTouchBegan(CCTouch touch, CCEvent touchEvent)
        {
            if (!IsTouchInside(touch) || !Enabled)
            {
                return(false);
            }

            HasMoved = false;

            CCPoint location = LocationFromTouch(touch);

            initialTouchXPosition = location.X - switchSprite.SliderXPosition;

            switchSprite.ThumbSprite.Color = new CCColor3B(166, 166, 166);
            switchSprite.NeedsLayout();

            return(true);
        }
예제 #32
0
        void onTouchEnded(CCTouch pTouch, CCEvent touchEvent)
        {
            if (m_pTrackNode == null)
            {
                return;
            }

            var endPos = pTouch.LocationOnScreen;

            if (m_pTrackNode.BoundingBox.ContainsPoint(m_beginPos) && m_pTrackNode.BoundingBox.ContainsPoint(endPos))
            {
                onClickTrackNode(true);
            }
            else
            {
                onClickTrackNode(false);
            }
        }
        protected virtual CCPoint LocationFromTouch(CCTouch touch)
        {
            CCPoint touchLocation = touch.Location;             // Get the touch position

            touchLocation = BackgroundSprite.WorldToParentspace(touchLocation);

            var size = BackgroundSprite.ContentSize;

            if (touchLocation.X < 0)
            {
                touchLocation.X = 0;
            }
            else if (touchLocation.X > size.Width)
            {
                touchLocation.X = size.Width;
            }
            return(touchLocation);
        }
예제 #34
0
        void TouchMoved(CCTouch touch, CCEvent touchEvent)
        {
            Debug.Assert(MenuState == CCMenuState.TrackingTouch, "[Menu TouchMoved] -- invalid state");
            CCMenuItem currentItem = ItemForTouch(touch);

            if (currentItem != SelectedMenuItem)
            {
                if (SelectedMenuItem != null)
                {
                    SelectedMenuItem.Selected = false;
                }

                if (currentItem != null)
                {
                    currentItem.Selected = true;
                }

                SelectedMenuItem = currentItem;
            }
        }
예제 #35
0
        void onTouchEnded(CCTouch pTouch, CCEvent touchEvent)
        {
            State       = CCControlState.Normal;
            isPushed    = false;
            Highlighted = false;


            if (IsTouchInside(pTouch))
            {
                if (Clicked != null)
                {
                    OnClicked();
                }
                OnTouchUpInside();
            }
            else
            {
                OnTouchUpOutside();
            }
        }
예제 #36
0
        void onTouchEnded(CCTouch pTouch, CCEvent touchEvent)
        {
            State       = CCControlState.Normal;
            isPushed    = false;
            Highlighted = false;


            if (IsTouchInside(pTouch))
            {
                if (OnButtonTap != null)
                {
                    OnButtonTap(this);
                }
                SendActionsForControlEvents(CCControlEvent.TouchUpInside);
            }
            else
            {
                SendActionsForControlEvents(CCControlEvent.TouchUpOutside);
            }
        }
예제 #37
0
        bool OnTouchBegan(CCTouch pTouch, CCEvent touchEvent)
        {
            if (!IsTouchInside(pTouch) || !Enabled || !Visible)
            {
                return(false);
            }

            CCPoint location = GetTouchLocation(pTouch);

            UpdateLayoutUsingTouchLocation(location);

            touchInsideFlag = true;

            if (autorepeat)
            {
                StartAutorepeat();
            }

            return(true);
        }
예제 #38
0
        public virtual void TouchEnded(CCTouch touch, CCEvent touchEvent)
        {
            if (!Visible)
            {
                return;
            }

            if (touches.Contains(touch))
            {
                if (touches.Count == 1 && IsTouchMoved)
                {
                    Schedule(DeaccelerateScrolling);
                }
                touches.Remove(touch);
            }

            if (touches.Count == 0)
            {
                Dragging     = false;
                IsTouchMoved = false;
            }
        }
예제 #39
0
        /** override functions */
        public virtual bool TouchBegan(CCTouch pTouch, CCEvent touchEvent)
        {
            if (!Visible)
            {
                return(false);
            }

            var frame = ViewRect;

            //dispatcher does not know about clipping. reject touches outside visible bounds.
            if (touches.Count > 2 ||
                IsTouchMoved ||
                !frame.ContainsPoint(container.Layer.ScreenToWorldspace(pTouch.LocationOnScreen)))
            {
                return(false);
            }

            if (!touches.Contains(pTouch))
            {
                touches.Add(pTouch);
            }

            if (touches.Count == 1)
            {
                // scrolling
                touchPoint     = Layer.ScreenToWorldspace(pTouch.LocationOnScreen);
                IsTouchMoved   = false;
                Dragging       = true; //Dragging started
                scrollDistance = CCPoint.Zero;
                touchLength    = 0.0f;
            }
            else if (touches.Count == 2)
            {
                touchPoint  = CCPoint.Midpoint(Layer.ScreenToWorldspace(touches[0].LocationOnScreen), Layer.ScreenToWorldspace(touches[1].LocationOnScreen));
                touchLength = CCPoint.Distance(container.Layer.ScreenToWorldspace(touches[0].LocationOnScreen), container.Layer.ScreenToWorldspace(touches[1].LocationOnScreen));
                Dragging    = false;
            }
            return(true);
        }
예제 #40
0
        bool TouchBegan(CCTouch touch, CCEvent touchEvent)
        {
            if (MenuState != CCMenuState.Waiting || !Visible || !Enabled)
            {
                return(false);
            }

            for (CCNode c = Parent; c != null; c = c.Parent)
            {
                if (c.Visible == false)
                {
                    return(false);
                }
            }

            SelectedMenuItem = ItemForTouch(touch);
            if (SelectedMenuItem != null)
            {
                MenuState = CCMenuState.TrackingTouch;
                SelectedMenuItem.Selected = true;
                return(true);
            }
            return(false);
        }
예제 #41
0
 bool OnTouchBegan(CCTouch touch, CCEvent touchEvent)
 {
     beginTouchPos = touch.Location;
     return true;
 }
예제 #42
0
 private bool OnTouchBegan(CCTouch arg1, CCEvent arg2)
 {
     return (true);
 }
예제 #43
0
        private void OnTouchMoved(CCTouch arg1, CCEvent arg2)
        {

        }
		void OnTouchCancelled(CCTouch pTouch, CCEvent touchEvent)
        {
            CCPoint location = LocationFromTouch(pTouch);

            switchSprite.ThumbSprite.Color = new CCColor3B(255, 255, 255);

            if (HasMoved)
            {
				On = !(location.X < switchSprite.ContentSize.Width / 2);
            }
            else
            {
				On = !on;
            }
        }
		void OnTouchMoved(CCTouch pTouch, CCEvent touchEvent)
        {
            CCPoint location = LocationFromTouch(pTouch);
            SliderMoved(location);
        }
		public override bool IsTouchInside(CCTouch touch)
		{
			CCPoint touchLocation = touch.Location;

            CCRect rect = BoundingBoxTransformedToWorld;
			rect.Size.Width += ThumbSprite.ContentSize.Width;
			rect.Origin.X -= ThumbSprite.ContentSize.Width / 2;

			return rect.ContainsPoint(touchLocation);
		}
예제 #47
0
        /** override functions */
		public virtual bool TouchBegan(CCTouch pTouch, CCEvent touchEvent)
        {
            if (!Visible)
            {
                return false;
            }

			var frame = ViewRect;

            //dispatcher does not know about clipping. reject touches outside visible bounds.
            if (touches.Count > 2 ||
                IsTouchMoved ||
                !frame.ContainsPoint(container.Layer.ScreenToWorldspace(pTouch.LocationOnScreen)))
            {
                return false;
            }

            if (!touches.Contains(pTouch))
            {
                touches.Add(pTouch);
            }

            if (touches.Count == 1)
            {
                // scrolling
                touchPoint = Layer.ScreenToWorldspace(pTouch.LocationOnScreen);
                IsTouchMoved = false;
                Dragging = true; //Dragging started
                scrollDistance = CCPoint.Zero;
                touchLength = 0.0f;
            }
            else if (touches.Count == 2)
            {
                touchPoint = CCPoint.Midpoint(Layer.ScreenToWorldspace(touches[0].LocationOnScreen), Layer.ScreenToWorldspace(touches[1].LocationOnScreen));
                touchLength = CCPoint.Distance(container.Layer.ScreenToWorldspace(touches[0].LocationOnScreen), container.Layer.ScreenToWorldspace(touches[1].LocationOnScreen));
                Dragging = false;
            }
            return true;
        }
예제 #48
0
 public void TouchCancelled(CCTouch pTouch)
 {
     //nothing
 }
예제 #49
0
 public void TouchMoved(CCTouch touch)
 {
     //nothing
 }
예제 #50
0
 public bool TouchBegan(CCTouch touch)
 {
     var pos = Layer.ScreenToWorldspace(touch.LocationOnScreen);
     if (pos.X >= 0 && pos.X < ContentSize.Width && pos.Y >= 0 && pos.Y <= ContentSize.Height)
     {
         return true;
     }
     return false;
 }
예제 #51
0
        void OnTouchMoved(CCTouch touch, CCEvent touchEvent)
        {

            var touchLocation = touch.Location;
            float nMoveY = touchLocation.Y - beginTouchPos.Y;

            curPos = testListMenu.Position;
            CCPoint nextPos = new CCPoint(curPos.X, curPos.Y + nMoveY);
            CCRect visibleBounds = Layer.VisibleBoundsWorldspace;
            if (nextPos.Y < 0.0f)
            {
                testListMenu.Position = new CCPoint(0, 0);
                return;
            }

            if (nextPos.Y > (((int)TestCases.TESTS_COUNT + 1) * LINE_SPACE - visibleBounds.Size.Height))
            {
                testListMenu.Position = (new CCPoint(0, (((int)TestCases.TESTS_COUNT + 1) * LINE_SPACE - visibleBounds.Size.Height)));
                return;
            }

            testListMenu.Position = nextPos;
            beginTouchPos = touchLocation;
            curPos = nextPos;
        }
예제 #52
0
		public virtual void TouchMoved(CCTouch touch, CCEvent touchEvent)
        {
            if (!Visible)
            {
                return;
            }

            if (touches.Contains(touch))
            {
                if (touches.Count == 1 && Dragging)
                {// scrolling
                    CCPoint moveDistance, newPoint; //, maxInset, minInset;
                    float newX, newY;

					var frame = ViewRect;

                    newPoint = Layer.ScreenToWorldspace(touches[0].LocationOnScreen);
                    moveDistance = newPoint - touchPoint;

                    float dis = 0.0f;
                    if (Direction == CCScrollViewDirection.Vertical)
                    {
                        dis = moveDistance.Y;
                    }
                    else if (Direction == CCScrollViewDirection.Horizontal)
                    {
                        dis = moveDistance.X;
                    }
                    else
                    {
                        dis = (float)Math.Sqrt(moveDistance.X * moveDistance.X + moveDistance.Y * moveDistance.Y);
                    }

                    if (!IsTouchMoved && Math.Abs(ConvertDistanceFromPointToInch(dis)) < MOVE_INCH)
                    {
                        //CCLOG("Invalid movement, distance = [%f, %f], disInch = %f", moveDistance.x, moveDistance.y);
                        return;
                    }

                    if (!IsTouchMoved)
                    {
                        moveDistance = CCPoint.Zero;
                    }

                    touchPoint = newPoint;
                    IsTouchMoved = true;

                    if (frame.ContainsPoint(touchPoint))
                    {
                        switch (Direction)
                        {
                            case CCScrollViewDirection.Vertical:
                                moveDistance = new CCPoint(0.0f, moveDistance.Y);
                                break;
                            case CCScrollViewDirection.Horizontal:
                                moveDistance = new CCPoint(moveDistance.X, 0.0f);
                                break;
                            default:
                                break;
                        }

                        newX = container.Position.X + moveDistance.X;
                        newY = container.Position.Y + moveDistance.Y;

                        scrollDistance = moveDistance;
                        SetContentOffset(new CCPoint(newX, newY));
                    }
                }
                else if (touches.Count == 2 && !Dragging)
                {
                    float len = CCPoint.Distance(Layer.ScreenToWorldspace(touches[0].LocationOnScreen),
                        Layer.ScreenToWorldspace(touches[1].LocationOnScreen));
                    ZoomScale = ZoomScale * len / touchLength;
                }
            }
        }
		protected virtual CCPoint LocationFromTouch(CCTouch touch)
		{
			CCPoint touchLocation = touch.Location; // Get the touch position
            touchLocation = BackgroundSprite.WorldToParentspace(touchLocation);

            var size = BackgroundSprite.ContentSize;

            if (touchLocation.X < 0)
			{
				touchLocation.X = 0;
			}
            else if (touchLocation.X > size.Width)
            {
                touchLocation.X = size.Width;
            }
			return touchLocation;
		}
예제 #54
0
		public virtual void TouchEnded(CCTouch touch, CCEvent touchEvent)
        {
            if (!Visible)
            {
                return;
            }

            if (touches.Contains(touch))
            {
                if (touches.Count == 1 && IsTouchMoved)
                {
                    Schedule(DeaccelerateScrolling);
                }
                touches.Remove(touch);
            }

            if (touches.Count == 0)
            {
                Dragging = false;
                IsTouchMoved = false;
            }
        }
		bool OnTouchBegan(CCTouch touch, CCEvent touchEvent)
        {
            if (!IsTouchInside(touch) || !Enabled || !Visible)
                return false;

            CCPoint location = LocationFromTouch(touch);
            SliderBegan(location);
            return true;
        }
예제 #56
0
		public virtual void TouchCancelled(CCTouch touch, CCEvent touchEvent)
        {
            if (!Visible)
            {
                return;
            }
            touches.Remove(touch);
            if (touches.Count == 0)
            {
                Dragging = false;
                IsTouchMoved = false;
            }
        }
		void OnTouchEnded(CCTouch pTouch, CCEvent touchEvent)
        {
            SliderEnded(CCPoint.Zero);
        }
예제 #58
0
        //public override void TouchEnded(CCTouch touch)
        //{

        //}

        private void OnTouchEnded(CCTouch arg1, CCEvent arg2)
        {
            float accel_filter = 0.1f;
            float ax = ConvertTouchToNodeSpace(arg1).X - ConvertToNodeSpace(arg1.PreviousLocationInView).X;
            ax /= 500;
            bird_vel.X = bird_vel.X * accel_filter + (float)ax * (1.0f - accel_filter) * 500.0f;
        }
예제 #59
0
 public void TouchEnded(CCTouch touch)
 {
     var pos = Layer.ScreenToWorldspace(touch.LocationOnScreen);
     if (pos.X >= 0 && pos.X < ContentSize.Width && pos.Y >= 0 && pos.Y <= ContentSize.Height)
     {
         Edit();
     }
 }
예제 #60
0
        bool OnTouchBegan(CCTouch touch, CCEvent touchEvent)
        {

            var layer = tileMap.LayerNamed("Layer 0");

            var location = layer.WorldToParentspace(touch.Location);
            var tileCoordinates = layer.ClosestTileCoordAtNodePosition(location);

            // Convert the tile coordinates position to world coordinates for
            // our outline drawing
            var world = layer.TilePosition(tileCoordinates);


            // Calculate our width and height of the tile
            CCSize texToContentScaling = CCTileMapLayer.DefaultTexelToContentSizeRatios;
            float width = layer.TileTexelSize.Width * texToContentScaling.Width;
            float height = layer.TileTexelSize.Height * texToContentScaling.Height;

            var rect = new CCRect(world.X, world.Y, width, height);

            drawNode.Clear();

            drawNode.Color = CCColor3B.Magenta;
            drawNode.Opacity = 255;

            var center = rect.Center;

            var right = center;
            right.X += width / 2;

            var top = center;
            top.Y += height / 2;

            var left = right;
            left.X -= width;

            var bottom = center;
            bottom.Y -= height / 2;

            // Hightlight our iso tile
            drawNode.DrawPolygon (new CCPoint[] {right, top, left, bottom}, 4, CCColor4B.Transparent, 1, new CCColor4F(CCColor4B.Magenta));

            return true;
        }