public override bool TouchBegan(CCTouch t) { this.RemoveAllChildrenWithCleanup(true); var watch = System.Diagnostics.Stopwatch.StartNew(); this.Schedule(dt => { //string svg = "M32,7.174C18.311,7.174,7.174,18.311,7.174,32c0,13.689,11.137,24.826,24.826,24.826c13.689,0,24.826-11.137,24.826-24.826C56.826,18.311,45.689,7.174,32,7.174z M43.075,26.318c0.011,0.246,0.017,0.494,0.017,0.742c0,7.551-5.747,16.257-16.259,16.257c-3.227,0-6.231-0.945-8.759-2.567c0.447,0.053,0.902,0.08,1.363,0.08c2.678,0,5.141-0.914,7.097-2.446c-2.5-0.046-4.611-1.698-5.338-3.969c0.348,0.068,0.707,0.103,1.074,0.103c0.521,0,1.027-0.07,1.506-0.2c-2.614-0.525-4.583-2.834-4.583-5.602c0-0.024,0-0.049,0.001-0.072c0.77,0.427,1.651,0.685,2.587,0.714c-1.532-1.023-2.541-2.773-2.541-4.755c0-1.048,0.281-2.03,0.773-2.874c2.817,3.458,7.029,5.732,11.777,5.972c-0.098-0.419-0.147-0.854-0.147-1.303c0-3.155,2.558-5.714,5.714-5.714c1.643,0,3.128,0.694,4.17,1.804c1.303-0.256,2.525-0.73,3.63-1.387c-0.428,1.335-1.333,2.454-2.514,3.162c1.157-0.138,2.259-0.444,3.282-0.899C45.161,24.508,44.191,25.515,43.075,26.318z"; var sprite = liwq.UIGraphic.Begin(300, 300). AddRectangle(0, 0, 300, 300, liwq.Colors.SkyBlue, liwq.Colors.SkyBlue). //AddEllipse(10, 10, 50, 50, liwq.Colors.Turquoise, liwq.Colors.Turquoise, 4). //AddLine(10, 10, 60, 60, liwq.Colors.Lime, 4). //AddPaths(200, 200, 200, 200, new string[1] { svg }, 0, 0, 64, 64, liwq.Colors.DarkOrange, liwq.Colors.White, 2). //AddSvg(200, 200, 200, 200, liwq.Factory.ReadString("Content/svg/dribbble.svg")). AddSvg(50, 50, 200, 200, liwq.Factory.ReadString(this.svgs[svgIndex++])). AddText(60, 30, System.IO.Path.GetFileNameWithoutExtension(this.svgs[svgIndex]), liwq.Colors.DarkRed, liwq.Colors.DarkRed, MatterHackers.Agg.Font.LiberationSansFont.Instance, 16). EndSprite(); sprite.Position = CCDirector.SharedDirector.WinSize.Center; this.AddChild(sprite); }, 0.2f); watch.Stop(); System.Console.WriteLine(watch.Elapsed); return true; }
public override void TouchEnded(CCTouch touch) { CCPoint touchLocation = touch.Location; CCPoint nodePosition = ConvertToNodeSpace(touchLocation); m_test.MouseUp(); }
public override void TouchMoved(CCTouch touch) { CCPoint touchLocation = touch.Location; CCPoint nodePosition = ConvertToNodeSpace(touchLocation); m_test.MouseMove(new Vector2(nodePosition.X, nodePosition.Y)); }
public override void TouchEnded(CCTouch pTouch, CCEvent pEvent) { if (m_pTrackNode != null) { return; } CCPoint endPos = pTouch.LocationInView; endPos = CCDirector.SharedDirector.ConvertToGl(endPos); float delta = 5.0f; if (Math.Abs(endPos.X - m_beginPos.X) > delta || Math.Abs(endPos.Y - m_beginPos.Y) > delta) { // not click m_beginPos.X = m_beginPos.Y = -1; return; } // decide the trackNode is clicked. CCRect rect; CCPoint point = ConvertTouchToNodeSpaceAr(pTouch); CCLog.Log("KeyboardNotificationLayer:clickedAt(%f,%f)", point.X, point.Y); rect = TextInputTestScene.getRect(m_pTrackNode); CCLog.Log("KeyboardNotificationLayer:TrackNode at(origin:%f,%f, size:%f,%f)", rect.Origin.X, rect.Origin.Y, rect.Size.Width, rect.Size.Height); this.onClickTrackNode(CCRect.CCRectContainsPoint(rect, point)); CCLog.Log("----------------------------------"); }
public override void TouchEnded(CCTouch pTouch, CCEvent pEvent) { if (!Visible) { return; } if (m_pTouches.Count == 1 && !IsTouchMoved) { int index; CCTableViewCell cell; CCPoint point = Container.ConvertTouchToNodeSpace(pTouch); if (m_eVordering == CCTableViewVerticalFillOrder.FillTopDown) { CCSize cellSize = m_pDataSource.CellSizeForTable(this); point.Y -= cellSize.Height; } index = _indexFromOffset(point); cell = _cellWithIndex(index); if (cell != null) { m_pTableViewDelegate.TableCellTouched(this, cell); } } base.TouchEnded(pTouch, pEvent); }
// CCLayer public override bool TouchBegan(CCTouch pTouch, CCEvent pEvent) { CCLog.Log("++++++++++++++++++++++++++++++++++++++++++++"); m_beginPos = pTouch.LocationInView; m_beginPos = CCDirector.SharedDirector.ConvertToGl(m_beginPos); return(true); }
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 virtual bool TouchBegan(CCTouch touch) { if (m_state != PaddleState.kPaddleStateUngrabbed) return false; if (!containsTouchLocation(touch)) return false; m_state = PaddleState.kPaddleStateGrabbed; return true; }
public void ExcuteScriptTouchHandler(int eventType, CCTouch pTouch) { if (m_pEventTypeFuncMap != null && CCScriptEngineManager.SharedScriptEngineManager.ScriptEngine != null) { CCScriptEngineManager.SharedScriptEngineManager.ScriptEngine.ExecuteTouchEvent((m_pEventTypeFuncMap)[eventType], pTouch); } }
public CCPoint LocationFromTouch(CCTouch touch) { CCPoint touchLocation = touch.Location; // Get the touch position touchLocation = ConvertToNodeSpace(touchLocation); // Convert to the node space of this class return(touchLocation); }
/** * 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.Location; // Get the touch position touchLocation = Parent.ConvertToNodeSpace(touchLocation); // Convert to the node space of this class return(touchLocation); }
public override void TouchCancelled(CCTouch touch) { Debug.Assert(m_eState == CCMenuState.TrackingTouch, "[Menu ccTouchCancelled] -- invalid state"); if (m_pSelectedItem != null) { m_pSelectedItem.Unselected(); } m_eState = CCMenuState.Waiting; }
public override void TouchMoved(CCTouch touch, CCEvent pEvent) { if (!Visible) { return; } if (m_pTouches.Contains(touch)) { if (m_pTouches.Count == 1 && m_bDragging) { // scrolling m_bTouchMoved = true; CCPoint frameOriginal = Parent.ConvertToWorldSpace(Position); var frame = new CCRect(frameOriginal.X, frameOriginal.Y, m_tViewSize.Width, m_tViewSize.Height); CCPoint newPoint = ConvertTouchToNodeSpace(m_pTouches[0]); CCPoint moveDistance = newPoint - m_tTouchPoint; m_tTouchPoint = newPoint; if (frame.ContainsPoint(ConvertToWorldSpace(newPoint))) { switch (m_eDirection) { case CCScrollViewDirection.Vertical: moveDistance = new CCPoint(0.0f, moveDistance.Y); break; case CCScrollViewDirection.Horizontal: moveDistance = new CCPoint(moveDistance.X, 0.0f); break; } m_pContainer.Position = m_pContainer.Position + moveDistance; CCPoint maxInset = m_fMaxInset; CCPoint minInset = m_fMinInset; //check to see if offset lies within the inset bounds float newX = Math.Min(m_pContainer.Position.X, maxInset.X); newX = Math.Max(newX, minInset.X); float newY = Math.Min(m_pContainer.Position.Y, maxInset.Y); newY = Math.Max(newY, minInset.Y); m_tScrollDistance = moveDistance - new CCPoint(newX - m_pContainer.Position.X, newY - m_pContainer.Position.Y); SetContentOffset(new CCPoint(newX, newY), false); } } else if (m_pTouches.Count == 2 && !m_bDragging) { float len = CCPoint.Distance(m_pContainer.ConvertTouchToNodeSpace(m_pTouches[0]), m_pContainer.ConvertTouchToNodeSpace(m_pTouches[1])); ZoomScale = ZoomScale * len / m_fTouchLength; } } }
public override void TouchEnded(CCTouch pTouch) { var pos = ConvertTouchToNodeSpace(pTouch); if (pos.X >= 0 && pos.X < ContentSize.Width && pos.Y >= 0 && pos.Y <= ContentSize.Height) { Edit(); } }
/** * 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 receiver�s rect. */ public virtual bool IsTouchInside(CCTouch touch) { CCPoint touchLocation = touch.Location; touchLocation = Parent.ConvertToNodeSpace(touchLocation); CCRect bBox = BoundingBox; return(bBox.ContainsPoint(touchLocation)); }
public override void TouchEnded(CCTouch touch, CCEvent e) { Debug.Assert(m_eState == CCMenuState.TrackingTouch, "[Menu TouchEnded] -- invalid state"); if (m_pSelectedItem != null) { m_pSelectedItem.Unselected(); m_pSelectedItem.Activate(); } m_eState = CCMenuState.Waiting; }
public override void TouchMoved(CCTouch pTouch, CCEvent pEvent) { CCPoint location = LocationFromTouch(pTouch); location = new CCPoint(location.X - m_fInitialTouchXPosition, 0); m_bMoved = true; m_pSwitchSprite.SliderXPosition = location.X; }
public override bool TouchBegan(CCTouch pTouch) { var pos = ConvertTouchToNodeSpace(pTouch); if (pos.X >= 0 && pos.X < ContentSize.Width && pos.Y >= 0 && pos.Y <= ContentSize.Height) { return(true); } return(false); }
public override void TouchMoved(CCTouch pTouch) { CCPoint location = LocationFromTouch(pTouch); location = new CCPoint(location.X - _initialTouchXPosition, 0); _moved = true; _switchSprite.SliderXPosition = location.X; }
public override void TouchMoved(CCTouch pTouch) { // 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 void TouchMoved(CCTouch touch) { var touchLocation = touch.Location; var prevLocation = touch.PreviousLocation; CCPoint diff = touchLocation - prevLocation; CCNode node = GetChildByTag(kTagTileMap); // (int) KTag.kTagNode); CCPoint currentPos = node.Position; node.Position = currentPos + diff; }
public override bool TouchBegan(CCTouch touch) { 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; }
public override bool TouchBegan(CCTouch touch) { if (!IsTouchInside(touch) || !Enabled || !Visible) { return(false); } CCPoint location = LocationFromTouch(touch); SliderBegan(location); return(true); }
public override bool TouchBegan(CCTouch touch) { if (!IsTouchInside(touch) || !Enabled || !Visible) { return(false); } _previousLocation = GetTouchLocation(touch); PotentiometerBegan(_previousLocation); return(true); }
public override void TouchCancelled(CCTouch touch, CCEvent pEvent) { if (!Visible) { return; } m_pTouches.Remove(touch); if (m_pTouches.Count == 0) { m_bDragging = false; m_bTouchMoved = false; } }
public override void TouchCancelled(CCTouch touch) { if (!Visible) { return; } _touches.Remove(touch); if (_touches.Count == 0) { _dragging = false; _touchMoved = false; } }
public override bool IsTouchInside(CCTouch touch) { CCPoint touchLocation = touch.Location; touchLocation = Parent.ConvertToNodeSpace(touchLocation); CCRect rect = BoundingBox; rect.Size.Width += _thumbSprite.ContentSize.Width; rect.Origin.X -= _thumbSprite.ContentSize.Width / 2; return(rect.ContainsPoint(touchLocation)); }
public override bool TouchBegan(CCTouch touch) { if (!Enabled || !Visible) { return(false); } // Get the touch location CCPoint touchLocation = GetTouchLocation(touch); // Check the touch position on the slider return(CheckSliderPosition(touchLocation)); }
//events public override bool TouchBegan(CCTouch pTouch) { if (!IsTouchInside(pTouch) || !Enabled) { return(false); } m_eState = CCControlState.Highlighted; m_isPushed = true; Highlighted = true; SendActionsForControlEvents(CCControlEvent.TouchDown); return(true); }
public override void TouchCancelled(CCTouch touch) { base.TouchCancelled(touch); if (m_pTouchedCell != null) { if (m_pTableViewDelegate != null) { m_pTableViewDelegate.TableCellUnhighlight(this, m_pTouchedCell); } m_pTouchedCell = null; } }
public override void TouchMoved(CCTouch touch, CCEvent pEvent) { base.TouchMoved(touch, pEvent); if (m_pTouchedCell != null && IsTouchMoved) { if (m_pTableViewDelegate != null) { m_pTableViewDelegate.TableCellUnhighlight(this, m_pTouchedCell); } m_pTouchedCell = null; } }
public override void TouchMoved(CCTouch touch) { base.TouchMoved(touch); if (_touchedCell != null && IsTouchMoved) { if (_tableViewDelegate != null) { _tableViewDelegate.TableCellUnhighlight(this, _touchedCell); } _touchedCell = null; } }
public override void TouchMoved(CCTouch touch, CCEvent event_) { CCPoint touchLocation = touch.LocationInView; CCPoint prevLocation = touch.PreviousLocationInView; touchLocation = CCDirector.SharedDirector.ConvertToGl(touchLocation); prevLocation = CCDirector.SharedDirector.ConvertToGl(prevLocation); CCPoint diff = touchLocation - prevLocation; CCNode node = GetChildByTag(kTagTileMap); // (int) KTag.kTagNode); CCPoint currentPos = node.Position; node.Position = currentPos + diff; }
public override void TouchEnded(CCTouch pTouch, CCEvent pEvent) { CCPoint location = LocationFromTouch(pTouch); m_pSwitchSprite.ThumbSprite.Color = new CCColor3B(255, 255, 255); if (HasMoved()) { SetOn(!(location.X < m_pSwitchSprite.ContentSize.Width / 2), true); } else { SetOn(!m_bOn, true); } }
public override void TouchCancelled(CCTouch pTouch) { CCPoint location = LocationFromTouch(pTouch); _switchSprite.ThumbSprite.Color = new CCColor3B(255, 255, 255); if (HasMoved()) { SetOn(!(location.X < _switchSprite.ContentSize.Width / 2), true); } else { SetOn(!_on, true); } }
public override void TouchMoved(CCTouch touch) { // If it weren't for the TouchDispatcher, you would need to keep a reference // to the touch from touchBegan and check that the current touch is the same // as that one. // Actually, it would be even more complicated since in the Cocos dispatcher // you get CCSets instead of 1 UITouch, so you'd need to loop through the set // in each touchXXX method. Debug.Assert(m_state == PaddleState.kPaddleStateGrabbed, "Paddle - Unexpected state!"); var touchPoint = touch.Location; base.Position = new CCPoint(touchPoint.X, base.Position.Y); }
protected virtual CCPoint LocationFromTouch(CCTouch touch) { CCPoint touchLocation = touch.Location; // Get the touch position touchLocation = ConvertToNodeSpace(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); }
public override void TouchEnded(CCTouch pTouch, CCEvent pEvent) { m_eState = CCControlState.Normal; m_isPushed = false; Highlighted = false; if (IsTouchInside(pTouch)) { SendActionsForControlEvents(CCControlEvent.TouchUpInside); } else { SendActionsForControlEvents(CCControlEvent.TouchUpOutside); } }
public override bool TouchBegan(CCTouch touch) { if (m_eState != CCMenuState.Waiting || !m_bVisible || !m_bEnabled) { return false; } for (CCNode c = m_pParent; c != null; c = c.Parent) { if (c.Visible == false) { return false; } } m_pSelectedItem = ItemForTouch(touch); if (m_pSelectedItem != null) { m_eState = CCMenuState.TrackingTouch; m_pSelectedItem.Selected(); return true; } return false; }
public override void TouchCancelled(CCTouch touch) { numberOfTouchesC++; }
public override void TouchEnded(CCTouch touch) { numberOfTouchesE++; }
public override void TouchMoved(CCTouch touch) { numberOfTouchesM++; }
public override bool TouchBegan(CCTouch touch, CCEvent event_) { return true; }
public override void TouchCancelled(CCTouch touch) { }
public override bool TouchBegan(CCTouch touch) { return true; }
//events public override bool TouchBegan(CCTouch pTouch) { if (!IsTouchInside(pTouch) || !Enabled) { return false; } m_eState = CCControlState.Highlighted; m_isPushed = true; Highlighted = true; SendActionsForControlEvents(CCControlEvent.TouchDown); return true; }
public override void TouchMoved(CCTouch pTouch) { //nothing }
public override void TouchMoved(CCTouch touch) { Debug.Assert(m_eState == CCMenuState.TrackingTouch, "[Menu TouchMoved] -- invalid state"); CCMenuItem currentItem = ItemForTouch(touch); if (currentItem != m_pSelectedItem) { if (m_pSelectedItem != null) { m_pSelectedItem.Unselected(); } m_pSelectedItem = currentItem; if (m_pSelectedItem != null) { m_pSelectedItem.Selected(); } } }
public CCPoint ConvertTouchToNodeSpaceAr(CCTouch touch) { CCPoint point = touch.LocationInView; point = CCDirector.SharedDirector.ConvertToGl(point); return ConvertToNodeSpaceAr(point); }
protected virtual CCMenuItem ItemForTouch(CCTouch touch) { CCPoint touchLocation = touch.Location; if (m_pChildren != null && m_pChildren.count > 0) { for (int i = m_pChildren.count-1; i >= 0; i--) { var pChild = m_pChildren.Elements[i] as CCMenuItem; if (pChild != null && pChild.Visible && pChild.Enabled) { CCPoint local = pChild.ConvertToNodeSpace(touchLocation); CCRect r = pChild.Rectangle; r.Origin = CCPoint.Zero; if (r.ContainsPoint(local)) { return pChild; } } } } return null; }
public override bool TouchBegan(CCTouch touch) { numberOfTouchesB++; return true; }
public override void TouchMoved(CCTouch pTouch) { if (!Enabled || !IsPushed || Selected) { if (Highlighted) { Highlighted = false; } return; } bool isTouchMoveInside = IsTouchInside(pTouch); if (isTouchMoveInside && !m_bHighlighted) { m_eState = CCControlState.Highlighted; Highlighted = true; SendActionsForControlEvents(CCControlEvent.TouchDragEnter); } else if (isTouchMoveInside && Highlighted) { SendActionsForControlEvents(CCControlEvent.TouchDragInside); } else if (!isTouchMoveInside && Highlighted) { m_eState = CCControlState.Normal; Highlighted = false; SendActionsForControlEvents(CCControlEvent.TouchDragExit); } else if (!isTouchMoveInside && !Highlighted) { SendActionsForControlEvents(CCControlEvent.TouchDragOutside); } }
public override void TouchCancelled(CCTouch pTouch) { //nothing }
public override void TouchEnded(CCTouch touch) { }
public override void TouchEnded(CCTouch pTouch) { m_eState = CCControlState.Normal; m_isPushed = false; Highlighted = false; if (IsTouchInside(pTouch)) { if (OnButtonTap != null) { OnButtonTap(this); } SendActionsForControlEvents(CCControlEvent.TouchUpInside); } else { SendActionsForControlEvents(CCControlEvent.TouchUpOutside); } }
public override void TouchMoved(CCTouch touch) { CCPoint diff = touch.Delta; CCNode node = GetChildByTag(kTagTileMap); CCPoint currentPos = node.Position; node.Position = currentPos + diff; }
public override void TouchCancelled(CCTouch pTouch) { m_eState = CCControlState.Normal; m_isPushed = false; Highlighted = false; SendActionsForControlEvents(CCControlEvent.TouchCancel); }