/// <summary>
        /// Initializes a new instance of the <see cref="YutShot.GUISprite"/> class.
        /// </summary>
        /// <param name="_position">Position.</param>
        /// <param name="_textureID">Texture I.</param>
        /// <param name="_color">Color.</param>
        /// <param name="_scale">Scale.</param>
        /// <param name="animation">Type of animation. 0 is nil, 1 - fadelinear, 2 - enlargelinear</param>
        public GUISprite(Vector2 _position, byte _textureID, Color _color, float _scale, byte animation)
        {
            position  = _position;
            textureID = _textureID;
            if (_color != null)
            {
                color = _color;
            }
            scale = _scale;
            if (animation != 0)
            {
                animHandler = new AnimationHandler(this, animation, 0.6f);
            }

            opacity = 1;
            if (textureID > 99)//level
            {
                texture = Resources.levelResultTexture;
                origin  = new Vector2(30, 10);
                int temp = textureID - 100;
                srcRect = new Rectangle((temp % 4) * 60, (temp / 4) * 20, 60, 20);
            }
            else
            {
                texture = Resources.GUITextures[textureID];
                origin  = new Vector2(texture.Width / 2, texture.Height / 2);
            }
        }
Exemple #2
0
 public Button(string caption, Vector2 _position, byte _textureID, Color _color, Action _toDo, byte animation, float _scale, bool reconstruct = false)
 {
     Caption   = caption;
     position  = _position;
     textureID = _textureID;
     if (_color != null)
     {
         color = _color;
     }
     scale   = _scale;
     width   = GameVars.buttonSize * scale;
     toDo    = _toDo;
     opacity = 1;
     if (reconstruct)
     {
     }
     if (animation != 0)
     {
         animHandler = new AnimationHandler(this, animation, 1f);
     }
     origin           = new Vector2(Resources.buttonTextures[textureID].Width / 2, Resources.buttonTextures[textureID].Height / 2);
     this.reconstruct = reconstruct;
 }