示例#1
0
        public override void Draw()
        {
            base.Draw();

            // Final text offset is value * local scale
            float textOffsetX = textOffset * LocalScale.x;
            float textOffsetY = textOffset * LocalScale.y;

            // Do not draw cursor if read only or focus-enabled and does not have focus
            if (readOnly || (UseFocus && !HasFocus()))
            {
                textCursor.Enabled = false;
            }
            else
            {
                textCursor.Enabled = true;
            }

            if (text.Length > 0)
            {
                Rect rect = Rectangle;
                font.DrawText(text, new Vector2(rect.x + textOffsetX, rect.y + textOffsetY), LocalScale, DaggerfallUI.DaggerfallDefaultInputTextColor);
            }
            else
            {
                // Draw default text while nothing else entered
                if (defaultText.Length > 0)
                {
                    Rect rect = Rectangle;
                    font.DrawText(defaultText, new Vector2(rect.x + textOffsetX, rect.y + textOffsetY), LocalScale, defaultTextColor);
                }
            }
        }
示例#2
0
        public override void Draw()
        {
            base.Draw();

            // Do not draw cursor if readonly
            if (readOnly)
            {
                textCursor.Enabled = false;
            }
            else
            {
                textCursor.Enabled = true;
            }

            if (text.Length > 0)
            {
                Rect rect = Rectangle;
                font.DrawText(text, new Vector2(rect.x, rect.y), LocalScale, DaggerfallUI.DaggerfallDefaultInputTextColor);
            }
            else
            {
                // Draw default text while nothing else entered
                if (defaultText.Length > 0)
                {
                    Rect rect = Rectangle;
                    font.DrawText(defaultText, new Vector2(rect.x, rect.y), LocalScale, defaultTextColor);
                }
            }
        }
示例#3
0
        public override void Draw()
        {
            if (!Enabled)
            {
                return;
            }

            if (drawToolTip)
            {
                base.Draw();

                // Determine text position
                Rect    rect    = Rectangle;
                Vector2 textPos = new Vector2(
                    rect.x + LeftMargin * LocalScale.x,
                    rect.y + TopMargin * LocalScale.y);

                //if (rect.xMax > Screen.width) textPos.x -= (rect.xMax - Screen.width);

                // Draw tooltip text
                for (int i = 0; i < textRows.Length; i++)
                {
                    font.DrawText(textRows[i], textPos, LocalScale, textColor);
                    textPos.y += font.GlyphHeight * LocalScale.y;
                }

                // Lower flag
                drawToolTip = false;
            }
        }
示例#4
0
        public override void Draw()
        {
            if (!Enabled)
            {
                return;
            }

            if (drawToolTip)
            {
                base.Draw();

                // Set render area for tooltip to whole screen (material might have been changed by other component, i.e. _ScissorRect might have been set to a subarea of screen (e.g. by TextLabel class))
                Material material    = font.GetMaterial();
                Vector4  scissorRect = new Vector4(0, 1, 0, 1);
                material.SetVector("_ScissorRect", scissorRect);

                // Determine text position
                Rect    rect    = Rectangle;
                Vector2 textPos = new Vector2(
                    rect.x + LeftMargin * LocalScale.x,
                    rect.y + TopMargin * LocalScale.y);

                //if (rect.xMax > Screen.width) textPos.x -= (rect.xMax - Screen.width);

                // Draw tooltip text
                for (int i = 0; i < textRows.Length; i++)
                {
                    font.DrawText(textRows[i], textPos, LocalScale, textColor);
                    textPos.y += font.GlyphHeight * LocalScale.y;
                }

                // Lower flag
                drawToolTip = false;
            }
        }
        public override void Draw()
        {
            base.Draw();

            if (text.Length > 0)
            {
                Rect rect = Rectangle;
                font.DrawText(text, new Vector2(rect.x, rect.y), LocalScale, DaggerfallUI.DaggerfallDefaultInputTextColor);
            }
        }