コード例 #1
0
ファイル: Controllable.cs プロジェクト: Alkimus/SpaceAce
        private void Setup_Controls()
        {
            Controls = new TouchInputCollection();

            Touch Up = new Touch("Up",
                                 new Rectangle(0, 0, Bounds.Width, Bounds.Height / 4),
                                 new Action(Control_Up));

            Controls.AddArea("Up", Up);

            Touch Down = new Touch("Down",
                                   new Rectangle(0, Bounds.Bottom - Bounds.Height / 4, Bounds.Width, Bounds.Height / 4),
                                   new Action(Control_Down));

            Controls.AddArea("Down", Down);

            Touch Left = new Touch("Left",
                                   new Rectangle(0, Bounds.Height / 4, Bounds.Width / 4, Bounds.Height / 2),
                                   new Action(Control_Left));

            Controls.AddArea("Left", Left);

            Touch Right = new Touch("Right",
                                    new Rectangle(Bounds.Right - Bounds.Width / 4, Bounds.Height / 4, Bounds.Width / 4, Bounds.Height / 2),
                                    new Action(Control_Right));

            Controls.AddArea("Right", Right);
        }
コード例 #2
0
ファイル: User.cs プロジェクト: Alkimus/SpaceAce
 public User(Texture2D texture, string name, Rectangle bounds)
 {
     _ = new TouchInputCollection();
     Setup_Controls();
     _Sprite = new Sprite(texture, name, bounds);
 }