Exemplo n.º 1
0
        /// <summary>
        /// Renders text using the style (not finished yet).
        /// </summary>
        /// <param name="g"></param>
        /// <param name="s"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void render(IRenderer r, string s, int x, int y)
        {
            if (shadowOffsets == null)
            {
                this.shadowOffsets = OrthoDirection.getOffsets(this.shadowDir);
            }

            //draw the shadow
            int i;

            for (i = 0; i < shadowOffsets.Length; i++)
            {
                r.DrawString(shadowColour, s, this.font, x + shadowOffsets[i].X, y + shadowOffsets[i].Y);
            }


            r.DrawString(textColour, s, this.font, x, y);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Renders text using the style (not finished yet).
        /// </summary>
        /// <param name="g"></param>
        /// <param name="s"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void render(Graphics g, string s, int x, int y)
        {
            if (shadowOffsets == null)
            {
                this.shadowOffsets = OrthoDirection.getOffsets(this.shadowDir);
            }

            //draw the shadow
            int i;

            for (i = 0; i < shadowOffsets.Length; i++)
            {
                g.DrawString(s, this.font, this.generateShadowBrush(), x + shadowOffsets[i].X, y + shadowOffsets[i].Y);
            }


            g.DrawString(s, this.font, this.generateBrush(), x, y);
        }
Exemplo n.º 3
0
    static public bool orthoXZ = false;         // false = XY, true = XZ
    public static HexCoordinates MoveInBounds(this HexParameters P, HexCoordinates C, OrthoDirection d)
    {
        HexCoordinates[] neighbors;
        switch (d)
        {
        case OrthoDirection.N:
            if (orthoXZ)
            {
                neighbors = new HexCoordinates[] {
                    C.Neighbor(HexDirection.NW),
                    C.Neighbor(HexDirection.NE)
                };
            }
            else
            {
                neighbors = new HexCoordinates[] {
                    C.Neighbor(HexDirection.NE),
                    C.Neighbor(HexDirection.NW)
                };
            }
            break;

        case OrthoDirection.E:
            neighbors = new HexCoordinates[] {
                C.Neighbor(HexDirection.E),
                C.Neighbor(HexDirection.SE),
                C.Neighbor(HexDirection.NE)
            };
            break;

        case OrthoDirection.S:
            if (orthoXZ)
            {
                neighbors = new HexCoordinates[] {
                    C.Neighbor(HexDirection.SE),
                    C.Neighbor(HexDirection.SW)
                };
            }
            else
            {
                neighbors = new HexCoordinates[] {
                    C.Neighbor(HexDirection.SW),
                    C.Neighbor(HexDirection.SE)
                };
            }
            break;

        case OrthoDirection.W:
            neighbors = new HexCoordinates[] {
                C.Neighbor(HexDirection.W),
                C.Neighbor(HexDirection.NW),
                C.Neighbor(HexDirection.SW)
            };
            break;

        default:
            neighbors = new HexCoordinates[0];
            break;
        }
        foreach (HexCoordinates N in neighbors)
        {
            if (!P.OutOfBounds(N))
            {
                return(N);
            }
        }
        return(C);
    }