public override void Draw(GameTime gameTime) { base.Draw(gameTime); ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, new Color(35, 35, 35), 0, 0); SpriteBatch sb = ScreenManager.SpriteBatch; ////////////////////////////////////////////////////// ////////////////////DRAW WORLD//////////////////////// ////////////////////////////////////////////////////// #region DRAW WORLD //sb.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, cam.get_transformation(ScreenManager.GraphicsDevice)); sb.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, cam.get_transformation(ScreenManager.GraphicsDevice)); // draw here --------------------------------------- map.Draw(sb, gameTime); foreach (var i in items) { i.Draw(sb); } loManager.Draw(sb, gameTime); player.Draw(sb, gameTime); sb.Draw(ScreenManager.box, new Rectangle(Helper.ToPoint(Input.mWorldPos(cam, ScreenManager.GraphicsDevice) - new Vector2(2)), new Point(4)), Color.MonoGameOrange); sb.End(); #endregion ////////////////////////////////////////////////////// ////////////////////DRAW SCREEN/////////////////////// ////////////////////////////////////////////////////// #region DRAW SCREEN sb.Begin(); popManager.Draw(sb); player.DrawInventory(sb); Extras.DrawDebug(sb, "playing", 0); Extras.DrawDebug(sb, $"hp:{player.Health}/{player.MaxHealth} mana:{player.Mana}/{player.MaxMana} xp:{player.Exp}/{player.MaxExp} lv:{player.Level}", 3); Extras.DrawDebug(sb, $"mPos:{new Vector2((int)Input.mWorldPos(cam, ScreenManager.GraphicsDevice).X, (int)Input.mWorldPos(cam, ScreenManager.GraphicsDevice).Y) } | tilePos:{Helper.FixPos(Input.mWorldPos(cam, ScreenManager.GraphicsDevice), 32)} | tile:{Helper.FixPos(Input.mWorldPos(cam, ScreenManager.GraphicsDevice), 32) / 32}", 5); Extras.DrawDebug(sb, $"spawn enemy: {spawnEnemy} (enter)", 6); sb.End(); #endregion }
public virtual void Draw(SpriteBatch sb) { sb.Draw(Texture, Rectangle, Color); if (Text.Msg != null) { var pos = Helper.Center(Rectangle, Text.Size); if (CentreText) { //if (Quantity > 0) //Extras.DrawString(sb, Text.Font, Text.Msg + " x" + Quantity, pos, new Color(Text.Color, Alpha)); //else Extras.DrawString(sb, Text.Font, Text.Msg, pos, new Color(Text.Color, Alpha)); } //if (Quantity > 0) //Extras.DrawString(sb, Text.Font, Text.Msg + " x" + Quantity, Text.Position, new Color(Text.Color, Alpha)); else { Extras.DrawString(sb, Text.Font, Text.Msg, Text.Position, new Color(Text.Color, Alpha)); } } }