Esempio n. 1
0
        public override void DrawUI(SpriteBatch spr)
        {
            spr.DrawString(font, "Hello, world!", Vector2.Zero, Color.Black);

            np.Draw(spr, new Rectangle(100, 100, 16, 16), Color.White);
            np.Draw(spr, new Rectangle(120, 120, 40, 40), Color.White);
            np.Draw(spr, new Rectangle(170, 120, 5, 5), Color.White);
            buttonNP.Draw(spr, new Rectangle(300, 300, Input.MousePos.X - 300, Input.MousePos.Y - 300), Color.DarkOliveGreen);
        }
Esempio n. 2
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            NinePatch patch = Selected ? SelectedNinepatch : UnselectedNinepatch;

            patch.Draw(spriteBatch, AbsolutePosition, Width, Height, 0f, EffectiveOpacity);
            base.Draw(spriteBatch);
        }
Esempio n. 3
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     if (ContainerNinePatch != null)
     {
         ContainerNinePatch.Draw(spriteBatch, AbsolutePosition, Width, Height, 0f, EffectiveOpacity);
     }
     base.Draw(spriteBatch);
 }
Esempio n. 4
0
        public void DrawTest()
        {
            NinePatch   target        = new NinePatch(); // TODO: Initialize to an appropriate value
            SpriteBatch sb            = null;            // TODO: Initialize to an appropriate value
            Vector2     position      = new Vector2();   // TODO: Initialize to an appropriate value
            int         contentWidth  = 0;               // TODO: Initialize to an appropriate value
            int         contentHeight = 0;               // TODO: Initialize to an appropriate value

            target.Draw(sb, position, contentWidth, contentHeight);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Esempio n. 5
0
        public override void Draw(SpriteBatch sb)
        {
            td.Position = Position;
            if (!active)
            {
                return;
            }
            NinePatch patch  = base.mouseOver ? patchHover : patchNormal;
            Vector2   center = ConversionManager.PToV(BoundBox.Center);

            patch.Draw(sb, center - patch.getCenter(td.BoundBox.Width + paddingWidth, td.BoundBox.Height), td.BoundBox.Width + paddingWidth, td.BoundBox.Height + paddingHeight);
            td.Draw(sb);
            //YogUILibrary.Managers.DrawManager.Draw_Circle(Position, 5f, Color.Red, Color.Black, sb);
            //base.Draw();
        }
Esempio n. 6
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     //We want to preserve the slider skin's original height.
     SliderRange.Draw(spriteBatch, AbsolutePosition, Width, SliderRange.BottomMostPatch - SliderRange.TopMostPatch, 0f, EffectiveOpacity);
     spriteBatch.Draw(CurSliderTexture, new Vector2(AbsoluteX + SliderRange.LeftWidth - (CurSliderTexture.Width) + SliderPosition, AbsoluteY), null, Color.White * EffectiveOpacity, 0f, new Vector2(CurSliderTexture.Width / -2, 0), 1f, SpriteEffects.None, 0f);
     if (DrawText)
     {
         int     drawX  = AbsoluteX + (Width) / 2;
         int     drawY  = AbsoluteY;
         Vector2 offset = GeeUIMain.Font.MeasureString(CurrentValue.ToString());
         offset.X = (int)(offset.X / 2);
         spriteBatch.DrawString(GeeUIMain.Font, CurrentValue.ToString(), new Vector2(drawX, drawY), TextColor * EffectiveOpacity, 0f, offset, 1f, SpriteEffects.None, 0f);
     }
     base.Draw(spriteBatch);
 }
Esempio n. 7
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            NinePatch patch  = CurrentNinepatch;
            int       width  = Width - patch.LeftWidth - patch.RightWidth;
            int       height = Height - patch.TopHeight - patch.BottomHeight;

            patch.Draw(spriteBatch, AbsolutePosition, width, height, 0f, EffectiveOpacity);

            View childView = ButtonContentview;

            if (childView != null)
            {
                childView.Width.Value  = width;
                childView.Height.Value = height;
                childView.X            = patch.LeftWidth;
                childView.Y            = patch.TopHeight;
            }

            base.Draw(spriteBatch);
        }
Esempio n. 8
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            NinePatch patch = Selected ? NinePatchSelected : NinePatchNormal;

            patch.Draw(spriteBatch, AbsolutePosition, Width - patch.LeftWidth - patch.RightWidth, (int)GeeUIMain.Font.MeasureString(WindowText).Y, 0f, EffectiveOpacity);

            string text = TextView.TruncateString(WindowText, WindowContentView.ContentBoundBox.Width);

            spriteBatch.DrawString(GeeUIMain.Font, text, AbsolutePosition + new Vector2(patch.LeftWidth, patch.TopHeight), Color.Black * EffectiveOpacity);

            if (WindowContentView != null)
            {
                WindowContentView.Width = Width;
                Vector2 windowTextSize = GeeUIMain.Font.MeasureString(WindowText);
                var     barHeight      = (patch.TopHeight + patch.BottomHeight + windowTextSize.Y);
                WindowContentView.Height.Value = Height.Value - (int)barHeight;
            }

            base.Draw(spriteBatch);
        }
Esempio n. 9
0
        public override void Draw(SpriteBatch sb)
        {
            if (active)
            {
                bool  defaulted = false;
                Color oldColor  = input.tdI.color;
                if (!input.selected && input.input == "" && placeHolderText != "")
                {
                    input.tdI.text  = placeHolderText;
                    defaulted       = true;
                    input.tdI.color = Color.Gray;
                }

                NinePatch patch = patchNormal;
                if (input.selected)
                {
                    if (isFilterText())
                    {
                        patch = textValid ? patchSelectedRight : patchSelectedWrong;
                    }
                    else
                    {
                        patch = patchSelected;
                    }
                }

                int patchWidth = scaleToText && input.BoundBox.Width >= (int)width ? input.BoundBox.Width : (int)width;

                patch.Draw(sb, Position, (int)patchWidth, (int)height);
                input.Position = Position + new Vector2(patch.leftWidth, patch.topHeight);
                input.Draw(sb);
                if (defaulted)
                {
                    input.tdI.text  = "";
                    input.tdI.color = oldColor;
                }

                contextMenu.Draw(sb);
            }
            base.Draw(sb);
        }
Esempio n. 10
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            GraphicsDevice.PresentationParameters.MultiSampleCount = 12;
            spriteBatch.Begin();

            DrawManager.Draw_Box(new Vector2(fileOpDraw.Left, fileOpDraw.Top), new Vector2(fileOpDraw.Right, fileOpDraw.Bottom), Color.Black, spriteBatch, 0f, 200);
            DrawManager.Draw_Outline(new Vector2(fileOpDraw.Left, fileOpDraw.Top), new Vector2(fileOpDraw.Right, fileOpDraw.Bottom), Color.White, spriteBatch);

            DrawManager.Draw_Box(new Vector2(patchInfoDraw.Left, patchInfoDraw.Top), new Vector2(patchInfoDraw.Right, patchInfoDraw.Bottom), Color.Black, spriteBatch, 0f, 200);
            DrawManager.Draw_Outline(new Vector2(patchInfoDraw.Left, patchInfoDraw.Top), new Vector2(patchInfoDraw.Right, patchInfoDraw.Bottom), Color.White, spriteBatch);

            DrawManager.Draw_Box(new Vector2(patchDisplayDraw.Left, patchDisplayDraw.Top), new Vector2(patchDisplayDraw.Right, patchDisplayDraw.Bottom), Color.Black, spriteBatch, 0f, 200);
            DrawManager.Draw_Outline(new Vector2(patchDisplayDraw.Left, patchDisplayDraw.Top), new Vector2(patchDisplayDraw.Right, patchDisplayDraw.Bottom), Color.White, spriteBatch);

            DrawManager.Draw_Box(new Vector2(patchTextureDraw.Left, patchTextureDraw.Top), new Vector2(patchTextureDraw.Right, patchTextureDraw.Bottom), Color.Black, spriteBatch, 0f, 200);
            DrawManager.Draw_Outline(new Vector2(patchTextureDraw.Left, patchTextureDraw.Top), new Vector2(patchTextureDraw.Right, patchTextureDraw.Bottom), Color.White, spriteBatch);

            DrawManager.Draw_Box(new Vector2(testDrawing.Left, testDrawing.Top), new Vector2(testDrawing.Right, testDrawing.Bottom), Color.Black, spriteBatch, 0f, 200);
            DrawManager.Draw_Outline(new Vector2(testDrawing.Left, testDrawing.Top), new Vector2(testDrawing.Right, testDrawing.Bottom), Color.White, spriteBatch);

            loadNinepatch.Draw(spriteBatch);
            saveNinepatchAs.Draw(spriteBatch);

            xStart.Draw(spriteBatch);
            xEnd.Draw(spriteBatch);
            yStart.Draw(spriteBatch);
            yEnd.Draw(spriteBatch);
            refreshNinepatch.Draw(spriteBatch);
            scaleX.Draw(spriteBatch);
            scaleY.Draw(spriteBatch);
            scaleXY.Draw(spriteBatch);
            drawContent.Draw(spriteBatch);

            if (curTexture != null)
            {
                spriteBatch.Draw(curTexture, ConversionManager.PToV(patchTextureDraw.Center), null, Color.White, 0f, new Vector2(curTexture.Width / 2, curTexture.Height / 2), 1f, SpriteEffects.None, 0f);
            }

            Vector2 drawPos = ConversionManager.PToV(patchDisplayDraw.Center);

            if (curNinepatch.texture != null)
            {
                computeScale();
                patchScale.Draw(spriteBatch);
                int height = curNinepatch.bottomMostPatch - curNinepatch.topMostPatch;
                int width  = curNinepatch.rightMostPatch - curNinepatch.leftMostPatch;

                if (scaleX.selected)
                {
                    curNinepatch.Draw(spriteBatch, drawPos - curNinepatch.getCenter(width + patchScale.getNumber(), height), width + (patchScale.getNumber()), height);
                    if (drawContent.GetChecked())
                    {
                        curNinepatch.DrawContent(spriteBatch, drawPos - curNinepatch.getCenter(width + patchScale.getNumber(), height), width + (patchScale.getNumber()), height, Color.Red);
                    }
                }
                else if (scaleY.selected)
                {
                    curNinepatch.Draw(spriteBatch, drawPos - curNinepatch.getCenter(width, height + patchScale.getNumber()), width, height + (patchScale.getNumber()));
                    if (drawContent.GetChecked())
                    {
                        curNinepatch.DrawContent(spriteBatch, drawPos - curNinepatch.getCenter(width, height + patchScale.getNumber()), width, height + (patchScale.getNumber()), Color.Red);
                    }
                }
                else if (scaleXY.selected)
                {
                    curNinepatch.Draw(spriteBatch, drawPos - curNinepatch.getCenter(width + patchScale.getNumber(), height + patchScale.getNumber()), width + (patchScale.getNumber()), height + (patchScale.getNumber()));
                    if (drawContent.GetChecked())
                    {
                        curNinepatch.DrawContent(spriteBatch, drawPos - curNinepatch.getCenter(width + patchScale.getNumber(), height + patchScale.getNumber()), width + (patchScale.getNumber()), height + (patchScale.getNumber()), Color.Red);
                    }
                }
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }
Esempio n. 11
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     Patch.Draw(spriteBatch, AbsolutePosition, Width, Height, 0f, EffectiveOpacity);
     base.Draw(spriteBatch);
 }