Beispiel #1
0
        protected override void Initialize()
        {
            base.Initialize();

            var sizeChangeGuardian = WindowSizeChangeGuardian.Install(this);

            sizeChangeGuardian.WindowSizeChanged += HandleClientSizeChanged;

            IsMouseVisible           = true;
            Window.AllowUserResizing = true;

            var inputManager = new InputManager(this);

            inputManager.UpdateOrder = -10;

            var uiComponent = UIManagerComponent.CreateAndInit(this, inputManager, "Content");

            uiComponent.DrawOrder   = 10;
            uiComponent.UpdateOrder = -5;
            windowService           = uiComponent.Manager.ScreenService.WindowService;
            NavigationUI.SetupStyles(uiComponent.Manager);

            var stateManager = new NamedGameStateManager(this);

            stateManager.UpdateOrder        = 0;
            stateManager.DrawOrder          = 0;
            stateManager.States["start"]    = new GameStateInitialSelection(this, stateManager, uiComponent.Manager);
            stateManager.States["dungeon"]  = new GameStateDungeonGame(this, uiComponent.Manager);
            stateManager.States["strategy"] = new GameStateStrategyGame(this, uiComponent.Manager);
            stateManager.SwitchState(stateManager.States["start"]);
            Components.Add(stateManager);

            this.CenterOnScreen();
        }
Beispiel #2
0
        protected override void Initialize()
        {
            base.Initialize();


            Window.Title             = "NuclearWinter Sample";
            Window.AllowUserResizing = true;
            IsMouseVisible           = false;

            var inputManager   = new InputManager(this);
            var drawingService = new BatchedDrawingService(this);

            // Game states; skipping intro state for debugging purposes ..
            var stateManager  = new NamedGameStateManager(this);
            var windowService = new WindowsGameWindowService(this);

            windowService.MouseCursorService = new WinFormsMouseCursorService(this);

            //stateManager.States["Intro"] = new GameStateIntro(this, drawingService, stateManager, "Main");
            stateManager.States["Main"] = new GameStateMainMenu(this, drawingService, inputManager, stateManager, windowService);
            stateManager.SwitchState(stateManager.States["Main"]);

            Components.Add(inputManager);
            Components.Add(stateManager);
            Components.Add(new DebugOverlayRenderer(this));

            this.CenterOnScreen();
        }