示例#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()
        {
            //Register our ContentManager
            //ContentButler.setGame(this);
            Master.Initialize(this);

            //Setup screen display/graphics device
            ViewportHandler.SetScreen(ScreenWidth, ScreenHeight);
            graphics.PreferredBackBufferWidth       = ViewportHandler.GetWidth();
            graphics.PreferredBackBufferHeight      = ViewportHandler.GetHeight();
            graphics.SynchronizeWithVerticalRetrace = true;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();
            Graphics.CGraphics.acquireGraphics(ref graphics);



            Master.SetClearColor(Color.CornflowerBlue);

            CTextures.init(Content);

            Master.Push(new DevMenu());
            //Master.Push(new PlayableState());

            Master.GetInputManager().AddInputHandler(new CInput());

            base.Initialize();
        }
示例#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()
        {
            //Register our ContentManager
            //ContentButler.setGame(this);
            Master.Initialize(this);

            //Setup screen display/graphics device
            ViewportHandler.SetScreen(ScreenWidth, ScreenHeight);
            graphics.PreferredBackBufferWidth       = ViewportHandler.GetWidth();
            graphics.PreferredBackBufferHeight      = ViewportHandler.GetHeight();
            graphics.SynchronizeWithVerticalRetrace = true;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();
            Graphics.CGraphics.acquireGraphics(ref graphics);
            graphics.SynchronizeWithVerticalRetrace = true;
            CGraphics.fullScreenRenderTarget        = new RenderTarget2D(CGraphics.GPU, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, true, SurfaceFormat.Color, DepthFormat.Depth24);

            _fpsTimer.Elapsed += new ElapsedEventHandler(_fpsHandler);
            _fpsTimer.Enabled  = true;
            _fpsTimer.Start();

            Master.SetClearColor(Color.Black);

            CTextures.init(Content);

            Master.Push(new DevMenu());
            //Master.Push(new PlayableState());

            Master.GetInputManager().AddInputHandler(new CInput());
            CMasterControl.glblInput        = Master.GetInputManager().GetCurrentInputHandler() as Input.CInput;
            CMasterControl.healthController = new Actors.HUD.health.CHealthController(20, 78);
            CMasterControl.magicMeter       = new Actors.HUD.magic.CMagicMeter();

            scaleMatrix = Matrix.CreateScale(
                3f,
                3f,
                1f);

            base.Initialize();
        }