private void onKey(AsKeyboardEvent _event)
 {
     if (_event.getKeyCode() == 17 || _event.getKeyCode() == 15)
     {
         bool wasCtrlDown = mCtrlDown;
         mCtrlDown = _event.getType() == AsKeyboardEvent.KEY_DOWN;
         if (getSimulateMultitouch() && wasCtrlDown != mCtrlDown)
         {
             mTouchMarker.setVisible(mCtrlDown);
             mTouchMarker.moveCenter(mStage.getStageWidth() / 2, mStage.getStageHeight() / 2);
             AsTouch mouseTouch  = getCurrentTouch(0);
             AsTouch mockedTouch = getCurrentTouch(1);
             if (mouseTouch != null)
             {
                 mTouchMarker.moveMarker(mouseTouch.getGlobalX(), mouseTouch.getGlobalY());
             }
             if (wasCtrlDown && mockedTouch != null && mockedTouch.getPhase() != AsTouchPhase.ENDED)
             {
                 mQueue.unshift(new AsArray(1, AsTouchPhase.ENDED, mockedTouch.getGlobalX(), mockedTouch.getGlobalY()));
             }
             else
             {
                 if (mCtrlDown && mouseTouch != null)
                 {
                     if (mouseTouch.getPhase() == AsTouchPhase.BEGAN || mouseTouch.getPhase() == AsTouchPhase.MOVED)
                     {
                         mQueue.unshift(new AsArray(1, AsTouchPhase.BEGAN, mTouchMarker.getMockX(), mTouchMarker.getMockY()));
                     }
                     else
                     {
                         mQueue.unshift(new AsArray(1, AsTouchPhase.HOVER, mTouchMarker.getMockX(), mTouchMarker.getMockY()));
                     }
                 }
             }
         }
     }
     else
     {
         if (_event.getKeyCode() == 16)
         {
             mShiftDown = _event.getType() == AsKeyboardEvent.KEY_DOWN;
         }
     }
 }
        private void calculateBounds(AsDisplayObject _object, AsStage stage, AsRectangle resultRect)
        {
            if (_object == stage || _object == AsStarling.getCurrent().getRoot())
            {
                resultRect.setTo(0, 0, stage.getStageWidth(), stage.getStageHeight());
            }
            else
            {
                _object.getBounds(stage, resultRect);
            }
            float deltaMargin = mResolution == 1.0f ? 0.0f : 1.0f / mResolution;

            resultRect.x      = resultRect.x - mMarginX + deltaMargin;
            resultRect.y      = resultRect.y - mMarginY + deltaMargin;
            resultRect.width  = resultRect.width + 2 * (mMarginX + deltaMargin);
            resultRect.height = resultRect.height + 2 * (mMarginY + deltaMargin);
            resultRect.width  = AsGlobal.getNextPowerOfTwo((int)(resultRect.width * mResolution)) / mResolution;
            resultRect.height = AsGlobal.getNextPowerOfTwo((int)(resultRect.height * mResolution)) / mResolution;
        }
 public void Draw(GraphicsDevice device)
 {
     BcRenderSupport.Begin(device, stage.getStageWidth(), stage.getStageHeight());
     stage.render(renderSupport, 1.0f);
     BcRenderSupport.End();
 }