예제 #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
        private void InitializeLocal()
        {
            this._imageOrigin = getTextureOrigin();

            imageOffset = 300 + this._imageOrigin.Y;                  //testing, but fits the screen nicely.
            //imageOffset = 196 + this._imageOrigin.Y; //old, for 64x64
            radius = (ViewportHandler.GetHeight() / 2) + imageOffset; // bad chris
        }
예제 #3
0
        public TestCreditState()
        {
            int y = ViewportHandler.GetWidth();
            int x = ViewportHandler.GetHeight();

            foreach (string key in creditsData)
            {
                Credits.Add(new Credit());
                Credits[Credits.Count() - 1].creditText = key;
                Credits[Credits.Count() - 1].position.X = x / 2;
                Credits[Credits.Count() - 1].position.Y = y / 2;
                y += 100;
            }
            MenuText = "Credit Test";
            LoadContent();
        }
예제 #4
0
        protected override void LoadContent()
        {
            device      = graphics.GraphicsDevice;
            spriteBatch = new SpriteBatch(device);

            if (resultionIndependent)
            {
                GameResolutionWidth  = ViewportHandler.GetWidth();
                GameResolutionHeight = ViewportHandler.GetHeight();
            }
            else
            {
                GameResolutionWidth  = device.PresentationParameters.BackBufferWidth;
                GameResolutionHeight = device.PresentationParameters.BackBufferHeight;
            }
        }
예제 #5
0
        private void CreateGrid()
        {
            int screenWidth  = ViewportHandler.GetWidth();
            int screenHeight = ViewportHandler.GetHeight();

            int boxWidth  = screenWidth / gridBoxesHorizontal;
            int boxHeight = screenHeight / gridBoxesVertical;

            for (int x = 0; x <= screenWidth; x += boxWidth)
            {
                lines.Add(drawingHelper.CreateLine(1, Color.White, new Vector2(x, 0), new Vector2(x, screenHeight)));
            }
            for (int y = 0; y <= screenHeight; y += boxHeight)
            {
                lines.Add(drawingHelper.CreateLine(1, Color.White, new Vector2(0, y), new Vector2(screenWidth, y)));
            }
        }
예제 #6
0
파일: Game1.cs 프로젝트: mzaman07/kot-mono
        /// <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();
        }
예제 #7
0
 private void Initialize()
 {
     splashRectangle = new Rectangle(0, 0, ViewportHandler.GetWidth(), ViewportHandler.GetHeight());
 }
예제 #8
0
 private void InitializeLocal()
 {
     imageOffset = 196 + this._imageOrigin.Y;
     radius      = (ViewportHandler.GetHeight() / 2) + imageOffset;// bad chris
 }
예제 #9
0
        protected override void Draw(GameTime gameTime)
        {
            Vector3 screenScalingFactor;

            if (resultionIndependent)
            {
                float horScaling = (float)device.PresentationParameters.BackBufferWidth / ViewportHandler.GetWidth();
                float verScaling = (float)device.PresentationParameters.BackBufferHeight / ViewportHandler.GetHeight();
                screenScalingFactor = new Vector3(horScaling, verScaling, 1);
            }
            else
            {
                screenScalingFactor = new Vector3(1, 1, 1);
            }

            Matrix globalTransformation = Matrix.CreateScale(screenScalingFactor);



            /**************************************/
            device.Clear(Master.GetClearColor());

            //spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None, globalTransformation);
            spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, RasterizerState.CullNone, null, globalTransformation);
            //spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);//, SaveStateMode.None);//, ViewportHandler.GetScaleMatrix());

            Master.Draw(spriteBatch);

            spriteBatch.End();

            base.Draw(gameTime);
        }