示例#1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            //(ConsoleWindow = new ConsoleWindow()).Show();
            //ConsoleWindow.OnInput += new ConsoleWindow.ConsoleInputEventHandler(OnConsoleInput);

            //ConsoleWindow.LogTimestamp = false;
            //ConsoleWindow.Log("Welcome to my SpaceSim game in development.");
            //ConsoleWindow.LogTimestamp = true;

            using (SpaceGame game = new SpaceGame())
            {
                SpaceSimLibrary.Networking.Server.StartServer();
                game.Run();
            }

            /*
             * using (SpaceSimGame game = new SpaceSimGame(GameDisplayType.Cockpit))
             * {
             *  SpaceSimLibrary.Networking.Server.StartServer();
             *  game.Run();
             * }
             */
            /*
             * List<ManualResetEvent> manualEvents = new List<ManualResetEvent>();
             * manualEvents.Add(SpawnThread(GameDisplayType.Cockpit));
             * manualEvents.Add(SpawnThread(GameDisplayType.LeftSide));
             * WaitHandle.WaitAll(manualEvents.ToArray());
             */
        }
示例#2
0
        public InputManager(SpaceGame game, GameManager gameManager, ShipEntity playerEntity)
        {
            this.game                 = game;
            this.gameManager          = gameManager;
            this.playerEntity         = playerEntity;
            savedMousePosX            = -1;
            savedMousePosY            = -1;
            mouseSmoothingCache       = new Vector2[MOUSE_SMOOTHING_CACHE_SIZE];
            mouseSmoothingSensitivity = DEFAULT_MOUSE_SMOOTHING_SENSITIVITY;
            mouseIndex                = 0;
            mouseMovement             = new Vector2[2];
            mouseMovement[0].X        = 0.0f;
            mouseMovement[0].Y        = 0.0f;
            mouseMovement[1].X        = 0.0f;
            mouseMovement[1].Y        = 0.0f;

            Rectangle clientBounds = game.Window.ClientBounds;

            Mouse.SetPosition(clientBounds.Width / 2, clientBounds.Height / 2);
        }