Exemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            BasicEffect be = new BasicEffect(GraphicsDevice);
            be.VertexColorEnabled = true;

            Random random = new Random();
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _players = new Genesoid[10];
            for (int p = 0; p < _players.Length; p++)
            {
                Genesoid player = new Genesoid(this.GraphicsDevice, 1.5f, Color.White);
                player.Position = new Vector3(RandomFloat(random, -10f, 10f), 0f, RandomFloat(random, -10f, 10f));
                player.Velocity = new Vector3(
                    RandomFloat(random, -20f, 20f),
                    0f,
                    RandomFloat(random, -20f, 20f));
                _players[p] = player;
            }

            _font = Content.Load<SpriteFont>(@"Fonts/Font");
            FrameRate fr = new FrameRate(this, _spriteBatch, _font);
            Components.Add(fr);

            _label = new Label(this, _spriteBatch, _font);
            _label.Position = new Vector2(0, 20);
            Components.Add(_label);

            _label2 = new Label(this, _spriteBatch, _font);
            _label2.Position = new Vector2(0, 40);
            Components.Add(_label2);
            _label3 = new Label(this, _spriteBatch, _font);
            _label3.Position = new Vector2(0, 60);
            Components.Add(_label3);
            _label4 = new Label(this, _spriteBatch, _font);
            _label4.Position = new Vector2(0, 80);
            Components.Add(_label4);
            _label5 = new Label(this, _spriteBatch, _font);
            _label5.Position = new Vector2(0, 100);
            Components.Add(_label5);
            _label6 = new Label(this, _spriteBatch, _font);
            _label6.Position = new Vector2(0, 120);
            Components.Add(_label6);

            _cursor = new Cursor(this, _gameCamera);

            _label.Caption = "Camera";
            _label.Value = _gameCamera.Position.ToString();
            _label2.Caption = "Up";
            _label2.Value = _gameCamera.Up.ToString();
            _label3.Caption = "Theta";
            _label3.Value = _gameCamera.Theta.ToString();
            _label4.Caption = "Target";
            _label4.Value = _gameCamera.Target.ToString();
            _label5.Caption = "Mouse";
            _label5.Value = _cursor.Position.ToString();
            _label6.Caption = "ViewPort";
            _label6.Value = GraphicsDevice.Viewport.ToString();


            _line = new RoundedLine(GraphicsDevice, 3f, 20f, 20, Color.Yellow);
            _line.Position = Vector3.Zero;
            _line.Velocity = Vector3.Zero;
            _line.Rotation = new Vector3(0, 0, 0);
        }
Exemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            BasicEffect be = new BasicEffect(GraphicsDevice);
            be.VertexColorEnabled = true;

            Random random = new Random();
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _font = Content.Load<SpriteFont>(@"Fonts/Font");
            
            FrameRate fr = new FrameRate(this, _spriteBatch, _font);
            Components.Add(fr);

            _label = new Label(this, _spriteBatch, _font);
            _label.Position = new Vector2(0, 20);
            Components.Add(_label);

            _label2 = new Label(this, _spriteBatch, _font);
            _label2.Position = new Vector2(0, 40);
            Components.Add(_label2);
            _label3 = new Label(this, _spriteBatch, _font);
            _label3.Position = new Vector2(0, 60);
            Components.Add(_label3);
            _label4 = new Label(this, _spriteBatch, _font);
            _label4.Position = new Vector2(0, 80);
            Components.Add(_label4);
            _label5 = new Label(this, _spriteBatch, _font);
            _label5.Position = new Vector2(0, 100);
            Components.Add(_label5);
            _label6 = new Label(this, _spriteBatch, _font);
            _label6.Position = new Vector2(0, 120);
            Components.Add(_label6);

            _cursor = new Cursor(this, _gameCamera);

            _label.Caption = "Camera";
            _label.Value = _gameCamera.Position.ToString();
            _label2.Caption = "Up";
            _label2.Value = _gameCamera.Up.ToString();
            _label3.Caption = "Theta";
            _label3.Value = _gameCamera.Theta.ToString();
            _label4.Caption = "Target";
            _label4.Value = _gameCamera.Target.ToString();
            _label5.Caption = "Mouse";
            _label5.Value = _cursor.Position.ToString();
            _label6.Caption = "ViewPort";
            _label6.Value = GraphicsDevice.Viewport.ToString();

            CreateNetwork();
        }