コード例 #1
0
ファイル: LevelScreen.cs プロジェクト: CodeEdelmann/HideOut
        public override void Draw(GraphicsDevice gd)
        {
            gd.Clear(Color.White);

            //This block of code is a necessary ritual for the FOVs.  Just leave it be.
            gd.BlendState        = BlendState.Opaque;
            gd.DepthStencilState = DepthStencilState.Default;
            gd.SamplerStates[0]  = SamplerState.LinearWrap;
            Matrix projection      = Matrix.CreateOrthographicOffCenter(0, gd.Viewport.Width, gd.Viewport.Height, 0, 0, 1);
            Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0);

            basicEffect.World              = Matrix.Identity;
            basicEffect.View               = Matrix.Identity;
            basicEffect.Projection         = halfPixelOffset * projection;
            basicEffect.VertexColorEnabled = true;
            gd.RasterizerState             = RasterizerState.CullNone;

            if (!HideOutGame.LEVEL_DESIGN_MODE)
            {
                npcController.DrawFOVs(gd, basicEffect);
            }

            // TODO: Add your drawing code here
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, null, null);
            spriteBatch.Draw(bgTexture, new Rectangle(0 - HideOutGame.SCREEN_OFFSET_X, 0 - HideOutGame.SCREEN_OFFSET_Y, GAME_WIDTH, GAME_HEIGHT), new Rectangle(0, 0, GAME_WIDTH, GAME_HEIGHT), Color.Green);
            obstacleController.Draw(spriteBatch);
            itemController.Draw(spriteBatch);
            npcController.Draw(spriteBatch);
            playerController.Draw(spriteBatch);

            displayController.Draw(spriteBatch);
            displayController.drawStats(playerController.thePlayer.currentHunger, playerController.thePlayer.currentThirst, spriteBatch);


            //_fontRenderer.DrawText(spriteBatch, 50, 50, "Hello World!");



            spriteBatch.End();
        }