Пример #1
0
        /// <summary>
        /// Draws the mask
        /// </summary>
        public override void Draw(Otter.Interface.Graphics graphics)
        {
            if (Hidden)
            {
                return;
            }

            //draw a placeholder sprite to show the mask's position
            TextureInfo info  = Scene.GetTextureInfo(mTextureID);
            int         texID = (info != null) ? info.TextureID : -1;

            switch (Flip)
            {
            case GUISprite.FlipType.None:
            {
                graphics.DrawRectangle(texID, 0.0f, 0.0f, Layout.Size.Width, Layout.Size.Height, 0.0f, 0.0f, 1.0f, 1.0f, Color.ToArgb(), Skew, -1);
                break;
            }

            case GUISprite.FlipType.Vertical:
            {
                graphics.DrawRectangle(texID, 0.0f, 0.0f, Layout.Size.Width, Layout.Size.Height, 0.0f, 1.0f, 1.0f, 0.0f, Color.ToArgb(), Skew, -1);
                break;
            }

            case GUISprite.FlipType.Horizontal:
            {
                graphics.DrawRectangle(texID, 0.0f, 0.0f, Layout.Size.Width, Layout.Size.Height, 1.0f, 0.0f, 0.0f, 1.0f, Color.ToArgb(), -Skew, -1);
                break;
            }
            }
        }
Пример #2
0
        /// <summary>
        /// Draws the sprite
        /// </summary>
        public override void Draw(Otter.Interface.Graphics graphics)
        {
            TextureInfo info  = Scene.GetTextureInfo(mTextureID);
            int         texID = (info != null) ? info.TextureID : -1;

            switch (Flip)
            {
            case FlipType.None:
            {
                graphics.DrawRectangle(texID, 0.0f, 0.0f, Layout.Size.Width, Layout.Size.Height, 0.0f, 0.0f, 1.0f, 1.0f, ((SpriteLayout)Layout).Color.ToArgb(), Skew, InheritedMask);
                break;
            }

            case FlipType.Vertical:
            {
                graphics.DrawRectangle(texID, 0.0f, 0.0f, Layout.Size.Width, Layout.Size.Height, 0.0f, 1.0f, 1.0f, 0.0f, ((SpriteLayout)Layout).Color.ToArgb(), Skew, InheritedMask);
                break;
            }

            case FlipType.Horizontal:
            {
                graphics.DrawRectangle(texID, 0.0f, 0.0f, Layout.Size.Width, Layout.Size.Height, 1.0f, 0.0f, 0.0f, 1.0f, ((SpriteLayout)Layout).Color.ToArgb(), -Skew, InheritedMask);
                break;
            }
            }

            base.Draw(graphics);
        }
Пример #3
0
        /// <summary>
        /// Draws the Slider
        /// </summary>
        public override void Draw(Otter.Interface.Graphics graphics)
        {
            TextureInfo info = null;

            info = Scene.GetTextureInfo(mStartTextureID);
            int startTexID = (info != null) ? info.TextureID : -1;

            info = Scene.GetTextureInfo(mMiddleTextureID);
            int middleTexID = (info != null) ? info.TextureID : -1;

            info = Scene.GetTextureInfo(mEndTextureID);
            int endTexID = (info != null) ? info.TextureID : -1;

            info = Scene.GetTextureInfo(mThumbTextureID);
            int thumbTexID = (info != null) ? info.TextureID : -1;

            float x        = 0.0f;
            float y        = Layout.Size.Height / 2.0f - ThumbHeight / 2.0f;
            float midWidth = Math.Max(0.0f, Layout.Size.Width - ThumbWidth * 2.0f);
            int   col      = ((SliderLayout)Layout).Color.ToArgb();

            graphics.DrawRectangle(startTexID, x, y, ThumbWidth, ThumbHeight, col);

            x += ThumbWidth;
            graphics.DrawRectangle(middleTexID, x, y, midWidth, ThumbHeight, col);

            x += midWidth;
            graphics.DrawRectangle(endTexID, x, y, ThumbWidth, ThumbHeight, col);

            x = ThumbWidth + midWidth / 2.0f - ThumbWidth / 2.0f;
            graphics.DrawRectangle(thumbTexID, x, y, ThumbWidth, ThumbHeight, col);
        }
Пример #4
0
        /// <summary>
        /// Draws the Toggle
        /// </summary>
        /// <param name="graphics"></param>
        public override void Draw(Otter.Interface.Graphics graphics)
        {
            TextureInfo info  = Scene.GetTextureInfo(DefaultState == ToggleState.On ? OnTexture : OffTexture);
            int         texID = (info != null) ? info.TextureID : -1;

            graphics.DrawRectangle(texID, 0.0f, 0.0f, Layout.Size.Width, Layout.Size.Height, ((ToggleLayout)Layout).Color.ToArgb());
        }
Пример #5
0
        /// <summary>
        /// Draws the table
        /// </summary>
        /// <param name="graphics"></param>
        public override void Draw(Otter.Interface.Graphics graphics)
        {
            int rowIndex = 0;
            int colEven  = Color.FromArgb(200, Color.Gainsboro).ToArgb();
            int colOdd   = Color.FromArgb(200, Color.WhiteSmoke).ToArgb();

            for (float y = 0; y < Layout.Size.Height; y += (float)(DefaultRowHeight + RowSpacing))
            {
                float height = (Layout.Size.Height - y) > DefaultRowHeight ? DefaultRowHeight : (Layout.Size.Height - y);
                int   col    = (rowIndex == 0) ? colEven : colOdd;

                graphics.DrawRectangle(-1, 0.0f, y, Layout.Size.Width, height, col);

                rowIndex = (++rowIndex) % 2;
            }
        }
Пример #6
0
        /// <summary>
        /// Draws the button
        /// </summary>
        public override void Draw(Otter.Interface.Graphics graphics)
        {
            TextureInfo info  = Scene.GetTextureInfo(mCurrentState == ButtonState.Default ? mDefaultTextureID : mDownTextureID);
            Color       color = mCurrentState == ButtonState.Default ? mDefaultColor : mDownColor;
            int         texID = (info != null) ? info.TextureID : -1;

            graphics.DrawRectangle(texID, 0.0f, 0.0f, this.Size.Width, this.Size.Height, color.ToArgb());

            if (mLabel.Text != "")
            {
                GUIFont font = GUIProject.CurrentProject.GetFont(mLabel.FontID);
                if (font != null)
                {
                    ButtonLayout layout = Layout as ButtonLayout;
                    font.Draw(mLabel.Text, 0, 0, layout.Size.Width, layout.Size.Height, layout.TextColor, layout.TextScale, HorizontalAlignment, VerticalAlignment);
                }
            }
        }
Пример #7
0
 /// <summary>
 /// Draws the group
 /// </summary>
 public override void Draw(Otter.Interface.Graphics graphics)
 {
     graphics.DrawRectangle(-1, 0.0f, 0.0f, Layout.Size.Width, Layout.Size.Height, mColor.ToArgb());
     base.Draw(graphics);
 }