Beispiel #1
0
        public CollisionDemo()
        {
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            DisplayMode displayMode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;
            this._graphics.PreferredBackBufferFormat = displayMode.Format;
            this._graphics.PreferredBackBufferWidth = (int)(displayMode.Width / 1.1);
            this._graphics.PreferredBackBufferHeight = (int)(displayMode.Height / 1.1);

            _ball1 = new Ball(this, "BallR", 2, 1);
            _ball2 = new Ball(this, "BallB", 2, 1);
            _rect1 = new AxisAlignedRectangle(this, "RectB", 2, 1);
            Reset();

            this.Components.Add(_ball1);
            //this.Components.Add(_ball2);
            this.Components.Add(_rect1);

            IEnumerable<ICollidable> collidableObjects = this.Components.OfType<ICollidable>();

            _collisionManager = new CollisionManager(this, collidableObjects);
        }
Beispiel #2
0
        public CollisionDemo()
        {
            _graphics             = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            DisplayMode displayMode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;

            this._graphics.PreferredBackBufferFormat = displayMode.Format;
            this._graphics.PreferredBackBufferWidth  = (int)(displayMode.Width / 1.1);
            this._graphics.PreferredBackBufferHeight = (int)(displayMode.Height / 1.1);

            _ball1 = new Ball(this, "BallR", 2, 1);
            _ball2 = new Ball(this, "BallB", 2, 1);
            _rect1 = new AxisAlignedRectangle(this, "RectB", 2, 1);
            Reset();

            this.Components.Add(_ball1);
            //this.Components.Add(_ball2);
            this.Components.Add(_rect1);

            IEnumerable <ICollidable> collidableObjects = this.Components.OfType <ICollidable>();

            _collisionManager = new CollisionManager(this, collidableObjects);
        }