Exemplo n.º 1
0
        private void DrawMenuPiece(SpriteBatch spriteBatch, TileSheet menu, Color color, int addX, int addY)
        {
            //draw background
            //top-left
            menu.DrawTile(spriteBatch, new Vector2(Bounds.X, Bounds.Y), addX, addY, color);
            //top-right
            menu.DrawTile(spriteBatch, new Vector2(Bounds.End.X - menu.TileWidth, Bounds.Y), addX + 2, addY, color);
            //bottom-right
            menu.DrawTile(spriteBatch, new Vector2(Bounds.End.X - menu.TileWidth, Bounds.End.Y - menu.TileHeight), addX + 2, addY + 2, color);
            //bottom-left
            menu.DrawTile(spriteBatch, new Vector2(Bounds.X, Bounds.End.Y - menu.TileHeight), addX, addY + 2, color);

            //top
            menu.DrawTile(spriteBatch, new Rectangle(Bounds.X + menu.TileWidth, Bounds.Y, Bounds.End.X - Bounds.X - 2 * menu.TileWidth, menu.TileHeight), addX + 1, addY, color);

            //right
            menu.DrawTile(spriteBatch, new Rectangle(Bounds.End.X - menu.TileWidth, Bounds.Y + menu.TileHeight, menu.TileWidth, Bounds.End.Y - Bounds.Y - 2 * menu.TileHeight), addX + 2, addY + 1, color);

            //bottom
            menu.DrawTile(spriteBatch, new Rectangle(Bounds.X + menu.TileWidth, Bounds.End.Y - menu.TileHeight, Bounds.End.X - Bounds.X - 2 * menu.TileWidth, menu.TileHeight), addX + 1, addY + 2, color);

            //left
            menu.DrawTile(spriteBatch, new Rectangle(Bounds.X, Bounds.Y + menu.TileHeight, menu.TileWidth, Bounds.End.Y - Bounds.Y - 2 * menu.TileHeight), addX, addY + 1, color);

            //center
            menu.DrawTile(spriteBatch, new Rectangle(Bounds.X + menu.TileWidth, Bounds.Y + menu.TileHeight, Bounds.End.X - Bounds.X - 2 * menu.TileWidth, Bounds.End.Y - Bounds.Y - 2 * menu.TileHeight), addX + 1, addY + 1, color);
        }
Exemplo n.º 2
0
        //kind of like a menu, but not quite (uses borders)
        //draws the portrait

        public void Draw(SpriteBatch spriteBatch, Loc offset)
        {
            PortraitSheet portrait = GraphicsManager.GetPortrait(Speaker);

            Loc drawLoc = Loc + offset;

            if (!Bordered)
            {
                portrait.DrawPortrait(spriteBatch, new Vector2(drawLoc.X, drawLoc.Y), SpeakerEmotion);
            }
            else
            {
                int addX = 3 * MenuBase.BorderStyle;
                int addY = 3 * MenuBase.BorderFlash;

                TileSheet sheet = GraphicsManager.PicBorder;
                //pic
                portrait.DrawPortrait(spriteBatch, new Vector2(drawLoc.X + sheet.TileWidth, drawLoc.Y + sheet.TileHeight), SpeakerEmotion);

                //top-left
                sheet.DrawTile(spriteBatch, new Vector2(drawLoc.X, drawLoc.Y), addX, addY);
                //top-right
                sheet.DrawTile(spriteBatch, new Vector2(drawLoc.X + sheet.TileWidth + GraphicsManager.PortraitSize, drawLoc.Y), addX + 2, addY);
                //bottom-right
                sheet.DrawTile(spriteBatch, new Vector2(drawLoc.X + sheet.TileWidth + GraphicsManager.PortraitSize, drawLoc.Y + sheet.TileHeight + GraphicsManager.PortraitSize), addX + 2, addY + 2);
                //bottom-left
                sheet.DrawTile(spriteBatch, new Vector2(drawLoc.X, drawLoc.Y + sheet.TileHeight + GraphicsManager.PortraitSize), addX, addY + 2);

                //top
                sheet.DrawTile(spriteBatch, new Rectangle(drawLoc.X + sheet.TileWidth, drawLoc.Y, GraphicsManager.PortraitSize, sheet.TileHeight), addX + 1, addY, Color.White);

                //right
                sheet.DrawTile(spriteBatch, new Rectangle(drawLoc.X + sheet.TileWidth + GraphicsManager.PortraitSize, drawLoc.Y + sheet.TileHeight, sheet.TileWidth, GraphicsManager.PortraitSize), addX + 2, addY + 1, Color.White);

                //bottom
                sheet.DrawTile(spriteBatch, new Rectangle(drawLoc.X + sheet.TileWidth, drawLoc.Y + sheet.TileHeight + GraphicsManager.PortraitSize, GraphicsManager.PortraitSize, sheet.TileHeight), addX + 1, addY + 2, Color.White);

                //left
                sheet.DrawTile(spriteBatch, new Rectangle(drawLoc.X, drawLoc.Y + sheet.TileHeight, sheet.TileWidth, GraphicsManager.PortraitSize), addX, addY + 1, Color.White);
            }
        }