private Control target = null; // Target for rendering operations.

        #endregion Fields

        #region Constructors

        public MainClass()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            target = this;

            // Add event handlers to enable moving and resizing
            this.MouseDown += new MouseEventHandler(OnMouseDown);
            this.MouseMove +=new MouseEventHandler(OnMouseMove);
            this.MouseUp += new MouseEventHandler(OnMouseUp);
            this.Resize += new System.EventHandler(OnMoveResize);
            this.Move +=new EventHandler(OnMoveResize);

            // Set up Double buffering to eliminate flicker
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.UserPaint, true);

            //Initialize the main game class
            game = new GameClass(this, target);
            game.Initialize(this.Bounds);

            //Show our game form
            this.Show();

            //Start the main game loop
            StartLoop();
        }
 public SplashScreen(GameClass game)
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     this.gameClass = game;
 }
        public GameSettings(GameClass game)
        {
            this.game = game;
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Set up the event handler
            this.gameSpeedSlider.ValueChanged += new EventHandler(ControlChanged);
            this.gravitySlider.ValueChanged +=new EventHandler(ControlChanged);
            this.bounceBack.CheckedChanged += new EventHandler(ControlChanged);
            this.inverseGravity.CheckedChanged +=new EventHandler(ControlChanged);
            this.blackHole.CheckedChanged += new EventHandler(ControlChanged);
        }
Ejemplo n.º 4
0
        public GameSettings(GameClass game)
        {
            this.game = game;
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Set up the event handler
            this.gameSpeedSlider.ValueChanged  += new EventHandler(ControlChanged);
            this.gravitySlider.ValueChanged    += new EventHandler(ControlChanged);
            this.bounceBack.CheckedChanged     += new EventHandler(ControlChanged);
            this.inverseGravity.CheckedChanged += new EventHandler(ControlChanged);
            this.blackHole.CheckedChanged      += new EventHandler(ControlChanged);
        }
        public PlayClass(GameClass Game)
        {
            this.game = Game;
            this.peerObject = peerObject;

            //Initialize our peer to peer network object
            peerObject = new Peer();

            // Set up our event handlers (We only need events for the ones we care about)
            peerObject.PlayerCreated += new PlayerCreatedEventHandler(game.PlayerCreated);
            peerObject.PlayerDestroyed += new PlayerDestroyedEventHandler(game.PlayerDestroyed);
            peerObject.Receive += new ReceiveEventHandler(game.DataReceived);
            peerObject.SessionTerminated += new SessionTerminatedEventHandler(SessionTerminated);

            // use the DirectPlay connection wizard to create our join sessions
            Connect = new ConnectWizard(peerObject, AppGuid, "SpacewarDX9");
            Connect.StartWizard();

            inSession = Connect.InSession;

            if (inSession) {
                isHost = Connect.IsHost;
            }
        }
Ejemplo n.º 6
0
 public Ship(GameClass game)
 {
     this.game = game;
     outline   = new RotatableShape();
 }
 public Ship(GameClass Game)
 {
     this.game = Game;
     outline = new RotatableShape();
 }