コード例 #1
0
 public virtual void setRenderTarget(AsTexture target)
 {
     mRenderTarget = target;
     if (target != null)
     {
         AsStarling.getContext().setRenderToTexture(target.get_base());
     }
     else
     {
         AsStarling.getContext().setRenderToBackBuffer();
     }
 }
コード例 #2
0
 private void onContextCreated(AsEvent _event)
 {
     if (!AsStarling.getHandleLostContext() && mContext != null)
     {
         stop();
         _event.stopImmediatePropagation();
         showFatalError("Fatal error: The application lost the device context!");
         AsGlobal.trace("[Starling] The device context was lost. " + "Enable 'Starling.handleLostContext' to avoid this error.");
     }
     else
     {
         initialize();
     }
 }
コード例 #3
0
        public virtual void dispose()
        {
            stop();
            mNativeStage.removeEventListener(AsEvent.ENTER_FRAME, onEnterFrame, false);
            mNativeStage.removeEventListener(AsKeyboardEvent.KEY_DOWN, onKey, false);
            mNativeStage.removeEventListener(AsKeyboardEvent.KEY_UP, onKey, false);
            mNativeStage.removeEventListener(AsEvent.RESIZE, onResize, false);
            mNativeStage.removeChild(mNativeOverlay);
            mStage3D.removeEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false);
            mStage3D.removeEventListener(AsErrorEvent.ERROR, onStage3DError, false);
            AsArray __touchEventTypes_ = getTouchEventTypes();

            if (__touchEventTypes_ != null)
            {
                foreach (String touchEventType in __touchEventTypes_)
                {
                    mNativeStage.removeEventListener(touchEventType, onTouch, false);
                }
            }
            AsDictionary __programs_ = mPrograms;

            if (__programs_ != null)
            {
                foreach (AsProgram3D program in __programs_)
                {
                    program.dispose();
                }
            }
            if (mStage != null)
            {
                mStage.dispose();
            }
            if (mSupport != null)
            {
                mSupport.dispose();
            }
            if (mTouchProcessor != null)
            {
                mTouchProcessor.dispose();
            }
            if (mContext != null && !mShareContext)
            {
                mContext.dispose();
            }
            if (sCurrent == this)
            {
                sCurrent = null;
            }
        }
コード例 #4
0
 public virtual void makeCurrent()
 {
     sCurrent = this;
 }
コード例 #5
0
 public static void clear(uint rgb, float alpha)
 {
     AsStarling.getContext().clear(AsColor.getRed(rgb) / 255.0f, AsColor.getGreen(rgb) / 255.0f, AsColor.getBlue(rgb) / 255.0f, alpha);
 }
コード例 #6
0
        public static void setBlendFactors(bool premultipliedAlpha, String blendMode)
        {
            AsArray blendFactors = AsBlendMode.getBlendFactors(blendMode, premultipliedAlpha);

            AsStarling.getContext().setBlendFactors((String)(blendFactors[0]), (String)(blendFactors[1]));
        }
コード例 #7
0
 public virtual void makeCurrent()
 {
     sCurrent = this;
 }
コード例 #8
0
 public virtual void dispose()
 {
     stop();
     mNativeStage.removeEventListener(AsEvent.ENTER_FRAME, onEnterFrame, false);
     mNativeStage.removeEventListener(AsKeyboardEvent.KEY_DOWN, onKey, false);
     mNativeStage.removeEventListener(AsKeyboardEvent.KEY_UP, onKey, false);
     mNativeStage.removeEventListener(AsEvent.RESIZE, onResize, false);
     mNativeStage.removeChild(mNativeOverlay);
     mStage3D.removeEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false);
     mStage3D.removeEventListener(AsErrorEvent.ERROR, onStage3DError, false);
     AsArray __touchEventTypes_ = getTouchEventTypes();
     if (__touchEventTypes_ != null)
     {
         foreach (String touchEventType in __touchEventTypes_)
         {
             mNativeStage.removeEventListener(touchEventType, onTouch, false);
         }
     }
     AsDictionary __programs_ = mPrograms;
     if (__programs_ != null)
     {
         foreach (AsProgram3D program in __programs_)
         {
             program.dispose();
         }
     }
     if(mStage != null)
     {
         mStage.dispose();
     }
     if(mSupport != null)
     {
         mSupport.dispose();
     }
     if(mTouchProcessor != null)
     {
         mTouchProcessor.dispose();
     }
     if(mContext != null && !mShareContext)
     {
         mContext.dispose();
     }
     if(sCurrent == this)
     {
         sCurrent = null;
     }
 }