Пример #1
0
        /// <summary>
        /// Creates a new <code>FlxButton</code> object with a gray background
        /// and a callback function on the UI thread.
        /// Also appends a GamePad symbol to allow for using a gamepad to select the menu.
        /// </summary>
        /// <param name="X">The X position of the button.</param>
        /// <param name="Y">The Y position of the button.</param>
        /// <param name="Callback">The function to call whenever the button is clicked.</param>
        /// <param name="Button">Button number. Uses FlxButton.ControlPad** to select a button</param>
        public FlxButton(int X, int Y, FlxButtonClick Callback, int Button)
            : base()
        {
            x          = X;
            y          = Y;
            width      = 100;
            height     = 20;
            _off       = new FlxSprite().createGraphic((int)width, (int)height, new Color(0x7f, 0x7f, 0x7f));
            _off.solid = false;
            add(_off, true);
            _on       = new FlxSprite().createGraphic((int)width, (int)height, Color.White);
            _on.solid = false;
            add(_on, true);
            _offT                  = null;
            _onT                   = null;
            _callback              = Callback;
            _onToggle              = false;
            _pressed               = false;
            _initialized           = false;
            _sf                    = Vector2.Zero;
            pauseProof             = false;
            _controllerButtonIndex = Button;

            //_controllerButton = new FlxSprite((int)width + 5, 0);
            //_controllerButton.loadGraphic(FlxG.Content.Load<Texture2D>("buttons/BP3_SSTRIP_32"), true, false, 31, 32);
            //_controllerButton.width = 29;
            //_controllerButton.height = 30;
            //_controllerButton.offset.X = 1;
            //_controllerButton.offset.Y = 1;
            //_controllerButton.addAnimation("frame", new int[] {Button});
            //_controllerButton.play("frame");
            //_controllerButton.solid = false;
            //add(_controllerButton, true);
        }
Пример #2
0
        /// <summary>
        /// Creates a new <code>FlxButton</code> object with a gray background
        /// and a callback function on the UI thread.
        /// </summary>
        /// <param name="X">The X position of the button.</param>
        /// <param name="Y">The Y position of the button.</param>
        /// <param name="Callback">The function to call whenever the button is clicked.</param>
        public FlxButton(int X, int Y, FlxButtonClick Callback)
            : base()
        {
            x          = X;
            y          = Y;
            width      = 100;
            height     = 20;
            _off       = new FlxSprite().createGraphic((int)width, (int)height, new Color(0x7f, 0x7f, 0x7f));
            _off.solid = false;
            add(_off, true);
            _on       = new FlxSprite().createGraphic((int)width, (int)height, Color.White);
            _on.solid = false;
            add(_on, true);
            _offT        = null;
            _onT         = null;
            _callback    = Callback;
            _onToggle    = false;
            _pressed     = false;
            _initialized = false;
            _sf          = Vector2.Zero;
            pauseProof   = false;

            _controllerButtonIndex = -1;
            //_controllerButton = new FlxSprite((int)width+5,0);
            //_controllerButton.loadGraphic(FlxG.Content.Load<Texture2D>("buttons/BP3_SSTRIP_32"),true,false,32,32);
            //_controllerButton.solid = false;
            ////_controllerButton.scale
            //add(_controllerButton, true);
        }
Пример #3
0
 /// <summary>
 /// Creates a new <code>FlxButton</code> object with a gray background
 /// and a callback function on the UI thread.
 /// </summary>
 /// <param name="x">The X position of the button.</param>
 /// <param name="y">The Y position of the button.</param>
 /// <param name="callback">The function to call whenever the button is clicked.</param>   	
 public FlxButton(int x, int y, FlxButtonClick callback)
 {
     X = x;
     Y = y;
     Width = 100;
     Height = 20;
     _off = new FlxSprite().CreateGraphic((int)Width, (int)Height, new Color(0x7f, 0x7f, 0x7f));
     _off.Solid = false;
     Add(_off, true);
     _on = new FlxSprite().CreateGraphic((int)Width, (int)Height, Color.White);
     _on.Solid = false;
     Add(_on, true);
     _offT = null;
     _onT = null;
     _callback = callback;
     _onToggle = false;
     _pressed = false;
     _initialized = false;
     _sf = Vector2.Zero;
     PauseProof = false;
 }
Пример #4
0
 /**
  * Creates a new <code>FlxButton</code> object with a gray background
  * and a callback function on the UI thread.
  *
  * @param	X			The X position of the button.
  * @param	Y			The Y position of the button.
  * @param	Callback	The function to call whenever the button is clicked.
  */
 public FlxButton(int X, int Y, FlxButtonClick Callback)
     : base()
 {
     x = X;
     y = Y;
     width = 100;
     height = 20;
     _off = new FlxSprite().createGraphic((int)width, (int)height, new Color(0x7f, 0x7f, 0x7f));
     _off.solid = false;
     add(_off, true);
     _on = new FlxSprite().createGraphic((int)width, (int)height, Color.White);
     _on.solid = false;
     add(_on, true);
     _offT = null;
     _onT = null;
     _callback = Callback;
     _onToggle = false;
     _pressed = false;
     _initialized = false;
     _sf = Vector2.Zero;
     pauseProof = false;
 }
Пример #5
0
 /**
  * Creates a new <code>FlxButton</code> object with a gray background
  * and a callback function on the UI thread.
  *
  * @param	X			The X position of the button.
  * @param	Y			The Y position of the button.
  * @param	Callback	The function to call whenever the button is clicked.
  */
 public FlxButton(int X, int Y, FlxButtonClick Callback)
     : base()
 {
     x          = X;
     y          = Y;
     width      = 100;
     height     = 20;
     _off       = new FlxSprite().createGraphic((int)width, (int)height, new Color(0x7f, 0x7f, 0x7f));
     _off.solid = false;
     add(_off, true);
     _on       = new FlxSprite().createGraphic((int)width, (int)height, Color.White);
     _on.solid = false;
     add(_on, true);
     _offT        = null;
     _onT         = null;
     _callback    = Callback;
     _onToggle    = false;
     _pressed     = false;
     _initialized = false;
     _sf          = Vector2.Zero;
     pauseProof   = false;
 }