Beispiel #1
0
        public GameForm()
            : base("Dewd", new Size(1024, 768), false)
        {
            InitializeGraphics();

            playerName = Utility.UserName;

            scores = new HighScoreTable(@"Data\HighScores.xml", 15);
            scores.Load();

            this.font = new Microsoft.DirectX.Direct3D.Font(this.Device, new System.Drawing.Font("Tahoma", 10));

            sprite = new Sprite(this.Device);
            texture = TextureLoader.FromFile(this.Device, @"Data\Graphics\dot.png");

            playerPosition = new PointF(this.Width / 2, this.Height / 2);

            playerSwarm = new Swarm(
                25,
                playerPosition,
                Color.Lime);

            playerSwarm.PlayerControlled = true;

            highestSwarm = 25;

            tribes = new Color[4]
            {
                Color.Black,
                Color.Crimson,
                Color.Orange,
                Color.Snow
            };

            this.swarms.Add(playerSwarm);

            timer = new Timer();
            timer.Interval = 5000;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Enabled = true;
            timer.Start();

            // defining our screen sized quad, note the Z value of 1f to place it in the background
            backgroundVertices[0].Position = new Vector4(0, 0, 1f, 1f);
            backgroundVertices[0].Color = System.Drawing.Color.SteelBlue.ToArgb();

            backgroundVertices[1].Position = new Vector4(this.ClientSize.Width, 0, 1f, 1f);
            backgroundVertices[1].Color = System.Drawing.Color.SteelBlue.ToArgb();

            backgroundVertices[2].Position = new Vector4(0, this.ClientSize.Height, 1f, 1f);
            backgroundVertices[2].Color = System.Drawing.Color.DarkSlateBlue.ToArgb();

            backgroundVertices[3].Position = new Vector4(this.ClientSize.Width, this.ClientSize.Height, 1f, 1f);
            backgroundVertices[3].Color = System.Drawing.Color.DarkSlateBlue.ToArgb();

            backgroundIndices = new short[] { 0, 1, 2, 1, 3, 2 };

            Utility.Timer(DirectXTimer.Start);

            timer_Tick(null, null);
            timer_Tick(null, null);
        }
Beispiel #2
0
        public GameForm()
            : base("Dewd", new Size(1024, 768), false)
        {
            InitializeGraphics();

            playerName = Utility.UserName;

            scores = new HighScoreTable(@"Data\HighScores.xml", 15);
            scores.Load();

            this.font = new Microsoft.DirectX.Direct3D.Font(this.Device, new System.Drawing.Font("Tahoma", 10));

            sprite  = new Sprite(this.Device);
            texture = TextureLoader.FromFile(this.Device, @"Data\Graphics\dot.png");

            playerPosition = new PointF(this.Width / 2, this.Height / 2);

            playerSwarm = new Swarm(
                25,
                playerPosition,
                Color.Lime);

            playerSwarm.PlayerControlled = true;

            highestSwarm = 25;

            tribes = new Color[4]
            {
                Color.Black,
                Color.Crimson,
                Color.Orange,
                Color.Snow
            };

            this.swarms.Add(playerSwarm);

            timer          = new Timer();
            timer.Interval = 5000;
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Enabled  = true;
            timer.Start();

            // defining our screen sized quad, note the Z value of 1f to place it in the background
            backgroundVertices[0].Position = new Vector4(0, 0, 1f, 1f);
            backgroundVertices[0].Color    = System.Drawing.Color.SteelBlue.ToArgb();

            backgroundVertices[1].Position = new Vector4(this.ClientSize.Width, 0, 1f, 1f);
            backgroundVertices[1].Color    = System.Drawing.Color.SteelBlue.ToArgb();

            backgroundVertices[2].Position = new Vector4(0, this.ClientSize.Height, 1f, 1f);
            backgroundVertices[2].Color    = System.Drawing.Color.DarkSlateBlue.ToArgb();

            backgroundVertices[3].Position = new Vector4(this.ClientSize.Width, this.ClientSize.Height, 1f, 1f);
            backgroundVertices[3].Color    = System.Drawing.Color.DarkSlateBlue.ToArgb();

            backgroundIndices = new short[] { 0, 1, 2, 1, 3, 2 };

            Utility.Timer(DirectXTimer.Start);

            timer_Tick(null, null);
            timer_Tick(null, null);
        }