示例#1
0
        public static void DrawBorderedRect(SpriteBatch spriteBatch, Color color, Vector2 position, Vector2 size, int borderWidth, string text)
        {
            DrawBorderedRect(spriteBatch, color, position, size, borderWidth);
            Vector2 pos = ModUtils.GetWorldCoordsFromTileCoords(position) - Main.screenPosition;

            pos.X += 2;
            pos.Y += 2;
            spriteBatch.DrawString(Main.fontMouseText, text, pos, Color.White, 0f, Vector2.Zero, .7f, SpriteEffects.None, 0);
        }
示例#2
0
        public static void DrawBorderedRect(SpriteBatch spriteBatch, Color color, Color borderColor, Vector2 position, Vector2 size, int borderWidth)
        {
            size *= 16;
            Vector2 pos = ModUtils.GetWorldCoordsFromTileCoords(position) - Main.screenPosition;

            spriteBatch.Draw(ModUtils.DummyTexture, new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y), color);

            spriteBatch.Draw(ModUtils.DummyTexture, new Rectangle((int)pos.X - borderWidth, (int)pos.Y - borderWidth, (int)size.X + borderWidth * 2, borderWidth), borderColor);
            spriteBatch.Draw(ModUtils.DummyTexture, new Rectangle((int)pos.X - borderWidth, (int)pos.Y + (int)size.Y, (int)size.X + borderWidth * 2, borderWidth), borderColor);
            spriteBatch.Draw(ModUtils.DummyTexture, new Rectangle((int)pos.X - borderWidth, (int)pos.Y, (int)borderWidth, (int)size.Y), borderColor);
            spriteBatch.Draw(ModUtils.DummyTexture, new Rectangle((int)pos.X + (int)size.X, (int)pos.Y, (int)borderWidth, (int)size.Y), borderColor);
        }