Inheritance: Microsoft.Xna.Framework.Game
Beispiel #1
0
        public FinalBomber()
        {
            Instance = this;
            Graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth  = Config.Resolutions[Config.IndexResolution, 0],
                PreferredBackBufferHeight = Config.Resolutions[Config.IndexResolution, 1]
            };

            ScreenRectangle = new Rectangle(0, 0, Config.Resolutions[Config.IndexResolution, 0], Config.Resolutions[Config.IndexResolution, 1]);

#if DEBUG
            Graphics.SynchronizeWithVerticalRetrace = false;
#else
            Graphics.SynchronizeWithVerticalRetrace = true;
#endif
            // Don't fix FPS to 60 => this wont work when vsync is ON
            IsFixedTimeStep = false;

            Graphics.IsFullScreen = Config.FullScreen;
            Graphics.ApplyChanges();

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            var stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            TitleScreen                = new TitleScreen(this, stateManager);
            BattleMenuScreen           = new BattleMenuScreen(this, stateManager);
            SuddenDeathMenuScreen      = new SuddenDeathMenuScreen(this, stateManager);
            ItemMenuScreen             = new ItemMenuScreen(this, stateManager);
            GamePlayScreen             = new GamePlayScreen(this, stateManager);
            SinglePlayerGamePlayScreen = new SinglePlayerGamePlayScreen(this, stateManager);

            OptionMenuScreen = new OptionMenuScreen(this, stateManager);
            KeysMenuScreen   = new KeysMenuScreen(this, stateManager);
            CreditMenuScreen = new CreditMenuScreen(this, stateManager);

            SinglePlayerGameModeMenuScreen = new SinglePlayerGameModeMenuScreen(this, stateManager);
            LobbyMenuScreen               = new LobbyMenuScreen(this, stateManager);
            OnlineGameMenuScreen          = new OnlineGameMenuScreen(this, stateManager);
            MultiplayerGameModeMenuScreen = new MultiplayerGameModeMenuScreen(this, stateManager);
            UserMenuScreen             = new UserMenuScreen(this, stateManager);
            UserLoginMenuScreen        = new UserLoginMenuScreen(this, stateManager);
            UserRegistrationMenuScreen = new UserRegistrationMenuScreen(this, stateManager);
            NetworkMenuScreen          = new NetworkMenuScreen(this, stateManager);
            CreateServerMenuScreen     = new CreateServerMenuScreen(this, stateManager);
            JoinServerMenuScreen       = new JoinServerMenuScreen(this, stateManager);

            NetworkTestScreen = new NetworkGamePlayScreen(this, stateManager);

            stateManager.ChangeState(TitleScreen);

            // FPS
            Components.Add(new FrameRateCounter(this));

            _password = "";
        }
Beispiel #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            // For log
            XmlConfigurator.Configure();

            Assembly asm = Assembly.GetExecutingAssembly();

            using (var mutex = new Mutex(false, @"Global\" + asm.GetType().GUID))
            {
#if !DEBUG
                if (!mutex.WaitOne(0, false))
                {
                    Log.Error("Instance already running");
                    return;
                }

                GC.Collect();
#endif

                using (var game = new FinalBomber())
                {
                    try
                    {
                        game.Run();
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex.Message);
                        throw;
                    }
                }
            }
        }
Beispiel #3
0
        public FinalBomber()
        {
            Instance = this;
            Graphics = new GraphicsDeviceManager(this)
                {
                    PreferredBackBufferWidth = Config.Resolutions[Config.IndexResolution, 0],
                    PreferredBackBufferHeight = Config.Resolutions[Config.IndexResolution, 1]
                };

            ScreenRectangle = new Rectangle(0, 0, Config.Resolutions[Config.IndexResolution, 0], Config.Resolutions[Config.IndexResolution, 1]);

            #if DEBUG
            Graphics.SynchronizeWithVerticalRetrace = false;
            #else
            Graphics.SynchronizeWithVerticalRetrace = true;
            #endif
            // Don't fix FPS to 60 => this wont work when vsync is ON
            IsFixedTimeStep = false;

            Graphics.IsFullScreen = Config.FullScreen;
            Graphics.ApplyChanges();

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            var stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            TitleScreen = new TitleScreen(this, stateManager);
            BattleMenuScreen = new BattleMenuScreen(this, stateManager);
            SuddenDeathMenuScreen = new SuddenDeathMenuScreen(this, stateManager);
            ItemMenuScreen = new ItemMenuScreen(this, stateManager);
            GamePlayScreen = new GamePlayScreen(this, stateManager);
            SinglePlayerGamePlayScreen = new SinglePlayerGamePlayScreen(this, stateManager);

            OptionMenuScreen = new OptionMenuScreen(this, stateManager);
            KeysMenuScreen = new KeysMenuScreen(this, stateManager);
            CreditMenuScreen = new CreditMenuScreen(this, stateManager);

            SinglePlayerGameModeMenuScreen = new SinglePlayerGameModeMenuScreen(this, stateManager);
            LobbyMenuScreen = new LobbyMenuScreen(this, stateManager);
            OnlineGameMenuScreen = new OnlineGameMenuScreen(this, stateManager);
            MultiplayerGameModeMenuScreen = new MultiplayerGameModeMenuScreen(this, stateManager);
            UserMenuScreen = new UserMenuScreen(this, stateManager);
            UserLoginMenuScreen = new UserLoginMenuScreen(this, stateManager);
            UserRegistrationMenuScreen = new UserRegistrationMenuScreen(this, stateManager);
            NetworkMenuScreen = new NetworkMenuScreen(this, stateManager);
            CreateServerMenuScreen = new CreateServerMenuScreen(this, stateManager);
            JoinServerMenuScreen = new JoinServerMenuScreen(this, stateManager);

            NetworkTestScreen = new NetworkGamePlayScreen(this, stateManager);

            stateManager.ChangeState(TitleScreen);

            // FPS
            Components.Add(new FrameRateCounter(this));

            _password = "";
        }