コード例 #1
0
ファイル: Game1.cs プロジェクト: Aaron-Durant/Asteroids2
        /// <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()
        {
            // Initializes engine subsystems

            // Initializes the inputManager object
            inputM = new InputManager(this);
            // Initializes the eventManager object. Sets updates to 100/second and keeps draws at 60/second.
            eventM = new EventManager(this, 100, true);
            // Initializes the loadManager object
            loadM = new LoadManager(this);
            // Initializes the setupManager object
            setupM = new SetupManager();
            // Initializes the textManager object
            textM = new TextManager(this);
            // Initializes the menuManager object
            menuM = new MenuManager(this, textM);
            // Initializes the fileManager object
            fileM = new FileManager("Asteroids 2");
            // Initializes the engine object
            engine = new Engine(this, eventM, menuM);

            Components.Add(inputM);
            Components.Add(eventM);
            Components.Add(loadM);
            Components.Add(textM);
            Components.Add(menuM);
            Components.Add(engine);

            //// Set screen size
            engine.SetScreen(screenSize.Width, screenSize.Height);

            base.Initialize();
        }
コード例 #2
0
 /// <summary>
 /// Creates a new MenuManager
 /// </summary>
 /// <param name="g"> The Game object associated with the MenuManager </param>
 /// <param name="textM"> The TextManager used to draw the Menus</param>
 public MenuManager(Game g, TextManager textM)
     : base(g)
 {
     Menus = new List<Menu>();
     this.textM = textM;
 }