public virtual void getPosition(int vertexID, AsPoint position)
        {
            int offset = getOffset(vertexID) + POSITION_OFFSET;

            position.x = mRawData[offset];
            position.y = mRawData[(offset + 1)];
        }
        public virtual void getTexCoords(int vertexID, AsPoint texCoords)
        {
            int offset = getOffset(vertexID) + TEXCOORD_OFFSET;

            texCoords.x = mRawData[offset];
            texCoords.y = mRawData[(offset + 1)];
        }
Example #3
0
 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);
 }
 public virtual AsPoint getPreviousLocation(AsDisplayObject space, AsPoint resultPoint)
 {
     if (resultPoint == null)
     {
         resultPoint = new AsPoint();
     }
     mTarget.get_base().getTransformationMatrix(space, sHelperMatrix);
     return(AsMatrixUtil.transformCoords(sHelperMatrix, mPreviousGlobalX, mPreviousGlobalY, resultPoint));
 }
 public virtual AsPoint getTexCoords(int vertexID, AsPoint resultPoint)
 {
     if (resultPoint == null)
     {
         resultPoint = new AsPoint();
     }
     mVertexData.getTexCoords(vertexID, resultPoint);
     return(resultPoint);
 }
 public static AsPoint transformCoords(AsMatrix matrix, float x, float y, AsPoint resultPoint)
 {
     if (resultPoint == null)
     {
         resultPoint = new AsPoint();
     }
     resultPoint.x = matrix.a * x + matrix.c * y + matrix.tx;
     resultPoint.y = matrix.d * y + matrix.b * x + matrix.ty;
     return(resultPoint);
 }
        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 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 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);
        }
 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 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);
            }
        }
Example #12
0
        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 override AsDisplayObject hitTest(AsPoint localPoint, bool forTouch)
        {
            if (forTouch && (!getVisible() || !getTouchable()))
            {
                return(null);
            }
            float localX      = localPoint.x;
            float localY      = localPoint.y;
            int   childsCount = getNumChildren();
            int   i           = childsCount - 1;

            for (; i >= 0; --i)
            {
                AsDisplayObject child = mChildren[i];
                getTransformationMatrix(child, sHelperMatrix);
                AsGlobal.transformCoords(sHelperMatrix, localX, localY, sHelperPoint);
                AsDisplayObject target = child.hitTest(sHelperPoint, forTouch);
                if (target != null)
                {
                    return(target);
                }
            }
            return(null);
        }
Example #14
0
 public virtual void setTexCoords(int vertexID, AsPoint coords)
 {
     mVertexData.setTexCoords(vertexID, coords.x, coords.y);
     onVertexDataChanged();
 }
 public virtual AsDisplayObject hitTest(AsPoint localPoint)
 {
     return(hitTest(localPoint, false));
 }
 public void copyPixels(AsBitmapData data, AsRectangle asRectangle, AsPoint sOrigin)
 {
     throw new NotImplementedException();
 }
 public virtual AsPoint localToGlobal(AsPoint localPoint)
 {
     return(localToGlobal(localPoint, null));
 }
 public virtual AsPoint globalToLocal(AsPoint globalPoint, AsPoint resultPoint)
 {
     getTransformationMatrix(get_base(), sHelperMatrix);
     sHelperMatrix.invert();
     return(AsMatrixUtil.transformCoords(sHelperMatrix, globalPoint.x, globalPoint.y, resultPoint));
 }
Example #19
0
 public virtual string ToStringOf2d()
 {
     return(AsPoint.ToString());
 }
 public virtual AsPoint globalToLocal(AsPoint globalPoint)
 {
     return(globalToLocal(globalPoint, null));
 }