public virtual AsVector <AsTexture> getTextures(String prefix) { AsVector <AsTexture> textures = new AsVector <AsTexture>(); AsVector <String> names = new AsVector <String>(); AsDictionary __names_ = mTextureRegions; if (__names_ != null) { foreach (String name in __names_) { if (AsString.indexOf(name, prefix) == 0) { names.push(name); } } } names.sort(AsArray.CASEINSENSITIVE); AsVector <String> __names_ = names; if (__names_ != null) { foreach (String name in __names_) { textures.push(getTexture(name)); } } return(textures); }
private void processTap(AsTouch touch) { AsTouch nearbyTap = null; float minSqDist = MULTITAP_DISTANCE * MULTITAP_DISTANCE; AsVector <AsTouch> __taps_ = mLastTaps; if (__taps_ != null) { foreach (AsTouch tap in __taps_) { float sqDist = AsMath.pow(tap.getGlobalX() - touch.getGlobalX(), 2) + AsMath.pow(tap.getGlobalY() - touch.getGlobalY(), 2); if (sqDist <= minSqDist) { nearbyTap = tap; break; } } } if (nearbyTap != null) { touch.setTapCount(nearbyTap.getTapCount() + 1); mLastTaps.splice(mLastTaps.indexOf(nearbyTap), (uint)(1)); } else { touch.setTapCount(1); } mLastTaps.push(touch.clone()); }
public AsFragmentFilter(int numPasses, float resolution) { if (AsCapabilities.getIsDebugger() && AsGlobal.getQualifiedClassName(this) == "starling.filters::FragmentFilter") { throw new AsAbstractClassError(); } if (numPasses < 1) { throw new AsArgumentError("At least one pass is required."); } mNumPasses = numPasses; mMarginX = mMarginY = 0.0f; mOffsetX = mOffsetY = 0; mResolution = resolution; mMode = AsFragmentFilterMode.REPLACE; mVertexData = new AsVertexData(4); mVertexData.setTexCoords(0, 0, 0); mVertexData.setTexCoords(1, 1, 0); mVertexData.setTexCoords(2, 0, 1); mVertexData.setTexCoords(3, 1, 1); mIndexData = new AsVector <uint>(); mIndexData.setOwnProperty("_fixed", true); createPrograms(); AsStarling.getCurrent().getStage3D().addEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false, 0, true); }
public virtual void removeEventListener(String type, AsEventListenerCallback listener, bool useCapture) { if (mEventListeners != null) { AsVector <AsEventListenerCallback> listeners = (AsVector <AsEventListenerCallback>)(mEventListeners[type]); if (listeners != null) { AsVector <AsEventListenerCallback> remainListeners = new AsVector <AsEventListenerCallback>(); AsVector <AsEventListenerCallback> __eventListeners_ = listeners; if (__eventListeners_ != null) { foreach (AsEventListenerCallback eventListener in __eventListeners_) { if (eventListener != listener) { remainListeners.push(eventListener); } } } if (remainListeners.getLength() > 0) { mEventListeners[type] = remainListeners; } else { mEventListeners.remove(type); } } } }
private void updatePassTextures(int width, int height, float scale) { int numPassTextures = mNumPasses > 1 ? 2 : 1; bool needsUpdate = mPassTextures == null || mPassTextures.getLength() != numPassTextures || mPassTextures[0].getWidth() != width || mPassTextures[0].getHeight() != height; if (needsUpdate) { if (mPassTextures != null) { AsVector <AsTexture> __textures_ = mPassTextures; if (__textures_ != null) { foreach (AsTexture texture in __textures_) { texture.dispose(); } } mPassTextures.setLength(numPassTextures); } else { mPassTextures = new AsVector <AsTexture>(numPassTextures); } int i = 0; for (; i < numPassTextures; ++i) { mPassTextures[i] = AsTexture.empty(width, height, PMA, true, scale); } } }
public virtual void bubbleEvent(AsEvent _event) { AsVector<AsEventDispatcher> chain = null; AsDisplayObject element = this as AsDisplayObject; int length = 1; if(sBubbleChains.getLength() > 0) { chain = (AsVector<AsEventDispatcher>)(sBubbleChains.pop()); chain[0] = element; } else { chain = new AsVector<AsEventDispatcher>(); } while((element = element.getParent()) != null) { chain[length++] = element; } int i = 0; for (; i < length; ++i) { bool stopPropagation = chain[i].invokeEvent(_event); if(stopPropagation) { break; } } chain.setLength(0); sBubbleChains.push(chain); }
public override void render(AsRenderSupport support, float parentAlpha) { if (mFlattenedContents != null || mFlattenRequested) { if (mFlattenedContents == null) { mFlattenedContents = new AsVector <AsQuadBatch>(); } if (mFlattenRequested) { AsQuadBatch.compile(this, mFlattenedContents); mFlattenRequested = false; } float alpha = parentAlpha * this.getAlpha(); int numBatches = (int)(mFlattenedContents.getLength()); AsMatrix mvpMatrix = support.getMvpMatrix(); support.finishQuadBatch(); support.raiseDrawCount((uint)(numBatches)); int i = 0; for (; i < numBatches; ++i) { AsQuadBatch quadBatch = mFlattenedContents[i]; String blendMode = quadBatch.getBlendMode() == AsBlendMode.AUTO ? support.getBlendMode() : quadBatch.getBlendMode(); quadBatch.renderCustom(mvpMatrix, alpha, blendMode); } } else { base.render(support, parentAlpha); } }
public virtual void testVectorQaulifiedTernaryCast() { Object obj = new AsVector <bc.test.vectors.AsVectorsTest>(); AsVector <bc.test.vectors.AsVectorsTest> vector = obj != null ? (AsVector <bc.test.vectors.AsVectorsTest>)obj : null; vector = obj == null ? null : (AsVector <bc.test.vectors.AsVectorsTest>)obj; }
public virtual AsVector<AsTexture> getTextures(String prefix) { AsVector<AsTexture> textures = new AsVector<AsTexture>(); AsVector<String> names = new AsVector<String>(); AsDictionary __names_ = mTextureRegions; if (__names_ != null) { foreach (String name in __names_) { if(AsString.indexOf(name, prefix) == 0) { names.push(name); } } } names.sort(AsArray.CASEINSENSITIVE); AsVector<String> __names_ = names; if (__names_ != null) { foreach (String name in __names_) { textures.push(getTexture(name)); } } return textures; }
public virtual void testVectorIndexer() { AsVector <String> v = new AsVector <String>(); v[0] = "a"; String val = v[0]; }
public AsFragmentFilter(int numPasses, float resolution) { if(AsCapabilities.getIsDebugger() && AsGlobal.getQualifiedClassName(this) == "starling.filters::FragmentFilter") { throw new AsAbstractClassError(); } if(numPasses < 1) { throw new AsArgumentError("At least one pass is required."); } mNumPasses = numPasses; mMarginX = mMarginY = 0.0f; mOffsetX = mOffsetY = 0; mResolution = resolution; mMode = AsFragmentFilterMode.REPLACE; mVertexData = new AsVertexData(4); mVertexData.setTexCoords(0, 0, 0); mVertexData.setTexCoords(1, 1, 0); mVertexData.setTexCoords(2, 0, 1); mVertexData.setTexCoords(3, 1, 1); mIndexData = new AsVector<uint>(); mIndexData.setOwnProperty("_fixed", true); createPrograms(); AsStarling.getCurrent().getStage3D().addEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false, 0, true); }
public AsColorMatrixFilter(AsVector<float> matrix) { mUserMatrix = new AsVector<float>(); mShaderMatrix = new AsVector<float>(); mUserMatrix(IDENTITY); updateShaderMatrix(); }
public AsColorMatrixFilter(AsVector <float> matrix) { mUserMatrix = new AsVector <float>(); mShaderMatrix = new AsVector <float>(); mUserMatrix(IDENTITY); updateShaderMatrix(); }
private void onContextCreated(Object _event) { mVertexBuffer = null; mIndexBuffer = null; mPassTextures = null; createPrograms(); }
private void onInterruption(Object _event) { AsTouch touch = null; String phase = null; AsVector <AsTouch> __touchs_ = mCurrentTouches; if (__touchs_ != null) { foreach (AsTouch touch in __touchs_) { if (touch.getPhase() == AsTouchPhase.BEGAN || touch.getPhase() == AsTouchPhase.MOVED || touch.getPhase() == AsTouchPhase.STATIONARY) { touch.setPhase(AsTouchPhase.ENDED); } } } AsTouchEvent touchEvent = new AsTouchEvent(AsTouchEvent.TOUCH, mCurrentTouches, mShiftDown, mCtrlDown); AsVector <AsTouch> __touchs_ = mCurrentTouches; if (__touchs_ != null) { foreach (AsTouch touch in __touchs_) { touch.dispatchEvent(touchEvent); } } mCurrentTouches.setLength(0); }
public virtual void testVectorCreation() { AsVector<String> v = new AsVector<String>(); v = new AsVector<String>(); v = new AsVector<String>(); v = AsVector<String>.create("a", "b", "c"); }
public void transformVectors(AsVector <float> vin, AsVector <float> vout) { int len = (int)(vin.getLength()); if (((len % 3) != 0)) { throw new AsArgumentError(); } if ((len > vout.getLength())) { throw new AsArgumentError(); } int i = 0; for (; (i < len); i = (i + 3)) { float x = vin[i]; float y = vin[i + 1]; float z = vin[i + 2]; vout[i] = x * internalMatrix.M11 + y * internalMatrix.M21 + z * internalMatrix.M31 + internalMatrix.M41; vout[i + 1] = x * internalMatrix.M12 + y * internalMatrix.M22 + z * internalMatrix.M32 + internalMatrix.M42; vout[i + 2] = x * internalMatrix.M13 + y * internalMatrix.M23 + z * internalMatrix.M33 + internalMatrix.M43; } }
public virtual void bubbleEvent(AsEvent _event) { AsVector <AsEventDispatcher> chain = null; AsDisplayObject element = this as AsDisplayObject; int length = 1; if (sBubbleChains.getLength() > 0) { chain = (AsVector <AsEventDispatcher>)(sBubbleChains.pop()); chain[0] = element; } else { chain = new AsVector <AsEventDispatcher>(); } while ((element = element.getParent()) != null) { chain[length++] = element; } int i = 0; for (; i < length; ++i) { bool stopPropagation = chain[i].invokeEvent(_event); if (stopPropagation) { break; } } chain.setLength(0); sBubbleChains.push(chain); }
private void init(AsVector <AsTexture> textures, float fps) { if (fps <= 0) { throw new AsArgumentError("Invalid fps: " + fps); } int numFrames = (int)(textures.getLength()); mDefaultFrameDuration = 1.0f / fps; mLoop = true; mPlaying = true; mCurrentTime = 0.0f; mCurrentFrame = 0; mTotalTime = mDefaultFrameDuration * numFrames; mTextures = textures.concat(); mSounds = new AsVector <AsSound>(numFrames); mDurations = new AsVector <float>(numFrames); mStartTimes = new AsVector <float>(numFrames); int i = 0; for (; i < numFrames; ++i) { mDurations[i] = mDefaultFrameDuration; mStartTimes[i] = i * mDefaultFrameDuration; } }
public override void render(AsRenderSupport support, float parentAlpha) { if(mFlattenedContents != null || mFlattenRequested) { if(mFlattenedContents == null) { mFlattenedContents = new AsVector<AsQuadBatch>(); } if(mFlattenRequested) { AsQuadBatch.compile(this, mFlattenedContents); mFlattenRequested = false; } float alpha = parentAlpha * this.getAlpha(); int numBatches = (int)(mFlattenedContents.getLength()); AsMatrix mvpMatrix = support.getMvpMatrix(); support.finishQuadBatch(); support.raiseDrawCount((uint)(numBatches)); int i = 0; for (; i < numBatches; ++i) { AsQuadBatch quadBatch = mFlattenedContents[i]; String blendMode = quadBatch.getBlendMode() == AsBlendMode.AUTO ? support.getBlendMode() : quadBatch.getBlendMode(); quadBatch.renderCustom(mvpMatrix, alpha, blendMode); } } else { base.render(support, parentAlpha); } }
public virtual void testVectorCreation() { AsVector <String> v = new AsVector <String>(); v = new AsVector <String>(); v = new AsVector <String>(); v = AsVector <String> .create("a", "b", "c"); }
public AsDisplayObjectContainer() { if(AsCapabilities.getIsDebugger() && AsGlobal.getQualifiedClassName(this) == "starling.display::DisplayObjectContainer") { throw new AsAbstractClassError(); } mChildren = new AsVector<AsDisplayObject>(); }
public virtual void testVectorPush() { AsVector<String> v = new AsVector<String>(); v.push(); v.push("a"); v.push("a", "b", "c"); v.push(new AsArray("a", "b", "c")); }
public AsDisplayObjectContainer() { if (AsCapabilities.getIsDebugger() && AsGlobal.getQualifiedClassName(this) == "starling.display::DisplayObjectContainer") { throw new AsAbstractClassError(); } mChildren = new AsVector <AsDisplayObject>(); }
public AsDisplayObjectContainer() { if((AsGlobal.getQualifiedClassName(this) == "DisplayObjectContainer")) { throw new AsAbstractClassError(); } mChildren = new AsVector<AsDisplayObject>(); }
public AsQuadBatch() { mVertexData = new AsVertexData(0, true); mIndexData = new AsVector <uint>(); mNumQuads = 0; mTinted = false; mSyncRequired = false; AsStarling.getCurrent().getStage3D().addEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false, 0, true); }
public virtual void testVectorPush() { AsVector <String> v = new AsVector <String>(); v.push(); v.push("a"); v.push("a", "b", "c"); v.push(new AsArray("a", "b", "c")); }
public AsQuadBatch() { mVertexData = new AsVertexData(0, true); mIndexData = new AsVector<uint>(); mNumQuads = 0; mTinted = false; mSyncRequired = false; AsStarling.getCurrent().getStage3D().addEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false, 0, true); }
private void copyMatrix(AsVector <float> _from, AsVector <float> to) { int i = 0; for (; i < 20; ++i) { to[i] = _from[i]; } }
public virtual void testGeneric() { AsVector<bc.test.basic.packages.foo.AsPackageClass> v1 = new AsVector<bc.test.basic.packages.foo.AsPackageClass>(); AsVector<bc.test.basic.packages.bar.AsPackageClass> v2 = new AsVector<bc.test.basic.packages.bar.AsPackageClass>(); v1.push(foo1); v2.push(foo2); foo1 = v1[0]; foo2 = v2[0]; }
public AsTouchProcessor(AsStage stage) { mStage = stage; mElapsedTime = mOffsetTime = 0.0f; mCurrentTouches = new AsVector <AsTouch>(); mQueue = new AsVector <AsArray>(); mLastTaps = new AsVector <AsTouch>(); mStage.addEventListener(AsKeyboardEvent.KEY_DOWN, onKey); mStage.addEventListener(AsKeyboardEvent.KEY_UP, onKey); }
public virtual void testGeneric() { AsVector <bc.test.basic.packages.foo.AsPackageClass> v1 = new AsVector <bc.test.basic.packages.foo.AsPackageClass>(); AsVector <bc.test.basic.packages.bar.AsPackageClass> v2 = new AsVector <bc.test.basic.packages.bar.AsPackageClass>(); v1.push(foo1); v2.push(foo2); foo1 = v1[0]; foo2 = v2[0]; }
public AsTouchProcessor(AsStage stage) { mStage = stage; mElapsedTime = mOffsetTime = 0.0f; mCurrentTouches = new AsVector<AsTouch>(); mQueue = new AsVector<AsArray>(); mLastTaps = new AsVector<AsTouch>(); mStage.addEventListener(AsKeyboardEvent.KEY_DOWN, onKey); mStage.addEventListener(AsKeyboardEvent.KEY_UP, onKey); }
public AsTouch(int id, float globalX, float globalY, String phase, AsDisplayObject target) { mID = id; mGlobalX = mPreviousGlobalX = globalX; mGlobalY = mPreviousGlobalY = globalY; mTapCount = 0; mPhase = phase; mTarget = target; mPressure = mWidth = mHeight = 1.0f; mBubbleChain = new AsVector<AsEventDispatcher>(); }
public AsTouch(int id, float globalX, float globalY, String phase, AsDisplayObject target) { mID = id; mGlobalX = mPreviousGlobalX = globalX; mGlobalY = mPreviousGlobalY = globalY; mTapCount = 0; mPhase = phase; mTarget = target; mPressure = mWidth = mHeight = 1.0f; mBubbleChain = new AsVector <AsEventDispatcher>(); }
public virtual void dispose() { AsVector <AsQuadBatch> __quadBatchs_ = mQuadBatches; if (__quadBatchs_ != null) { foreach (AsQuadBatch quadBatch in __quadBatchs_) { quadBatch.dispose(); } } }
public virtual AsTween reset(Object target, float time, Object transition) { mTarget = target; mCurrentTime = 0; mTotalTime = AsMath.max(0.0001f, time); mDelay = mRepeatDelay = 0.0f; mOnStart = mOnUpdate = mOnComplete = null; mOnStartArgs = mOnUpdateArgs = mOnCompleteArgs = null; mRoundToInt = mReverse = false; mRepeatCount = 1; mCurrentCycle = -1; if (transition is String) { this.setTransition(transition as String); } else { if (transition is AsTransitionCallback) { this.setTransitionFunc(transition as AsTransitionCallback); } else { throw new AsArgumentError("Transition must be either a string or a function"); } } if (mProperties != null) { mProperties.setLength(0); } else { mProperties = new AsVector <String>(); } if (mStartValues != null) { mStartValues.setLength(0); } else { mStartValues = new AsVector <float>(); } if (mEndValues != null) { mEndValues.setLength(0); } else { mEndValues = new AsVector <float>(); } return(this); }
public virtual AsTouch getTouch(AsDisplayObject target, String phase) { AsVector <AsTouch> touchesFound = getTouches(target, phase); if (touchesFound.getLength() > 0) { return(touchesFound[0]); } else { return(null); } }
private AsVector <AsEventDispatcher> getBubbleChain(AsDisplayObject target, AsVector <AsEventDispatcher> result) { AsDisplayObject element = target; int length = 1; result.setLength(length); result[0] = target; while ((element = element.getParent()) != null) { result[length++] = element; } return(result); }
private void disposeFlattenedContents() { if (mFlattenedContents != null) { int i = 0; int max = (int)(mFlattenedContents.getLength()); for (; i < max; ++i) { mFlattenedContents[i].dispose(); } mFlattenedContents = null; } }
private void disposePassTextures() { AsVector <AsTexture> __textures_ = mPassTextures; if (__textures_ != null) { foreach (AsTexture texture in __textures_) { texture.dispose(); } } mPassTextures = null; }
public virtual void addEventListener(String type, AsEventListenerCallback listener, bool useCapture, int priority, bool useWeakReference) { if((mEventListeners == null)) { mEventListeners = new AsDictionary(); } AsVector<AsEventListenerCallback> listeners = (AsVector<AsEventListenerCallback>)(mEventListeners[type]); if((listeners == null)) { listeners = new AsVector<AsEventListenerCallback>(); mEventListeners[type] = listeners; } listeners.push(listener); }
public virtual void addEventListener(String type, AsEventListenerCallback listener, bool useCapture, int priority, bool useWeakReference) { if (mEventListeners == null) { mEventListeners = new AsDictionary(); } AsVector <AsEventListenerCallback> listeners = (AsVector <AsEventListenerCallback>)(mEventListeners[type]); if (listeners == null) { listeners = new AsVector <AsEventListenerCallback>(); mEventListeners[type] = listeners; } listeners.push(listener); }
public virtual void append(AsVertexData data) { mRawData.setOwnProperty("_fixed", false); int targetIndex = (int)(mRawData.getLength()); AsVector <float> rawData = data.mRawData; int rawDataLength = (int)(rawData.getLength()); int i = 0; for (; i < rawDataLength; ++i) { mRawData[targetIndex++] = rawData[i]; } mNumVertices = mNumVertices + data.getNumVertices(); mRawData.setOwnProperty("_fixed", true); }
public AsRenderSupport() { mProjectionMatrix = new AsMatrix(); mModelViewMatrix = new AsMatrix(); mMvpMatrix = new AsMatrix(); mMvpMatrix3D = new AsMatrix3D(); mMatrixStack = new AsVector<AsMatrix>(); mMatrixStackSize = 0; mDrawCount = 0; mRenderTarget = null; mBlendMode = AsBlendMode.NORMAL; mCurrentQuadBatchID = 0; mQuadBatches = new AsVector<AsQuadBatch>(); loadIdentity(); setOrthographicProjection(0, 0, 400, 300); }
public virtual void concat(AsVector<float> matrix) { int i = 0; int y = 0; for (; y < 4; ++y) { int x = 0; for (; x < 5; ++x) { sTmpMatrix1[(i + x)] = matrix[i] * mUserMatrix[x] + matrix[(i + 1)] * mUserMatrix[(x + 5)] + matrix[(i + 2)] * mUserMatrix[(x + 10)] + matrix[(i + 3)] * mUserMatrix[(x + 15)] + x == 4 ? matrix[(i + 4)] : 0; } i = i + 5; } copyMatrix(sTmpMatrix1, mUserMatrix); updateShaderMatrix(); }
public AsTouchEvent(String type, AsVector<AsTouch> touches, bool shiftKey, bool ctrlKey, bool bubbles) : base(type, bubbles) { mTouches = ((touches != null) ? (touches) : (new AsVector<AsTouch>())); mShiftKey = shiftKey; mCtrlKey = ctrlKey; mTimestamp = -1.0f; int numTouches = (int)(touches.getLength()); int i = 0; for (; (i < numTouches); ++i) { if((touches[i].getTimestamp() > mTimestamp)) { mTimestamp = touches[i].getTimestamp(); } } }
public AsTouchEvent(String type, AsVector<AsTouch> touches, bool shiftKey, bool ctrlKey, bool bubbles) : base(type, bubbles, touches) { mShiftKey = shiftKey; mCtrlKey = ctrlKey; mTimestamp = -1.0f; mVisitedObjects = new AsVector<AsEventDispatcher>(); int numTouches = (int)(touches.getLength()); int i = 0; for (; i < numTouches; ++i) { if(touches[i].getTimestamp() > mTimestamp) { mTimestamp = touches[i].getTimestamp(); } } }
public void testSort() { AsVector<int> vector = new AsVector<int>(); vector.push(3); vector.push(1); vector.push(4); vector.push(0); vector.sort(sorter); List<int> list = vector.internalList; foreach (int i in list) { Console.WriteLine(i); } Assert.AreEqual(vector[0] == 0 && vector[1] == 1 && vector[2] == 3 && vector[3] == 4, true); }
public AsBitmapFont(AsTexture texture, AsXML fontXml) { if(texture == null && fontXml == null) { texture = AsMiniBitmapFont.getTexture(); fontXml = AsMiniBitmapFont.getXml(); } mName = "unknown"; mLineHeight = mSize = mBaseline = 14; mTexture = texture; mChars = new AsDictionary(); mHelperImage = new AsImage(texture); mCharLocationPool = new AsVector<AsCharLocation>(); if(fontXml != null) { parseFontXml(fontXml); } }
public virtual void addEventListener(String type, AsEventListenerCallback listener) { if(mEventListeners == null) { mEventListeners = new AsDictionary(); } AsVector<AsEventListenerCallback> listeners = mEventListeners[type] as AsVector<AsEventListenerCallback>; if(listeners == null) { mEventListeners[type] = new AsVector<AsEventListenerCallback>(); } else { if(listeners.indexOf(listener) == -1) { listeners.push(listener); } } }
public virtual void addChildAt(AsDisplayObject child, int index) { if(mChildren == null) { mChildren = new AsVector<AsDisplayObject>(); } if(index >= 0 && index <= getNumChildren()) { child.removeFromParent(); mChildren.splice(index, (uint)(0), child); child.setParent(this); child.dispatchEvent(sAddedEvent); if(getStage() != null) { child.dispatchEventOnChildren(sAddedToStageEvent); } } else { throw new AsRangeError("Invalid child index"); } }
public AsMatrix3D(AsVector<float> v) { internalMatrix.M11 = v[0]; internalMatrix.M12 = v[1]; internalMatrix.M13 = v[2]; internalMatrix.M14 = 0; internalMatrix.M21 = v[4]; internalMatrix.M22 = v[5]; internalMatrix.M23 = v[6]; internalMatrix.M24 = 0; internalMatrix.M31 = v[8]; internalMatrix.M32 = v[9]; internalMatrix.M33 = v[10]; internalMatrix.M34 = 0; internalMatrix.M41 = v[12]; internalMatrix.M42 = v[13]; internalMatrix.M43 = v[14]; internalMatrix.M44 = 1; }
public virtual void dispatch(AsVector<AsEventDispatcher> chain) { if(chain != null && chain.getLength() != 0) { int chainLength = (int)(getBubbles() ? chain.getLength() : 1); AsEventDispatcher previousTarget = getTarget(); setTarget(chain[0] as AsEventDispatcher); int i = 0; for (; i < chainLength; ++i) { AsEventDispatcher chainElement = chain[i] as AsEventDispatcher; if(mVisitedObjects.indexOf(chainElement) == -1) { bool stopPropagation = chainElement.invokeEvent(this); mVisitedObjects.push(chainElement); if(stopPropagation) { break; } } } setTarget(previousTarget); } }
public virtual void uploadFromVector(AsVector<float> data, int startVertex, int numVertices) { throw new AsNotImplementedError(); }
public static void compile(AsDisplayObject _object, AsVector<AsQuadBatch> quadBatches) { compileObject(_object, quadBatches, -1, new AsMatrix()); }
private static int compileObject(AsDisplayObject _object, AsVector<AsQuadBatch> quadBatches, int quadBatchID, AsMatrix transformationMatrix) { return compileObject(_object, quadBatches, quadBatchID, transformationMatrix, 1.0f, null, false); }
private static int compileObject(AsDisplayObject _object, AsVector<AsQuadBatch> quadBatches, int quadBatchID, AsMatrix transformationMatrix, float alpha, String blendMode) { return compileObject(_object, quadBatches, quadBatchID, transformationMatrix, alpha, blendMode, false); }
private static int compileObject(AsDisplayObject _object, AsVector<AsQuadBatch> quadBatches, int quadBatchID, AsMatrix transformationMatrix, float alpha, String blendMode, bool ignoreCurrentFilter) { int i = 0; AsQuadBatch quadBatch = null; bool isRootObject = false; float objectAlpha = _object.getAlpha(); AsDisplayObjectContainer container = _object as AsDisplayObjectContainer; AsQuad quad = _object as AsQuad; AsQuadBatch batch = _object as AsQuadBatch; AsFragmentFilter filter = _object.getFilter(); if(quadBatchID == -1) { isRootObject = true; quadBatchID = 0; objectAlpha = 1.0f; blendMode = _object.getBlendMode(); if(quadBatches.getLength() == 0) { quadBatches.push(new AsQuadBatch()); } else { quadBatches[0].reset(); } } if(filter != null && !ignoreCurrentFilter) { if(filter.getMode() == AsFragmentFilterMode.ABOVE) { quadBatchID = compileObject(_object, quadBatches, quadBatchID, transformationMatrix, alpha, blendMode, true); } quadBatchID = compileObject(filter.compile(_object), quadBatches, quadBatchID, transformationMatrix, alpha, blendMode); if(filter.getMode() == AsFragmentFilterMode.BELOW) { quadBatchID = compileObject(_object, quadBatches, quadBatchID, transformationMatrix, alpha, blendMode, true); } } else { if(container != null) { int numChildren = container.getNumChildren(); AsMatrix childMatrix = new AsMatrix(); for (i = 0; i < numChildren; ++i) { AsDisplayObject child = container.getChildAt(i); bool childVisible = child.getAlpha() != 0.0f && child.getVisible() && child.getScaleX() != 0.0f && child.getScaleY() != 0.0f; if(childVisible) { String childBlendMode = child.getBlendMode() == AsBlendMode.AUTO ? blendMode : child.getBlendMode(); childMatrix.copyFrom(transformationMatrix); AsRenderSupport.transformMatrixForObject(childMatrix, child); quadBatchID = compileObject(child, quadBatches, quadBatchID, childMatrix, alpha * objectAlpha, childBlendMode); } } } else { if(quad != null || batch != null) { AsTexture texture = null; String smoothing = null; bool tinted = false; int numQuads = 0; if(quad != null) { AsImage image = quad as AsImage; texture = image != null ? image.getTexture() : null; smoothing = image != null ? image.getSmoothing() : null; tinted = quad.getTinted(); numQuads = 1; } else { texture = batch.mTexture; smoothing = batch.mSmoothing; tinted = batch.mTinted; numQuads = batch.mNumQuads; } quadBatch = quadBatches[quadBatchID]; if(quadBatch.isStateChange(tinted, alpha * objectAlpha, texture, smoothing, blendMode, numQuads)) { quadBatchID++; if(quadBatches.getLength() <= quadBatchID) { quadBatches.push(new AsQuadBatch()); } quadBatch = quadBatches[quadBatchID]; quadBatch.reset(); } if(quad != null) { quadBatch.addQuad(quad, alpha, texture, smoothing, transformationMatrix, blendMode); } else { quadBatch.addQuadBatch(batch, alpha, transformationMatrix, blendMode); } } else { throw new AsError("Unsupported display object: " + AsGlobal.getQualifiedClassName(_object)); } } } if(isRootObject) { for (i = (int)(quadBatches.getLength() - 1); i > quadBatchID; --i) { quadBatches.pop().dispose(); } } return quadBatchID; }
private void getChildEventListeners(AsDisplayObject _object, String eventType, AsVector<AsDisplayObject> listeners) { AsDisplayObjectContainer container = _object as AsDisplayObjectContainer; if(_object.hasEventListener(eventType)) { listeners.push(_object); } if(container != null) { AsVector<AsDisplayObject> children = container.mChildren; int numChildren = (int)(children.getLength()); int i = 0; for (; i < numChildren; ++i) { getChildEventListeners(children[i], eventType, listeners); } } }