public AsImage(AsTexture texture)
            : base(texture.getFrame() != null ? texture.getFrame().width : texture.getWidth(), texture.getFrame() != null ? texture.getFrame().height : texture.getHeight(), 0xffffff, texture.getPremultipliedAlpha())
        {
            bool pma = texture.getPremultipliedAlpha();

            mVertexData.setTexCoords(0, 0.0f, 0.0f);
            mVertexData.setTexCoords(1, 1.0f, 0.0f);
            mVertexData.setTexCoords(2, 0.0f, 1.0f);
            mVertexData.setTexCoords(3, 1.0f, 1.0f);
            mTexture                = texture;
            mSmoothing              = AsTextureSmoothing.BILINEAR;
            mVertexDataCache        = new AsVertexData(4, pma);
            mVertexDataCacheInvalid = true;
        }
 protected override void activate(int pass, AsContext3D context, AsTexture texture)
 {
     updateParameters(pass, (int)(texture.getWidth() * texture.getScale()), (int)(texture.getHeight() * texture.getScale()));
     context.setProgramConstantsFromVector(AsContext3DProgramType.VERTEX, 4, mOffsets);
     context.setProgramConstantsFromVector(AsContext3DProgramType.FRAGMENT, 0, mWeights);
     if (mUniformColor && pass == getNumPasses() - 1)
     {
         context.setProgramConstantsFromVector(AsContext3DProgramType.FRAGMENT, 1, mColor);
         context.setProgram(mTintedProgram);
     }
     else
     {
         context.setProgram(mNormalProgram);
     }
 }
        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);
            }
        }
Exemple #4
0
 public AsButton(AsTexture upState, String text, AsTexture downState)
 {
     if (upState == null)
     {
         throw new AsArgumentError("Texture cannot be null");
     }
     mUpState           = upState;
     mDownState         = downState != null ? downState : upState;
     mBackground        = new AsImage(upState);
     mScaleWhenDown     = downState != null ? 1.0f : 0.9f;
     mAlphaWhenDisabled = 0.5f;
     mEnabled           = true;
     mIsDown            = false;
     mUseHandCursor     = true;
     mTextBounds        = new AsRectangle(0, 0, upState.getWidth(), upState.getHeight());
     mContents          = new AsSprite();
     mContents.addChild(mBackground);
     addChild(mContents);
     addEventListener(AsTouchEvent.TOUCH, onTouch);
     if (text.Length != 0)
     {
         this.setText(text);
     }
 }
 public virtual float getWidth()
 {
     return(mTexture.getWidth());
 }