예제 #1
0
        public Textbox(Vector2 Position)
        {
            Texture = Utils.Global.Load <Texture2D>("TextBoxBG");
            offsetx = 5; offsety = 2;
            Text    = new TextDrawer(new Vector2(Position.X + offsetx, Position.Y + offsety), "");

            KeyboardInput.CharPressed += CharacterTyped;
            KeyboardInput.KeyPressed  += KeyPressed;
            //KeyboardInput.Initialize(, 150, 1, true);
        }
예제 #2
0
        public DesktopIcon(Vector2 Position, string IconName, String IconTextureName)
        {
            scale = new Vector2
                        (128 / Utils.Global.currResolution.X, 72 / Utils.Global.currResolution.Y);

            this.Position = Position;
            Icon          = Utils.Global.Load <Texture2D>(IconTextureName);

            Name = new TextDrawer
                       (new Vector2((Position.X + ((Icon.Width * scale.X) / 2)) - (Utils.Global.Font.MeasureString(IconName).X / 2),
                                    Position.Y + (Icon.Height * scale.Y)), IconName);
        }
예제 #3
0
        //String Text;

        public Readbox(Vector2 Position, String Text)
        {
            Texture       = Utils.Global.Load <Texture2D>("ReadBoxBG");
            this.Position = Position;
            offsetx       = 5;
            offsety       = 2;


            text = new TextDrawer(new Vector2(this.Position.X + offsetx, this.Position.Y + offsety), Text);

            //Met des sauts de lignes quand le texte > la taille de notre box.
            char[]        textchr = text.Text.ToCharArray();
            List <string> lines = new List <string>(); int offset = 0; //int nLine = 0;

            if (text.font.MeasureString(text.Text).X > this.Texture.Width)
            {
                for (int i = 1; offset < text.Text.Length; i++)
                {
                    char[] selectedtextchr = textchr.Skip(offset).Take(i).ToArray();
                    float  j = text.font.MeasureString(new string(selectedtextchr)).X + offsetx;

                    if (j >= Texture.Width)
                    {
                        lines.Add(new string(selectedtextchr));
                        offset += i;
                        i       = 1;
                    }

                    if (i + offset == text.Text.Length)
                    {
                        lines.Add(new string(selectedtextchr = textchr.Skip(offset).Take(i).ToArray()));
                        text.Text = String.Join(Environment.NewLine, lines);
                        break;
                    }
                }
            }
        }
예제 #4
0
 public Cursor(TextDrawer Text)
 {
     text     = Text;
     Position = text.Position;
 }