Ejemplo n.º 1
0
        public Dialogs(Game game)
        {
            this.game = game;
            PropertyReader props = game.loader.GetPropertyReader().Select("dialog/dialog.xml");
            Border = props.GetInt("border");
            string fontName = props.GetString("font");
            int fontSize = props.GetInt("fontsize");
            Font = new SdlDotNet.Graphics.Font(game.loader.LoadRaw("dialog/" + fontName), fontSize);
            bgColor = Color.FromArgb(
                props.GetInt("background/alpha"),
                props.GetInt("background/red"),
                props.GetInt("background/green"),
                props.GetInt("background/blue"));
            selectedBorder = Color.FromArgb(
                props.GetInt("selectedborder/alpha"),
                props.GetInt("selectedborder/red"),
                props.GetInt("selectedborder/green"),
                props.GetInt("selectedborder/blue"));
            selectedBg = Color.FromArgb(
                props.GetInt("selectedbackground/alpha"),
                props.GetInt("selectedbackground/red"),
                props.GetInt("selectedbackground/green"),
                props.GetInt("selectedbackground/blue"));

            TextHeight = Font.SizeText(" ").Height;

            surface = new Surface(game.loader.LoadBitmap("dialog/windowborder.png"));
        }
Ejemplo n.º 2
0
 public Textbox()
     : base()
 {
     //mChars = new List<TextBoxChar>();
     mLines = new List<TextboxLine>();
     mFont = Logic.Graphics.FontManager.TextBoxFont;
     mLetterSize = mFont.SizeText(" ");
     mText = new StringBuilder();
     this.OnKeyDown += new EventHandler<SdlDotNet.Input.KeyboardEventArgs>(Textbox_OnKeyDown);
     this.OnClick += new EventHandler<SdlDotNet.Input.MouseButtonEventArgs>(Textbox_OnClick);
     Redraw();
 }
Ejemplo n.º 3
0
 public Textbox()
     : base()
 {
     //mChars = new List<TextBoxChar>();
     mLines          = new List <TextboxLine>();
     mFont           = Logic.Graphics.FontManager.TextBoxFont;
     mLetterSize     = mFont.SizeText(" ");
     mText           = new StringBuilder();
     this.OnKeyDown += new EventHandler <SdlDotNet.Input.KeyboardEventArgs>(Textbox_OnKeyDown);
     this.OnClick   += new EventHandler <SdlDotNet.Input.MouseButtonEventArgs>(Textbox_OnClick);
     Redraw();
 }
Ejemplo n.º 4
0
        public void AppendText(List <CharOptions> charOptions, string text)
        {
            if (mLines.Count == 0)
            {
                mLines.Add(new TextboxLine(base.Size.Width, mFont, mForeColor));
            }

            int currentLine = mLines.Count - 1;

            for (int i = 0; i < text.Length; i++)
            {
                if (text[i] != '\n')
                {
                    Size letterSize = mFont.SizeText(text[i].ToString());
                    if (mLines[currentLine].LineFull(letterSize.Width))
                    {
                        mLines.Add(new TextboxLine(base.Size.Width, mFont, mForeColor));
                        currentLine++;
                    }
                    if (charOptions != null && charOptions.Count > i)
                    {
                        mLines[currentLine].AddChar(text[i].ToString(), charOptions[i]);
                    }
                    else
                    {
                        mLines[currentLine].AddChar(text[i].ToString());
                    }
                }
                else
                {
                    mLines[currentLine].AddChar("\n");
                    mLines.Add(new TextboxLine(base.Size.Width, mFont, mForeColor));
                    currentLine++;
                }
            }

            mText.Append(text);
            Redraw();
        }
Ejemplo n.º 5
0
        private void Init()
        {
            mBackgroundSurf = new SdlDotNet.Graphics.Surface(IO.IO.CreateOSPath("Skins\\" + Globals.ActiveSkin + "\\General\\TaskBar\\taskbarbutton.png"));
            if (mWindow.TaskBarText != "")
            {
                Gfx.Font    font     = Logic.Graphics.FontManager.LoadFont("tahoma", 12);
                Gfx.Surface textSurf = font.Render(mWindow.TaskBarText, Color.White);
                //textSurf = textSurf.CreateStretchedSurface(new Size(130, 12));
                mBackgroundSurf.Blit(textSurf, GetCenter(mBackgroundSurf, textSurf.Size), new Rectangle(0, 0, 125, 14));
                string stateString = "?";
                switch (mWindow.WindowState)
                {
                case Client.Logic.Windows.WindowManager.WindowState.Normal:
                    stateString = "^";
                    break;

                case Client.Logic.Windows.WindowManager.WindowState.Minimized:
                    stateString = "v";
                    break;

                case Client.Logic.Windows.WindowManager.WindowState.Maximized:
                    stateString = "[]";
                    break;
                }
                mBackgroundSurf.Blit(font.Render(stateString, Color.White), new Point(this.Width - font.SizeText(stateString).Width - 1, 0));
                font.Close();
            }
            base.Buffer.Blit(mBackgroundSurf, new Point(0, 0));
        }