示例#1
0
        //  The GameClass constructor.  Here we create, but not show, the GameSettings form.
        // The
        public GameClass(MainClass mainClass, Control owner)
        {
            gameState      = GameStates.Loading;
            this.owner     = owner;
            this.mainClass = mainClass;
            splash         = new SplashScreen(this);
            splash.ShowDialog();
            gameSettings          = new SpaceWar.GameSettings(this);
            gameSettings.Location = new Point(owner.Bounds.Right, owner.Bounds.Top);
            gravity        = gameSettings.Gravity;
            gameSpeed      = gameSettings.GameSpeed;
            bounceBack     = gameSettings.Bounce;
            inverseGravity = gameSettings.InverseGravity;
            blackHole      = gameSettings.BlackHole;

            localDevice = new Microsoft.DirectX.DirectDraw.Device();
            localDevice.SetCooperativeLevel(owner, Microsoft.DirectX.DirectDraw.CooperativeLevelFlags.Normal);

            DXUtil.Timer(DirectXTimer.Start);

            SpaceWar.RotatableShape.CreateShapes();

            input = new InputClass(this.owner);

            soundHandler = new SoundHandler(this.owner);

            try {
                netPeer = new PlayClass(this);
            }
            catch (DirectXException e) {
                MessageBox.Show(owner, e.ToString());
            }
        }
        //  The GameClass constructor.  Here we create, but not show, the GameSettings form.
        // The
        public GameClass(MainClass mainClass, Control owner)
        {
            gameState = GameStates.Loading;
            this.owner = owner;
            this.mainClass = mainClass;
            splash = new SplashScreen(this);
            splash.ShowDialog();
            gameSettings = new SpaceWar.GameSettings(this);
            gameSettings.Location = new Point(owner.Bounds.Right,owner.Bounds.Top);
            gravity = gameSettings.Gravity;
            gameSpeed = gameSettings.GameSpeed;
            bounceBack = gameSettings.Bounce;
            inverseGravity = gameSettings.InverseGravity;
            blackHole = gameSettings.BlackHole;

            localDevice = new Microsoft.DirectX.DirectDraw.Device();
            localDevice.SetCooperativeLevel(owner, Microsoft.DirectX.DirectDraw.CooperativeLevelFlags.Normal);

            DXUtil.Timer(DirectXTimer.Start);

            SpaceWar.RotatableShape.CreateShapes();

            input = new InputClass(this.owner);

            soundHandler = new SoundHandler(this.owner);

            try {
                netPeer = new PlayClass(this);
            }
            catch(DirectXException e) {
                MessageBox.Show(owner,e.ToString());
            }
        }