Ejemplo n.º 1
0
        /// <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();

                REngine.Instance._graphics = graphics;

                //REngine.Instance._resourceContent = new ResourceContentManager(Services, Resources.ResourceManager);
            #if !XBOX
                //REngine.Instance._systemfont = REngine.Instance._resourceContent.Load<SpriteFont>("Arial");
            #else
                //REngine.Instance._systemfont = REngine.Instance._resourceContent.Load<SpriteFont>("Tahoma1");
            #endif
                game.Init();

            #if XBOX
                services = new GamerServicesComponent(this);
                services.Initialize();
                this.Components.Add(services);

            #endif

                //pmv = new pmv1(this, graphics);
                //pmv.Initialize();
                //Components.Add(pmv);
            #if !XBOX
                //this.TargetElapsedTime = TimeSpan.FromMilliseconds(1.0);
                //this.InactiveSleepTime = TimeSpan.FromMilliseconds(1.0);
                //this.IsFixedTimeStep = false;
            #endif
                //graphics.PreferredBackBufferFormat = SurfaceFormat.Color;
                //graphics.PreferredDepthStencilFormat = DepthFormat.Depth32;
            #if !XBOX
                this.graphics.SynchronizeWithVerticalRetrace = true;
                this.graphics.PreferMultiSampling = false;
            #else
                this.graphics.SynchronizeWithVerticalRetrace = true;
                this.graphics.PreferMultiSampling = false;
            #endif

                this.graphics.ApplyChanges();
            #if !XBOX || !XBOX360
                //this.graphics.MinimumPixelShaderProfile = ShaderProfile.PS_3_0;
                //this.graphics.MinimumVertexShaderProfile = ShaderProfile.VS_3_0;
            #endif

                game.Load();
        }
Ejemplo n.º 2
0
        /// <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();
        }
        public override void Initialize () {
#if XBOX
            _Component = new GamerServicesComponent(Game);
            _Component.Initialize();
#endif
        }