示例#1
0
 public UITexture(int leftPoint, int topPoint, int panelWidth, int panelHeight, string textureAddress, Color colour, float layer, bool transform)
     : base(leftPoint, topPoint, panelWidth, panelHeight, colour, layer, transform)
 {
     texture = TextureManager.GetTexture(textureAddress);
 }
示例#2
0
 public Tooltip(int leftPoint, int topPoint, int panelWidth, int panelHeight, string textureAddress, Color color)
     : base(leftPoint, topPoint, panelWidth, panelHeight, color, 0.1f, true)
 {
     texture     = TextureManager.GetTexture(textureAddress);
     this.colour = color;
 }
示例#3
0
        public TextPanel(int leftPoint, int topPoint, int panelWidth, int panelHeight, string fontAddress, string displayText, Color colour, float scale, Origin origin, float spacing, float layer, bool transform)
            : base(leftPoint, topPoint, panelWidth, panelHeight, colour, layer, transform)
        {
            font         = TextureManager.GetFont(fontAddress);
            m_spacing    = spacing;
            text         = displayText;
            stringOffset = new Vector2(this.Bounds.Width * 0.5f, this.Bounds.Height * 0.5f);

            switch (origin)
            {
            case Origin.TOP_LEFT:
                stringOrigin = Vector2.Zero;
                break;

            case Origin.TOP_RIGHT:
                stringOrigin.X = font.MeasureString(displayText).X;
                stringOrigin.Y = 0;
                break;

            case Origin.TOP_CENTRE:
                stringOrigin.X = font.MeasureString(displayText).X * 0.5f;
                stringOrigin.Y = 0;
                break;

            case Origin.BOTTOM_LEFT:
                stringOrigin.X = 0;
                stringOrigin.Y = font.MeasureString(displayText).Y;
                break;

            case Origin.BOTTOM_RIGHT:
                stringOrigin.X = font.MeasureString(displayText).X;
                stringOrigin.Y = font.MeasureString(displayText).Y;
                break;

            case Origin.BOTTOM_CENTRE:
                stringOrigin.X = font.MeasureString(displayText).X * 0.5f;
                stringOrigin.Y = font.MeasureString(displayText).Y;
                break;

            case Origin.CENTRE_LEFT:
                stringOffset.X = 0;
                stringOrigin.Y = font.MeasureString(displayText).Y * 0.5f;
                break;

            case Origin.CENTRE_RIGHT:
                stringOrigin.X = font.MeasureString(displayText).X;
                stringOrigin.Y = font.MeasureString(displayText).Y * 0.5f;
                break;

            case Origin.CENTRE:
                stringOrigin.X = font.MeasureString(displayText).X * 0.5f;
                stringOrigin.Y = font.MeasureString(displayText).Y * 0.5f;
                break;

            default:
                //default to centre
                stringOrigin.X = font.MeasureString(displayText).X * 0.5f;
                stringOrigin.Y = font.MeasureString(displayText).Y * 0.5f;
                break;
            }

            this.scale = scale;
        }
示例#4
0
 public UIButton(int leftPoint, int topPoint, int panelWidth, int panelHeight, string textureAddress, Color colour, ClickMethod onClickMethod, float layer, bool transform)
     : base(leftPoint, topPoint, panelWidth, panelHeight, colour, layer, transform)
 {
     texture = TextureManager.GetTexture(textureAddress);
     method  = onClickMethod;
 }