/// <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() { // TODO: Add your initialization logic here base.Initialize(); initializeScreen(); Settings.initialize(this); #if XBOX Settings.getInstance().IsUsingMouse_ = false; #else if (GamePad.GetState(PlayerIndex.One).IsConnected) { Settings.getInstance().IsUsingMouse_ = false; } else { Settings.getInstance().IsUsingMouse_ = true; } #endif try { // Debugging - Uncomment this line to try PC version as if it // were running with the Redistributable runtime in which // GamerServices is not available // Note that this is not a truly accurate test, as there could // be lurking calls to GamerServices outside of a block which // tests Settings.IsGamerServicesAllowed_ prior to using // throw new Exception(); GamerServicesComponent gsc = new GamerServicesComponent(this); gsc.Initialize(); this.Components.Add(gsc); Settings.getInstance().IsGamerServicesAllowed_ = true; } catch { Settings.getInstance().IsGamerServicesAllowed_ = false; } // creating EngineStateStart must come AFTER setting the // IsGamerServicesAllowed_ member of Settings this.engineState_ = new EngineStateSplash(this); int tiles = (int)((GraphicsDevice.Viewport.Height / 15) * (GraphicsDevice.Viewport.Width / 15) * 1.2); tiles += 350; DrawBuffer.initialize(tiles, spriteBatch_); DrawBuffer_ = DrawBuffer.getInstance(); UpdateThread_ = new UpdateThread(this, engineState_); RenderThread_ = new RenderThread(); UpdateThread_.Controls_ = Controls_; UpdateThread_.startThread(); }