Beispiel #1
0
        public static Texture CreateForTextureRegionSize(TextureRegion pTextureRegion, TextureOptions pTextureOptions)
        {
            int loadingScreenWidth  = pTextureRegion.GetWidth();
            int loadingScreenHeight = pTextureRegion.GetHeight();

            return(new Texture(MathUtils.NextPowerOfTwo(loadingScreenWidth), MathUtils.NextPowerOfTwo(loadingScreenHeight), pTextureOptions));
        }
Beispiel #2
0
        protected void Init(Camera pCamera, TextureRegion pTextureRegion, float pDuration, float pScaleFrom, float pScaleTo)
        {
            Sprite loadingScreenSprite = new Sprite(pCamera.GetMinX(), pCamera.GetMinY(), pCamera.GetWidth(), pCamera.GetHeight(), pTextureRegion);

            if (pScaleFrom != 1 || pScaleTo != 1)
            {
                loadingScreenSprite.SetScale(pScaleFrom);
                loadingScreenSprite.AddShapeModifier(new ScaleModifier(pDuration, pScaleFrom, pScaleTo, IEaseFunction.DEFAULT));
            }

            this.GetTopLayer().AddEntity(loadingScreenSprite);
        }
        // ===========================================================
        // Constructors
        // ===========================================================

        public BaseOnScreenControl(/* final */ int pX, /* final */ int pY, /* final */ Camera pCamera, /* final */ TextureRegion pControlBaseTextureRegion, /* final */ TextureRegion pControlKnobTextureRegion, /* final */ float pTimeBetweenUpdates, /* final */ IOnScreenControlListener pOnScreenControlListener)
        {
            this.SetCamera(pCamera);

            this.mOnScreenControlListener = pOnScreenControlListener;
            /* Create the control base. */

            /*
             * this.mControlBase = new Sprite(pX, pY, pControlBaseTextureRegion) {
             *  public override bool OnAreaTouched(/* final * / TouchEvent pSceneTouchEvent, /* final * / float pTouchAreaLocalX, /* final * / float pTouchAreaLocalY) {
             *      return BaseOnScreenControl.this.OnHandleControlBaseTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
             *  }
             * };
             */
            this.mControlBase = new BaseOnScreenControlBaseSprite(this, pX, pY, pControlBaseTextureRegion);

            /* Create the control knob. */
            this.mControlKnob = new Sprite(0, 0, pControlKnobTextureRegion);
            this.OnHandleControlKnobReleased();

            /* Register listeners and add objects to this HUD. */
            this.SetOnSceneTouchListener(this);
            this.RegisterTouchArea(this.mControlBase);

            /*
             * this.RegisterUpdateHandler(new TimerHandler(pTimeBetweenUpdates, true, new ITimerCallback() {
             *  public override void OnTimePassed(/* final * / TimerHandler pTimerHandler) {
             *      BaseOnScreenControl.this.mOnScreenControlListener.onControlChange(BaseOnScreenControl.this, BaseOnScreenControl.this.mControlValueX, BaseOnScreenControl.this.mControlValueY);
             *  }
             * }));
             * //*/
            this.RegisterUpdateHandler(new TimerHandler(pTimeBetweenUpdates, true, new BaseOnScreenControlTimerCallback(this)));

            /* final */
            ILayer bottomLayer = this.GetBottomLayer();

            bottomLayer.AddEntity(this.mControlBase);
            bottomLayer.AddEntity(this.mControlKnob);

            this.SetTouchAreaBindingEnabled(true);
        }
 public BaseOnScreenControlBaseSprite(BaseOnScreenControl parentControl, float pX, float pY, TextureRegion pControlBaseTextureRegion)
     : base(pX, pY, pControlBaseTextureRegion)
 {
     _this = parentControl;
 }
Beispiel #5
0
        // ===========================================================
        // Constants
        // ===========================================================

        // ===========================================================
        // Fields
        // ===========================================================

        // ===========================================================
        // Constructors
        // ===========================================================

        public static Texture CreateForTextureSourceSize(TextureRegion pTextureRegion)
        {
            return(CreateForTextureRegionSize(pTextureRegion, TextureOptions.DEFAULT));
        }
        protected override float GetY2()
        {
            TextureRegion textureRegion = this.GetTextureRegion();

            return((float)(textureRegion.GetTexturePositionY() + textureRegion.GetHeight()) / textureRegion.GetTexture().GetHeight());
        }
        protected override float GetX2()
        {
            TextureRegion textureRegion = this.GetTextureRegion();

            return((float)(textureRegion.GetTexturePositionX() + textureRegion.GetWidth()) / textureRegion.GetTexture().GetWidth());
        }
        // ===========================================================
        // Constants
        // ===========================================================

        // ===========================================================
        // Fields
        // ===========================================================

        // ===========================================================
        // Constructors
        // ===========================================================

        public TextureRegionBuffer(TextureRegion pTextureRegion, int pDrawType)
            : base(pTextureRegion, pDrawType)
        {
        }
        // ===========================================================
        // Constants
        // ===========================================================

        // ===========================================================
        // Fields
        // ===========================================================

        // ===========================================================
        // Constructors
        // ===========================================================

        public TextureRegionBuffer(TextureRegion pTextureRegion, int pDrawType)
            : base(pTextureRegion, pDrawType)
        {
        }
Beispiel #10
0
 public SplashScene(Camera pCamera, TextureRegion pTextureRegion, float pDuration, float pScaleFrom, float pScaleTo)
     : base(1)
 {
     Init(pCamera, pTextureRegion, pDuration, pScaleFrom, pScaleTo);
 }
Beispiel #11
0
        // ===========================================================
        // Constants
        // ===========================================================

        // ===========================================================
        // Fields
        // ===========================================================

        // ===========================================================
        // Constructors
        // ===========================================================

        public SplashScene(Camera pCamera, TextureRegion pTextureRegion)
            : base(1)
        {
            Init(pCamera, pTextureRegion, -1, 1, 1);
        }