Example #1
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();
        }
Example #2
0
        public GameStateIntro(NuclearSampleGame game, BatchedDrawingService drawingService, INamedStateManager stateService, string nextState) : base(drawingService)
        {
            Game = game;
            this.stateService = stateService;
            this.nextState    = nextState;

            Content = new ContentManager(game.Services)
            {
                RootDirectory = "Content"
            };
        }
        public static UIManagerComponent Create(Game game, IInputManager inputManager, string rootDirectory = null)
        {
            rootDirectory = rootDirectory ?? "Content";

            var drawingService = new BatchedDrawingService(game);
            var windowService  = new GameWindowService(game);
            var cm             = new ContentManager(game.Services)
            {
                RootDirectory = rootDirectory
            };

            var uiManager = new UIManager(inputManager, drawingService, windowService, cm);

            uiManager.Start();

            var component = new UIManagerComponent(game, uiManager)
            {
                UpdateOrder = 100000,
                DrawOrder   = 100000
            };

            return(component);
        }