예제 #1
0
 public override void OverRender(GUIRenderContext Context)
 {
     if (this._ScoreSample == null)
     {
         this._ScoreSample = Font.Default.CreateSample(this.Board.GetScore(0).ToString());
     }
     Context.DrawText(Color.RGB(0.0, 0.0, 0.0), this._ScoreSample, new Point(10.0, 10.0));
 }
예제 #2
0
        public override void Render(GUIRenderContext Context)
        {
            if (this._Text != null && this._Text != "")
            {
                if (this._Sample == null)
                {
                    this._CreateSample();
                }
                //Context.DrawText(this._Color, this._Sample, new Rectangle(this.Size));

                /*
                Skin s = this._Style.Skin;
                Context.DrawSurface(s.GetSurface(this._Style.Textbox, this.Size));
                */
                Rectangle inner = new Rectangle(this.Size);
                Context.PushClip(inner);

                // Draw text
                Point texloc = new Point(inner.Location.X, inner.Location.Y + inner.Size.Y / 2.0 - this._Sample.Size.Y / 2.0);
                Context.DrawText(this._Color, this._Sample, texloc);

                // Draw selection
                if (this._Selection != null)
                {
                    int starti;
                    int endi;
                    this._Selection.Order(out starti, out endi);
                    Rectangle[] charbounds = this._Sample.CharacterBounds;
                    if (endi - starti > 0)
                    {
                        double startx = inner.Location.X + Textbox.SelectionX(charbounds, starti);
                        double endx = inner.Location.X + Textbox.SelectionX(charbounds, endi);
                        Rectangle clip = new Rectangle(startx, inner.Location.Y, endx - startx, inner.Size.Y);
                        Context.PushClip(clip);
                        Context.DrawSolid(this._Style.SelectionBackgroundColor, clip);
                        Context.DrawText(this._Style.SelectionTextColor, this._Sample, texloc);
                        Context.Pop();
                    }

                }

                Context.Pop();
            }
        }
예제 #3
0
파일: Popup.cs 프로젝트: alexcmd/OpenTKGUI
            /// <summary>
            /// Renders the item to the specified location.
            /// </summary>
            public void Render(GUIRenderContext Context, PopupStyle Style, Rectangle Area)
            {
                CommandMenuItem cmi = Source as CommandMenuItem;
                if (cmi != null)
                {
                    Context.DrawText(Style.TextColor, this.Sample, Area);
                }

                CompoundMenuItem cpmi = Source as CompoundMenuItem;
                if (cpmi != null)
                {
                    Context.DrawText(Style.TextColor, this.Sample, Area);

                    Point arrowsize = Style.CompoundArrowSize;
                    Context.DrawSurface(
                        Style.Skin.GetSurface(Style.CompoundArrow, arrowsize),
                        new Point(Area.Location.X + Area.Size.X - arrowsize.X, Area.Location.Y + Area.Size.Y * 0.5 - arrowsize.Y * 0.5));
                }

                SeperatorMenuItem smi = Source as SeperatorMenuItem;
                if (smi != null)
                {
                    Context.DrawSurface(
                        Style.Skin.GetSurface(Style.Seperator, new Point(Area.Size.X, Style.SeperatorHeight)),
                        Area.Location + new Point(0.0, Style.SeperatorPadding));
                }
            }
예제 #4
0
        public override void Render(GUIRenderContext Context)
        {
            Skin s = this._Style.Skin;
            Context.DrawSurface(s.GetSurface(this._Style.Textbox, this.Size));

            Rectangle inner = new Rectangle(this.Size).Margin(this._Style.InteriorMargin);
            Context.PushClip(inner);

            // Draw text
            Point texloc = new Point(inner.Location.X, inner.Location.Y + inner.Size.Y / 2.0 - this._TextSample.Size.Y / 2.0);
            Context.DrawText(this._Style.TextColor, this._TextSample, texloc);

            // Draw selection
            if (this._Selection != null)
            {
                int starti;
                int endi;
                this._Selection.Order(out starti, out endi);
                Rectangle[] charbounds = this._TextSample.CharacterBounds;
                if (endi - starti > 0)
                {
                    double startx = inner.Location.X + SelectionX(charbounds, starti);
                    double endx = inner.Location.X + SelectionX(charbounds, endi);
                    Rectangle clip = new Rectangle(startx, inner.Location.Y, endx - startx, inner.Size.Y);
                    Context.PushClip(clip);
                    Context.DrawSolid(this._Style.SelectionBackgroundColor, clip);
                    Context.DrawText(this._Style.SelectionTextColor, this._TextSample, texloc);
                    Context.Pop();
                }

                // Draw cursor
                if (_CursorFlashTime > 0.0)
                {
                    int curi = this._Selection.Start;
                    double cursx = inner.Location.X + SelectionX(charbounds, curi);
                    Context.DrawSolid(this._Style.CursorColor, new Rectangle(cursx, inner.Location.Y, 1.0, inner.Size.Y));
                }
            }

            Context.Pop();
        }
예제 #5
0
파일: Label.cs 프로젝트: alexcmd/OpenTKGUI
 public override void Render(GUIRenderContext Context)
 {
     if (this._Text != null && this._Text != "")
     {
         if (this._Sample == null)
         {
             this._CreateSample();
         }
         Context.DrawText(this._Color, this._Sample, new Rectangle(this.Size));
     }
 }
예제 #6
0
        public override void Render(GUIRenderContext Context)
        {
            CheckboxStyle style = this._Style;
            Skin s = style.Skin;

            Surface surfbox = s.GetSurface(style.Box, style.BoxSize);
            Context.DrawSurface(surfbox);

            if(this.Checked)
            {
                Surface surftick = s.GetSurface(style.Tick, style.BoxSize);
                Context.DrawSurface(surftick);
            }

            Rectangle textrect = new Rectangle(style.BoxSize.X + style.Padding, 0, this.Size.X - style.BoxSize.X, this.Size.Y);
            if(this._Sample == null)
                this._Sample = style.TextFont.CreateSample(this._Text, textrect.Size, TextAlign.Left, TextAlign.Top, TextWrap.Wrap);
            Context.DrawText(style.TextColor, this._Sample, textrect);
        }
예제 #7
0
파일: Form.cs 프로젝트: alexcmd/OpenTKGUI
        public override void Render(GUIRenderContext Context)
        {
            Rectangle clirect = this.ClientRectangle;

            // Back
            Context.DrawSolid(this._Style.BackColor, clirect);

            // Client
            Context.PushTranslate(clirect.Location);
            this._Client.Render(Context);
            Context.Pop();

            // Form
            Skin s = this._Style.Skin;
            Context.DrawSurface(s.GetSurface(this._Style.Form, this._Style.Form.Width / 2, this._Style.FormVerticalStretchLine, this.Size));

            // Right of the title bar.
            Context.PushTranslate(this._RightTitleBarOffset);
            this._RightTitleBar.Render(Context);
            Context.Pop();

            // Text
            if (this._Text != null && this._Text != "")
            {
                Rectangle textrect = new Rectangle(
                        this._Style.TitleBarLeftRightMargin,
                        this._Style.TitleBarTopMargin,
                        this.Size.X - this._Style.TitleBarLeftRightMargin - this._RightTitleBar.Size.X - this._Style.TitleBarItemSeperation,
                        this._Style.TitleBarSize - this._Style.TitleBarTopMargin - this._Style.TitleBarBottomMargin);
                if (this._TextSample == null)
                {
                    this._TextSample = this._Style.TitleBarFont.CreateSample(this._Text, textrect.Size, TextAlign.Left, TextAlign.Center, TextWrap.Ellipsis);
                }
                Context.DrawText(this._Style.TitleBarTextColor, this._TextSample, textrect);
            }
        }