Example #1
0
        private void ProcessKeyboardHome()
        {
            KeyboardState keybState = Keyboard.GetState();
            if (keybState.IsKeyDown(Keys.Enter))
            {
                Constant.LoadFromText(textboxAddress.Text);
                if(networkClient!=null)
                networkClient.StopListening();

                networkClient = NetworkClient.getInstance(Constant.SERVER_IP, Constant.SEND_PORT, Constant.LISTEN_PORT);

                //Join the game
                networkClient.Send("JOIN#");

                networkClient.StartListening();

                //To send messages
                msgSender = new Game.AI.MessageSender(networkClient);
                isHome = false;
            }
        }
Example #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            //Graphic initialize
            device = graphics.GraphicsDevice;
            graphics.PreferredBackBufferWidth = 1000;
            graphics.PreferredBackBufferHeight = 600;

            screenWidth = graphics.PreferredBackBufferWidth;
            screenHeight = graphics.PreferredBackBufferHeight;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();
            Window.Title = "Crash & Burn";

            //Game Details
            gameDetail = new GameDetail();
            drawingManager = new DrawingManager(graphics,this.Content,gameDetail);
            msgSender = new Game.AI.MessageSender(networkClient);

            //Keyboard Dispatcher
            keyboard_dispatcher = new KeyboardDispatcher(this.Window);

            Constant.Load();

            base.Initialize();
        }