Example #1
0
 public Quad(QuadRoot tree, Quad parent, Rectangle rectangle)
 {
     this.tree = tree;
     this.parent = parent;
     this.rectangle = rectangle;
 }
Example #2
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

            drawLineTexture = this.Content.Load<Texture2D>("Misc/solid");
            font = Content.Load<SpriteFont>("Fonts/Arial");
            (collision = new RTSCollisionMap(this, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight)).PlaceNodesAroundEdges();
            graphics.PreferMultiSampling = true;

            (quadTree = new QuadRoot(new Rectangle(0, 0,
                graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight)
                )).CreateTree(5);

            players = new LinkedList<Player>();

            Alliance redAlliance = new Alliance();
            Player humanPlayer = new Player(redAlliance, Color.Red);
            players.AddLast((CURRENT_PLAYER = humanPlayer));
            humanPlayer.SpawnStartUnits(new Point((int)Game1.GetInstance().graphics.PreferredBackBufferWidth / 2,
                (int)Game1.GetInstance().graphics.PreferredBackBufferWidth / 2));

            Alliance greenAlliance = new Alliance();
            Player aiPlayer = new Player(greenAlliance, Color.Green);
            players.AddLast(aiPlayer);
            aiPlayer.SpawnStartUnits(new Point((int)Game1.GetInstance().graphics.PreferredBackBufferWidth / 2, 200));

            //SaveManager.GetInstance().SaveNodes("C:\\Users\\Wouter\\Desktop\\test.xml");
            MouseManager.GetInstance().mouseClickedListeners += ((MouseClickListener)this).OnMouseClick;
            MouseManager.GetInstance().mouseReleasedListeners += ((MouseClickListener)this).OnMouseRelease;
            MouseManager.GetInstance().mouseMotionListeners += ((MouseMotionListener)this).OnMouseMotion;
            MouseManager.GetInstance().mouseDragListeners += ((MouseMotionListener)this).OnMouseDrag;

            /*XNAPanel panel = new XNAPanel(null, new Rectangle(
                this.graphics.PreferredBackBufferWidth / 2 - 200,
                this.graphics.PreferredBackBufferHeight / 2 - 200,
                400, 400));
            XNAButton button = new XNAButton(panel, new Rectangle(10, 10, 100, 40), "");*/

            base.Initialize();
        }