Exemple #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public void Draw(GameTime gameTime)
        {
            //DrawSelectionBuffer(gameTime, tile);
            DrawScreenBuffer(gameTime, Tiles);
            DrawSelectionBuffer(gameTime, Tiles);

            Utils.FPS = 1 / (float)gameTime.ElapsedGameTime.TotalSeconds;

            //var ScreenBackBuffe= Utils.CreateWobble(ScreenBackBuffer, gameTime);

            Camera.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend,
                                     SamplerState.LinearClamp, DepthStencilState.Default,
                                     RasterizerState.CullNone);

            Camera.SpriteBatch.Draw(ScreenOrSelection ? SelectionBackBuffer : ScreenBackBuffer, new Rectangle(0, 0, Graphics.GraphicsDevice.PresentationParameters.BackBufferWidth,
                                                                                                              Graphics.GraphicsDevice.PresentationParameters.BackBufferHeight), Color.White);
            if (Selector != null)
            {
                Selector.Draw(Camera.SpriteBatch);
            }
            if (Debug.DEBUG)
            {
                Camera.SpriteBatch.DrawString(UI.UIText.UIFrame.fonts[(int)UI.UIText.UIElement.Font.Arial],
                                              String.Format(
                                                  Debug.Debugstring,
                                                  Cam.Position.X,
                                                  Cam.Position.Y,
                                                  Cam.Position.Z,
                                                  Cam.Height,
                                                  Cam.Radius,
                                                  Cam.Rotation,
                                                  Cam.Target.X,
                                                  Cam.Target.Y,
                                                  Cam.Target.Z,
                                                  Cam.Rotation,
                                                  Tiles.Length, 0),
                                              //Utils.TextureTo2DArray(ScreenBackBuffe)[Mouse.GetState().X, Mouse.GetState().Y]),
                                              new Vector2(10, 50), Color.Black);
            }
            HelpButton.Draw(gameTime, Camera.SpriteBatch, 0);

            if (HelpButton.Toggled)
            {
                UI.UIText.UIFrame.Overlay.DrawImage(Camera.SpriteBatch, Graphics.GraphicsDevice, gameTime, Mouse.GetState(), false);
                //Utils.DrawTextCentered(Font, SmartGardenCamera.spriteBatch, new Vector2(Graphics.PreferredBackBufferWidth / 2f, Graphics.PreferredBackBufferHeight / 2f), Consts.HelpString, Color.Black);
            }



            Camera.SpriteBatch.End();
        }
        public void Draw(SpriteBatch spriteBatch, Vector2 position)
        {
            Vector2 offsets     = offset + position;
            Vector2 offsetIcons = offsets + offsetIcon;

            background.Draw(spriteBatch, offsets, 0.8f);

            imgLine.Draw(spriteBatch, new Vector2(114, 6) + offsets, 0.81f);
            imgHCBackdrop.Draw(spriteBatch, new Vector2(61, 2) + offsets, 0.81f);

            DiamondIcon.Draw(spriteBatch, new Vector2(0, 0) + offsetIcons, 0.81f);
            CreditIcon.Draw(spriteBatch, new Vector2(0, 19) + offsetIcons, 0.81f);
            DucketIcon.Draw(spriteBatch, new Vector2(0, 38) + offsetIcons, 0.81f);
            HCIcon.Draw(spriteBatch, new Vector2(78, 13) + offsets, 0.81f);

            HelpButton.Draw(spriteBatch, new Vector2(120, 3) + offsets, 0.81f);
            ExitButton.Draw(spriteBatch, new Vector2(120, 24) + offsets, 0.81f);
            SettingsButton.Draw(spriteBatch, new Vector2(120, 45) + offsets, 0.81f);

            txtDiamond.Draw(spriteBatch, offsets + new Vector2(38 - txtDiamond.measureString().X, 6));
            txtCredit.Draw(spriteBatch, offsets + new Vector2(38 - txtCredit.measureString().X, 24));
            txtDucket.Draw(spriteBatch, offsets + new Vector2(38 - txtDucket.measureString().X, 44));
            //100 = HC Text
        }