示例#1
0
        /// <summary>
        /// Should be called in load content.
        /// </summary>
        public void Initialize(GameContext initialContext)
        {
            canvas = new Canvas(graphics, graphicsDevice);
            #if DEBUG
            canvas.DebugMode = true;
            #else
            canvas.DebugMode = false;
            #endif
            // Initialize audio player.
            audioPlayer = new AudioPlayer();
            assets = new AssetManager();
            exitGame = false;

            //launch initialize asynchronously
            //ThreadPool.QueueUserWorkItem(new WaitCallback(InitializeNextContext));
            asyncFinished = true;
            /*Thread t = new Thread(new ThreadStart(InitializeNextContext));
            t.IsBackground = true;
            t.Start();*/

            // load all content
            assets.LoadContent(content, graphicsDevice);
            canvas.LoadContent(assets);
            inputController = new InputController(assets);
            fileManager = new DataCenter(assets);
            InitializeContextComponents(initialContext);
            currentContext = initialContext;

            inputController.Update();

            currentOverlayAlpha = 0;
        }