public void getCenterTest() { NinePatch target = new NinePatch(); // TODO: Initialize to an appropriate value int contentWidth = 0; // TODO: Initialize to an appropriate value int contentHeight = 0; // TODO: Initialize to an appropriate value Vector2 expected = new Vector2(); // TODO: Initialize to an appropriate value Vector2 actual; actual = target.getCenter(contentWidth, contentHeight); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
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(); }
/// <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); }