示例#1
0
 public InputManagerService(Game game) //Constructor
     : base(game)
 {
     GamePad  = new gamePad();
     Keyboard = new keyboard();
     Mouse    = new mouse();
     ServiceHelper.Add <InputManagerService>(this);
     this.game = game;
 }
示例#2
0
        public sharpAHK.mousePos Mouse(mouse Action, int x = 0, int y = 0, int count = 1)
        {
            sharpAHK.mousePos pos = new sharpAHK.mousePos();

            string button = "Left";
            int    y2     = 0;  // MouseClickDrag
            int    x2     = 0;  // MouseClickDrag
            string speed  = ""; // mousemove / mouseclickdrag / mouseclick
            string R      = ""; // mouseclickdrag


            if (Action == mouse.Click)
            {
                string Command = "Click " + x.ToString() + ", " + y.ToString();
                ahk.Click(Command);
            }

            if (Action == mouse.MouseClick)
            {
                ahk.MouseClick(_AHK.MouseButton.Left, x, y, true, count, speed, _AHK.MouseState.None, false);
            }

            if (Action == mouse.MouseClickDrag)
            {
                ahk.MouseClickDrag(button, x.ToString(), y.ToString(), x2.ToString(), y2.ToString(), speed, R);
            }

            if (Action == mouse.MouseGetPos)
            {
                pos = ahk.MouseGetPos("");
            }

            if (Action == mouse.MouseMove)
            {
                bool OffSetFromCurrentPos = false;
                ahk.MouseMove(x, y, true, speed.ToInt(), OffSetFromCurrentPos);
            }

            return(pos);
        }
示例#3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            //enemy speed variable
            spe = new Vector2(1, 0);
            //allows bounds to goto (100, 0, 600, 90) with some wiggle room //Top weapon bounding rectangle
            bounds1 = new Rectangle(189, 0, 511, 5);
            //allows bounds to goto (100, 390, 600, 90) with some wiggle room //Bottom weapon bounding rectangle
            bounds2 = new Rectangle(189, 475, 511, 5);
            //bounds of the right edge
            bounds3                = new Rectangle(799, 0, 1, 480);
            m                      = new mouse();
            enemies                = new List <enemy> ();
            enemiesToBeDeleted     = new List <enemy>();
            projectiles            = new List <projectile>();
            projectilesToBeDeleted = new List <projectile>();
            weapons                = new List <weapon> ();
            //edges of the map
            edges = new List <Rectangle>();
            edges.Add(new Rectangle(0, 0, 800, 1));   //Up
            edges.Add(new Rectangle(0, 0, 1, 480));   //Left
            edges.Add(bounds3);                       //Right
            edges.Add(new Rectangle(0, 479, 800, 1)); //Down
            scoreNum      = 0;
            bones         = 13;
            enemiesLeft   = 150;
            endGameCycles = 200;
            //enemy generation
            rand = new Random();
            //level start
            level = Leevel.StartScreen;
            LEvel = 0;

            base.Initialize();
        }
示例#4
0
 public InputManagerService(Game game) //Constructor 
     : base(game) 
 { 
     GamePad = new gamePad(); 
     Keyboard = new keyboard(); 
     Mouse = new mouse();
     ServiceHelper.Add<InputManagerService>(this);
     this.game = game; 
 }