Beispiel #1
0
        public AsPoint transformPoint(AsPoint point)
        {
            float nx = point.x * a + point.y * c + tx;
            float ny = point.x * b + point.y * d + ty;

            return(new AsPoint(nx, ny));
        }
Beispiel #2
0
        public AsPoint deltaTransformPoint(AsPoint point)
        {
            float nx = point.x * a + point.y * c;
            float ny = point.x * b + point.y * d;

            return(new AsPoint(nx, ny));
        }
Beispiel #3
0
        public static float distance(AsPoint pt1, AsPoint pt2)
        {
            float dx = pt1.x - pt2.x;
            float dy = pt1.y - pt2.y;

            return(AsMath.sqrt(dx * dx + dy * dy));
        }
 public virtual AsPoint getTexCoords(int vertexID, AsPoint resultPoint)
 {
     if(resultPoint == null)
     {
         resultPoint = new AsPoint();
     }
     mVertexData.getTexCoords(vertexID, resultPoint);
     return resultPoint;
 }
 public AsTouchMarker()
 {
     mCenter = new AsPoint();
     mTexture = createTexture();
     int i = 0;
     for (; i < 2; ++i)
     {
         AsImage marker = new AsImage(mTexture);
         marker.setPivotX(mTexture.getWidth() / 2);
         marker.setPivotY(mTexture.getHeight() / 2);
         marker.setTouchable(false);
         addChild(marker);
     }
 }
 public override AsDisplayObject hitTest(AsPoint localPoint, bool forTouch)
 {
     if(forTouch && (!getVisible() || !getTouchable()))
     {
         return null;
     }
     if(localPoint.x < 0 || localPoint.x > mWidth || localPoint.y < 0 || localPoint.y > mHeight)
     {
         return null;
     }
     AsDisplayObject target = base.hitTest(localPoint, forTouch);
     if(target == null)
     {
         target = this;
     }
     return target;
 }
 public virtual AsPoint localToGlobal(AsPoint localPoint)
 {
     sTargetMatrix.identity();
     AsDisplayObject currentObject = this;
     while(currentObject != null)
     {
         currentObject.getTransformationMatrix(currentObject.mParent, sHelperMatrix);
         sTargetMatrix.concat(sHelperMatrix);
         currentObject = currentObject.getParent();
     }
     return sTargetMatrix.transformPoint(localPoint);
 }
 public void copyPixels(AsBitmapData data, AsRectangle asRectangle, AsPoint sOrigin)
 {
     throw new NotImplementedException();
 }
 private void processTouch(int touchID, String phase, float globalX, float globalY, float pressure, float width, float height)
 {
     AsPoint position = new AsPoint(globalX, globalY);
     AsTouch touch = getCurrentTouch(touchID);
     if(touch == null)
     {
         touch = new AsTouch(touchID, globalX, globalY, phase, null);
         addCurrentTouch(touch);
     }
     touch.setPosition(globalX, globalY);
     touch.setPhase(phase);
     touch.setTimestamp(mElapsedTime);
     touch.setPressure(pressure);
     touch.setSize(width, height);
     if(phase == AsTouchPhase.HOVER || phase == AsTouchPhase.BEGAN)
     {
         touch.setTarget(mStage.hitTest(position, true));
     }
     if(phase == AsTouchPhase.BEGAN)
     {
         processTap(touch);
     }
 }
 public virtual AsPoint getMovement(AsDisplayObject space, AsPoint resultPoint)
 {
     if(resultPoint == null)
     {
         resultPoint = new AsPoint();
     }
     getLocation(space, resultPoint);
     float x = resultPoint.x;
     float y = resultPoint.y;
     getPreviousLocation(space, resultPoint);
     resultPoint.setTo(x - resultPoint.x, y - resultPoint.y);
     return resultPoint;
 }
Beispiel #11
0
 public virtual void setTopLeft(AsPoint _value)
 {
     x = _value.x;
     y = _value.y;
 }
 public override AsDisplayObject hitTest(AsPoint localPoint, bool forTouch)
 {
     if(forTouch && (!getVisible() || !getTouchable()))
     {
         return null;
     }
     float localX = localPoint.x;
     float localY = localPoint.y;
     int numChildren = (int)(mChildren.getLength());
     int i = numChildren - 1;
     for (; i >= 0; --i)
     {
         AsDisplayObject child = mChildren[i];
         getTransformationMatrix(child, sHelperMatrix);
         AsMatrixUtil.transformCoords(sHelperMatrix, localX, localY, sHelperPoint);
         AsDisplayObject target = child.hitTest(sHelperPoint, forTouch);
         if(target != null)
         {
             return target;
         }
     }
     return null;
 }
 public virtual bool containsPoint(AsPoint point)
 {
     throw new AsNotImplementedError();
 }
 public virtual void setTopLeft(AsPoint _value)
 {
     x = _value.x;
     y = _value.y;
 }
 public virtual void setSize(AsPoint _value)
 {
     width = _value.x;
     height = _value.y;
 }
Beispiel #16
0
 public void transformPointCords(float x, float y, AsPoint point)
 {
     point.x = x * a + y * c + tx;
     point.y = x * b + y * d + ty;
 }
Beispiel #17
0
        public static AsPoint interpolate(AsPoint pt1, AsPoint pt2, float ratio)
        {
            float invRatio = 1.0f - ratio;

            return(new AsPoint(invRatio * pt1.x + ratio * pt2.x, invRatio * pt1.y + ratio * pt2.y));
        }
Beispiel #18
0
 public static float distance(AsPoint pt1, AsPoint pt2)
 {
     float dx = (pt1.x - pt2.x);
     float dy = (pt1.y - pt2.y);
     return AsMath.sqrt(((dx * dx) + (dy * dy)));
 }
Beispiel #19
0
 public virtual void offsetPoint(AsPoint point)
 {
     throw new AsNotImplementedError();
 }
Beispiel #20
0
 public static AsPoint interpolate(AsPoint pt1, AsPoint pt2, float ratio)
 {
     float invRatio = (1.0f - ratio);
     return new AsPoint(((invRatio * pt1.x) + (ratio * pt2.x)), ((invRatio * pt1.y) + (ratio * pt2.y)));
 }
Beispiel #21
0
 public virtual bool containsPoint(AsPoint point)
 {
     throw new AsNotImplementedError();
 }
Beispiel #22
0
 public virtual bool equals(AsPoint toCompare)
 {
     return (((toCompare != null) && (toCompare.x == x)) && (toCompare.y == y));
 }
 public virtual AsPoint _add(AsPoint v)
 {
     return new AsPoint(x + v.x, y + v.y);
 }
Beispiel #24
0
 public virtual AsPoint subtract(AsPoint v)
 {
     return new AsPoint((x - v.x), (y - v.y));
 }
 public virtual AsPoint getLocation(AsDisplayObject space, AsPoint resultPoint)
 {
     if(resultPoint == null)
     {
         resultPoint = new AsPoint();
     }
     mTarget.get_base().getTransformationMatrix(space, sHelperMatrix);
     return AsMatrixUtil.transformCoords(sHelperMatrix, mGlobalX, mGlobalY, resultPoint);
 }
Beispiel #26
0
 public virtual AsPoint _add(AsPoint v)
 {
     return new AsPoint((x + v.x), (y + v.y));
 }
 private void processTouch(int touchID, String phase, float globalX, float globalY)
 {
     AsPoint position = new AsPoint(globalX, globalY);
     AsTouch touch = getCurrentTouch(touchID);
     if((touch == null))
     {
         touch = new AsTouch(touchID, globalX, globalY, phase, null);
         addCurrentTouch(touch);
     }
     touch.setPosition(globalX, globalY);
     touch.setPhase(phase);
     touch.setTimestamp((mElapsedTime + mOffsetTime));
     if(((phase == AsTouchPhase.HOVER) || (phase == AsTouchPhase.BEGAN)))
     {
         touch.setTarget(mStage.hitTest(position, true));
     }
     if((phase == AsTouchPhase.BEGAN))
     {
         processTap(touch);
     }
 }
 public AsPoint deltaTransformPoint(AsPoint point)
 {
     float nx = point.x * a + point.y * c;
     float ny = point.x * b + point.y * d;
     return new AsPoint(nx, ny);
 }
 public virtual AsDisplayObject hitTest(AsPoint localPoint, bool forTouch)
 {
     if(forTouch && (!mVisible || !mTouchable))
     {
         return null;
     }
     if(getBounds(this, sHelperRect).containsPoint(localPoint))
     {
         return this;
     }
     else
     {
         return null;
     }
 }
 public AsPoint transformPoint(AsPoint point)
 {
     float nx = point.x * a + point.y * c + tx;
     float ny = point.x * b + point.y * d + ty;
     return new AsPoint(nx, ny);
 }
Beispiel #31
0
 public virtual AsPoint _add(AsPoint v)
 {
     return(new AsPoint(x + v.x, y + v.y));
 }
 public void transformPointCords(float x, float y, AsPoint point)
 {
     point.x = x * a + y * c + tx;
     point.y = x * b + y * d + ty;
 }
Beispiel #33
0
 public virtual bool equals(AsPoint toCompare)
 {
     return(toCompare != null && toCompare.x == x && toCompare.y == y);
 }
 public static AsPoint transformCoords(AsMatrix matrix, float x, float y, AsPoint resultPoint)
 {
     if (resultPoint == null) resultPoint = new AsPoint();
     matrix.transformPointCords(x, y, resultPoint);
     return resultPoint;
 }
Beispiel #35
0
 public virtual AsPoint subtract(AsPoint v)
 {
     return(new AsPoint(x - v.x, y - v.y));
 }
Beispiel #36
0
 public override AsDisplayObject hitTest(AsPoint localPoint, bool forTouch)
 {
     if((forTouch && (!(getVisible()) || !(getTouchable()))))
     {
         return null;
     }
     AsDisplayObject target = base.hitTest(localPoint, forTouch);
     if((target == null))
     {
         target = this;
     }
     return target;
 }
 public virtual AsDisplayObject hitTest(AsPoint localPoint)
 {
     return hitTest(localPoint, false);
 }
 public static float distance(AsPoint pt1, AsPoint pt2)
 {
     float dx = pt1.x - pt2.x;
     float dy = pt1.y - pt2.y;
     return AsMath.sqrt(dx * dx + dy * dy);
 }
Beispiel #39
0
 public virtual void setSize(AsPoint _value)
 {
     width  = _value.x;
     height = _value.y;
 }
 public static AsPoint interpolate(AsPoint pt1, AsPoint pt2, float ratio)
 {
     float invRatio = 1.0f - ratio;
     return new AsPoint(invRatio * pt1.x + ratio * pt2.x, invRatio * pt1.y + ratio * pt2.y);
 }
Beispiel #41
0
 public virtual void setBottomRight(AsPoint _value)
 {
     throw new AsNotImplementedError();
 }
 public virtual bool equals(AsPoint toCompare)
 {
     return toCompare != null && toCompare.x == x && toCompare.y == y;
 }
Beispiel #43
0
 public virtual void inflatePoint(AsPoint point)
 {
     throw new AsNotImplementedError();
 }
 public virtual AsPoint subtract(AsPoint v)
 {
     return new AsPoint(x - v.x, y - v.y);
 }