コード例 #1
0
ファイル: MenuView.cs プロジェクト: calebperkins/Ensembler
 public MenuView(Game g, SpriteBatch sb, MenuController c)
 {
     spriteBatch = sb;
     game = g;
     menu = c;
 }
コード例 #2
0
ファイル: GameEngine.cs プロジェクト: calebperkins/Ensembler
        /// <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()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            buffer = new InputBuffer();
            gameState = new GameState();
            gameState.LoadContent(Content); // hack

            try
            {
                input = new WiiController(this, gameState, buffer);
            }
            catch (WiimoteLib.WiimoteNotFoundException)
            {
                input = new MouseController(this, gameState, buffer);
            }

            Services.AddService(typeof(GameState), gameState);

            menuController = new MenuController(this, gameState, spriteBatch);
            menuController.Initialize();

            levelController = new LevelSelectController(gameState, spriteBatch);
            levelController.Initialize();

            playlevel = new PlayLevel(this, gameState, spriteBatch, buffer);
            playlevel.Initialize();

            worldController = new WorldMapController(this, gameState, spriteBatch, buffer);
            worldController.Initialize();
            gameState.world = worldController;
            pauseController = new PauseScreenController(this, spriteBatch);
            pauseController.Initialize();

            Components.Add(new GamerServicesComponent(this));
            Components.Add(new Components.SaveManager(this));

            Components.Add(new BatonView(this, spriteBatch));

            base.Initialize();
        }