/// <summary> /// Polygons Example /// </summary> private void DrawPolygons() { mRectangleY += mRectangleHeight + 20; Drawing2D.DrawRect(new Rect(mRectangleX, mRectangleY, mRectangleWidth, mRectangleHeight)); Drawing2D.DrawText("Polygons", mRectangleX + 5, mRectangleY + 5, 18, Color.white, mBitmapFont); float x = 15 - mSampleWidth; float y = mRectangleY + 50; float radius = mRectangleHeight - 60; Drawing2D.DrawPentagon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, ToColor(36, 86, 188), 2f, CustomTextureLines); Drawing2D.DrawHexagon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, ToColor(93, 166, 221), 4f, CustomTextureLines); Drawing2D.DrawOctogon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y - 5), radius + 10, ToColor(21, 179, 89), 2f, CustomTextureLines); Drawing2D.DrawDashedPentagon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, ToColor(175, 217, 141), 2f, 5); Drawing2D.DrawDashedHexagon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, ToColor(248, 222, 104), 4f, 4); Drawing2D.DrawDashedOctogon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y - 5), radius + 10, ToColor(255, 196, 126), 4f, 4); x += mSampleWidth + 20; Vector2[] vertices = new Vector2[6]; vertices[0] = new Vector2(x - 10, y - 30); vertices[1] = new Vector2(x + 10, y - 15); vertices[2] = new Vector2(x + 100, y - 25); vertices[3] = new Vector2(x + 65, y + 25); vertices[4] = new Vector2(x + 0, y + 15); vertices[5] = new Vector2(x - 10, y - 10); Drawing2D.DrawPolygon(vertices, ToColor(255, 112, 92), 4f); x += mSampleWidth; vertices = new Vector2[6]; vertices[0] = new Vector2(x - 10, y - 30); vertices[1] = new Vector2(x + 10, y - 15); vertices[3] = new Vector2(x + 100, y + 25); vertices[2] = new Vector2(x + 65, y - 25); vertices[4] = new Vector2(x + 0, y + 15); vertices[5] = new Vector2(x - 10, y - 10); Drawing2D.DrawDashedPolygon(vertices, ToColor(232, 62, 83), 2f, false, 3f); }
private void DrawSolidBody(Body body) { switch (body.vertices.Length) { case 3: Drawing2D.FillTriangle( body.vertices[0].position + DemoUtils.offset, body.vertices[1].position + DemoUtils.offset, body.vertices[2].position + DemoUtils.offset, DemoUtils.triangleColor ); DrawBodyOutline(body); break; case 4: Drawing2D.FillTriangle( body.vertices[0].position + DemoUtils.offset, body.vertices[1].position + DemoUtils.offset, body.vertices[2].position + DemoUtils.offset, DemoUtils.rectangleColor ); Drawing2D.FillTriangle( body.vertices[2].position + DemoUtils.offset, body.vertices[3].position + DemoUtils.offset, body.vertices[0].position + DemoUtils.offset, DemoUtils.rectangleColor ); DrawBodyOutline(body); break; default: DrawNormalBody(body); break; } }
public override void DrawConstraint(Constraint c) { switch (c.tag) { case Tags.DistanceConstraint: var distance = c as DistanceConstraint; Drawing2D.DrawLine(distance.v0.position + DemoUtils.offset, distance.v1.position + DemoUtils.offset, DemoUtils.constraintColor); break; case Tags.SpringConstraint: var spring = c as SpringConstraint; Drawing2D.DrawLine(spring.v0.position + DemoUtils.offset, spring.v1.position + DemoUtils.offset, DemoUtils.constraintColor); break; case Tags.DragConstraint: break; case Tags.PinConstraint: var pin = c as PinConstraint; Drawing2D.FillCircle(pin.position + DemoUtils.offset, DemoUtils.pinSize, DemoUtils.pinColor); break; case Tags.AngleConstraint: break; } }
void OnGUI() { if (isSelected) { // рамка вокруг юнита Drawing2D.DrawRect(Utils.obj3dProjection(gameObject, camera), Color.green, 1.0f, false); // рамка здоровья //healthBarWidth = (int)screenSizeMin.x; //(int)Mathf.Abs(screenSizeMin.x-screenPosition.x); GUI.DrawTexture(new Rect(screenPosition.x - healthBarWidth / 2, screenPosition.y - healthBarHeight / 2, healthBarWidth, healthBarHeight), healthBarTexture); int width = 200; int height = 200; int lineH = 10; // надо вывести панель команд и панель информации о юните GUI.BeginGroup(new Rect(Screen.width - width, Screen.height - height, width, height)); GUI.Box(new Rect(Screen.width - width, Screen.height - height, width, height), ""); GUI.Label(new Rect(0, 0, 200, lineH), "HP: " + hp); // Отображаем хп if (Target != null) { GUI.Label(new Rect(0, 10, 200, lineH), "Target: " + Target.ToString()); // Отображаем цель } GUI.EndGroup(); } else if (isSelecting) { // рамка вокруг юнита Drawing2D.DrawRect(Utils.obj3dProjection(gameObject, Camera.main), Color.green, 1.0f, false); } }
public static void Main(string[] args) { Drawing myDrawing3D = new Drawing3D("Sketch 3D", 10, 12, 14); myDrawing3D.Print(); Drawing myDrawing2D = new Drawing2D("Sketch 2D", 10, 12); myDrawing2D.Print(); Console.WriteLine("Done"); }
private static void DrawTitleScreenParticleSystem(GameModel model, Painter painter, Graphics g) { foreach (TitleScreenParticle ap in model.SMTitleMenu.Particles) { Position displayPos = model.Camera.MapLogicalToDisplay(ap.PositionLogical, true); Double scale = model.Camera.CurrentScale; SolidBrush tickBrush = new SolidBrush(ap.GetColor()); Drawing2D.DrawRect(g, tickBrush, displayPos); tickBrush.Dispose(); } }
private void DrawBodyOutline(Body body) { for (var i = 0; i < body.vertices.Length - 1; ++i) { var v0 = body.vertices[i]; var v1 = body.vertices[i + 1]; Drawing2D.DrawLine(v0.position + DemoUtils.offset, v1.position + DemoUtils.offset, DemoUtils.constraintColor); } Drawing2D.DrawLine(body.vertices[body.vertices.Length - 1].position + DemoUtils.offset, body.vertices[0].position + DemoUtils.offset, DemoUtils.constraintColor); }
/// <summary> /// /// </summary> private void OnPostRender() { if (this.RenderMode == eRenderMode.OnPostRender) { Drawing2D.ScreenWidth = 1024; Drawing2D.ScreenHeight = 512; Drawing2D.ClearFrameBuffer(new Color(0, 0, 0, 0.1f)); DrawAll(); } }
// Other than method name, DrawBezierLine is unchanged from Linusmartensson's original implementation. public static void DrawBezierLine(Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, bool antiAlias, int segments) { Vector2 lastV = CubeBezier(start, startTangent, end, endTangent, 0); for (int i = 1; i < segments; ++i) { Vector2 v = CubeBezier(start, startTangent, end, endTangent, i / (float)segments); Drawing2D.DrawLine(lastV, v, color, width, antiAlias); lastV = v; } }
public override void DrawDragConstraint() { if (model.draggedVertex != null) { if (model.draggedBody == null) { Drawing2D.DrawLine(model.draggedVertex.position + DemoUtils.offset, model.dragPosition + DemoUtils.offset, DemoUtils.dragConstraintColor); } Drawing2D.DrawCircle(model.draggedVertex.position + DemoUtils.offset, DemoUtils.pinSize, 8, DemoUtils.dragConstraintColor); } }
private void Render() { // Set the 0,0 at the top-left corner of this panel mParentRect = Drawing2D.GetWorldRect(this.transform as RectTransform); Drawing2D.SetParentBounds(mParentRect); if (Event.current.type == EventType.Repaint) { RenderWorld(); } Drawing2D.ClearParentBounds(); }
/// <summary> /// /// </summary> private void DrawChartBars() { // Bars Chart float x = 700; float y = 120; float barWidth = 20; Drawing2D.FillRect(new Rect(x + 0, y - mBarsHeight[0], barWidth, mBarsHeight[0]), ToColor(36, 86, 188), CustomTexture3DVertical); Drawing2D.FillRect(new Rect(x + 20, y - mBarsHeight[1], barWidth, mBarsHeight[1]), ToColor(175, 217, 141), CustomTexture3DVertical); Drawing2D.FillRect(new Rect(x + 40, y - mBarsHeight[2], barWidth, mBarsHeight[2]), ToColor(255, 112, 92), CustomTexture3DVertical); Drawing2D.FillRect(new Rect(x + 60, y - mBarsHeight[3], barWidth, mBarsHeight[3]), ToColor(93, 166, 221), CustomTexture3DVertical); }
/// <summary> /// /// </summary> /// <param name="pChartValues"></param> /// <param name="pColor"></param> private void DrawSeries(List <float> pChartValues, Color pColor) { List <Vector2> vertices = new List <Vector2>(); float xVal = mChartX + 10; float yRange = mChartHeight - 20; foreach (float val in pChartValues) { vertices.Add(new Vector2(xVal, 50 + (val * yRange))); xVal += 10; } Drawing2D.DrawPolygon(vertices.ToArray(), pColor, 4f, null, true); }
/// <summary> /// /// </summary> private void OnGUI() { if (this.RenderMode == eRenderMode.OnGUI) { Drawing2D.ScreenWidth = Screen.width; Drawing2D.ScreenHeight = Screen.height; Rect mParentRect = Drawing2D.GetWorldRect(this.transform as RectTransform); Drawing2D.SetParentBounds(mParentRect); DrawAll(); Drawing2D.ClearParentBounds(); } }
/// <summary> /// /// </summary> private void DrawPicture() { mPictureAngle1 += Time.deltaTime * 20f; mPictureAngle2 -= Time.deltaTime * 4f; // Picture float x = 200; float y = 260; Drawing2D.FillQuad(new Vector2(x + 40, y + 5), 200, 108, Color.white, mPictureAngle1, CustomTexturePicture, null); Drawing2D.DrawQuad(new Vector2(x + 40, y + 5), 200, 108, Color.white, 2, mPictureAngle1); Drawing2D.FillQuad(new Vector2(x + 370, y + 5), 200, 108, mPicturecolor, mPictureAngle2, CustomTexturePicture, null); Drawing2D.DrawQuad(new Vector2(x + 370, y + 5), 200, 108, mPicturecolor, 2, mPictureAngle2); }
void OnGUI() { if (Status == ST_SELECTION) { // если выполняется выделение, рисуем рамку выделения (селектор) Vector2 pointA = new Vector2(Selector.x, Selector.y); Vector2 pointB = Input.mousePosition; pointB.y = Screen.height - pointB.y; Vector2 pointC = new Vector2(pointB.x, Selector.y); Vector2 pointD = new Vector2(Selector.x, pointB.y); Drawing2D.DrawLine(pointA, pointC, Color.blue, 1.0f, false); Drawing2D.DrawLine(pointC, pointB, Color.blue, 1.0f, false); Drawing2D.DrawLine(pointB, pointD, Color.blue, 1.0f, false); Drawing2D.DrawLine(pointD, pointA, Color.blue, 1.0f, false); } }
/// <summary> /// Lines example /// </summary> private void DrawLines() { Drawing2D.DrawRect(new Rect(mRectangleX, mRectangleY, mRectangleWidth, mRectangleHeight)); Drawing2D.DrawText("Lines & Arrows", mRectangleX + 5, mRectangleY + 5, 18, Color.white, mBitmapFont); float x = 15 - mSampleWidth; float y = 60; Drawing2D.DrawLine(new Vector2(x += mSampleWidth, y), new Vector2(x + mSampleWidth - mSamplesMargin, y), ToColor(36, 86, 188), 4f); Drawing2D.DrawLine(new Vector2(x += mSampleWidth, y), new Vector2(x + mSampleWidth - mSamplesMargin, y), ToColor(93, 166, 221), 8f); Drawing2D.DrawLine(new Vector2(x += mSampleWidth, y), new Vector2(x + mSampleWidth - mSamplesMargin, y), ToColor(21, 179, 89), 16f, CustomTexture3D); Drawing2D.DrawDashedLine(new Vector2(x += mSampleWidth, y), new Vector2(x + mSampleWidth - mSamplesMargin, y), ToColor(175, 217, 141), 4f, 3); Drawing2D.DrawDashedLine(new Vector2(x += mSampleWidth, y), new Vector2(x + mSampleWidth - mSamplesMargin, y), ToColor(248, 222, 104), 8f, 3); Drawing2D.DrawDashedLine(new Vector2(x += mSampleWidth, y), new Vector2(x + mSampleWidth - mSamplesMargin, y), ToColor(255, 196, 126), 16f, 3); Drawing2D.DrawArrow(new Vector2(x += mSampleWidth, y + 10), new Vector2(x + mSampleWidth - mSamplesMargin - 25, y - 10), ToColor(255, 112, 92), 4, 20, 25); Drawing2D.DrawDashedArrow(new Vector2(x += mSampleWidth, y - 10), new Vector2(x + mSampleWidth - mSamplesMargin - 25, y + 10), ToColor(232, 62, 83), 4, 20, 25, 3); }
public override void DrawBody(Body body) { switch (body.tag) { case Tags.Cloth: break; case Tags.SolidBody: DrawSolidBody(body); break; case Tags.Tree: Drawing2D.DrawLine(body.vertices[0].position + DemoUtils.offset, body.vertices[1].position + DemoUtils.offset, DemoUtils.constraintColor); DrawNormalBody(body); break; case Tags.TreeWithFoliage: var desc = body.data as Builders.TreeFoliageDesc; for (var i = 0; i < desc.branches.Count; ++i) { if (desc.branches[i] < 0) { continue; } var constraint = body.constraints[i] as SpringConstraint; var trunkWidth = Mathf.Lerp(10f, 2f, desc.branches[i]); Drawing2D.DrawLine(constraint.v0.position + DemoUtils.offset, constraint.v1.position + DemoUtils.offset, DemoUtils.trunkColor, trunkWidth); } for (var i = 0; i < desc.leaves.Count; ++i) { var vertex = body.vertices[desc.leaves[i]]; Drawing2D.FillCircle(vertex.position + DemoUtils.offset, 25, DemoUtils.foliageColor); } break; case Tags.NormalBody: default: DrawNormalBody(body); break; } }
/// <summary> /// Rectangles Example /// </summary> private void DrawRectangles() { mRectangleY += mRectangleHeight + 20; Drawing2D.DrawRect(new Rect(mRectangleX, mRectangleY, mRectangleWidth, mRectangleHeight)); Drawing2D.DrawText("Rects & Quads", mRectangleX + 5, mRectangleY + 5, 18, Color.white, mBitmapFont); float x = 15 - mSampleWidth; float y = mRectangleY + 35; float height = mRectangleHeight - 55; float quadWidth = mSampleWidth - mSamplesMargin; Drawing2D.DrawRect(new Rect(x += mSampleWidth, y, quadWidth, height), ToColor(36, 86, 188), 4f); Drawing2D.DrawRect(new Rect(x += mSampleWidth, y, quadWidth, height), ToColor(93, 166, 221), 8f); Drawing2D.DrawQuad(new Vector2((x += mSampleWidth) + (quadWidth / 2), y), quadWidth, height, ToColor(21, 179, 89), 10f, -5f); Drawing2D.DrawDashedRect(new Rect(x += mSampleWidth, y, quadWidth, height), ToColor(175, 217, 141), 2f, 3); Drawing2D.DrawDashedQuad(new Vector2((x += mSampleWidth) + (quadWidth / 2), y + 1), quadWidth, height, ToColor(248, 222, 104), 3f, 7f, 3); Drawing2D.DrawDashedRect(new Rect(x += mSampleWidth, y, quadWidth, height), ToColor(255, 196, 126), 6f, 3); Drawing2D.FillQuad(new Vector2((x += mSampleWidth) + (quadWidth / 2), y + 10), quadWidth, height, ToColor(255, 112, 92), 8); Drawing2D.FillRect(new Rect(x += mSampleWidth, y - 10, quadWidth, height + 20), ToColor(232, 62, 83), CustomTexture3D); }
/// <summary> /// Circles Example /// </summary> private void DrawCircles() { mRectangleY += mRectangleHeight + 20; Drawing2D.DrawRect(new Rect(mRectangleX, mRectangleY, mRectangleWidth, mRectangleHeight)); Drawing2D.DrawText("Circles", mRectangleX + 5, mRectangleY + 5, 18, Color.white, mBitmapFont); float x = 15 - mSampleWidth; float y = mRectangleY + 50; float radius = mRectangleHeight - 60; Drawing2D.DrawCircle(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 8, ToColor(36, 86, 188), 2f); Drawing2D.DrawCircle(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 20, ToColor(93, 166, 221), 2f); Drawing2D.DrawCircle(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 20, ToColor(21, 179, 89), 4f); radius = mRectangleHeight - 50; y = mRectangleY + 40; Drawing2D.DrawDashedCircle(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 12, ToColor(175, 217, 141), 3f, 3f); Drawing2D.DrawDashedCircle(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 12, ToColor(248, 222, 104), 3f, 3f); Drawing2D.DrawDashedCircle(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 12, ToColor(255, 196, 126), 3f, 3f); Drawing2D.FillCircle(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, ToColor(255, 112, 92)); Drawing2D.FillCircle(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius * 1.15f, ToColor(232, 62, 83)); }
/// <summary> /// /// </summary> private void DrawChart() { // Draw main axis Drawing2D.DrawLine(new Vector2(mChartX, mChartY + mChartHeight), new Vector2(mChartX + mChartWidth, mChartY + mChartHeight), ToColor(240, 240, 240), 2); // X Axis Drawing2D.DrawLine(new Vector2(mChartX, mChartY + mChartHeight), new Vector2(mChartX, mChartY - 25), ToColor(240, 240, 240), 2); // Y Axis // Draw guide horizontal lines Drawing2D.DrawLine(new Vector2(mChartX, mChartY + 65), new Vector2(mChartX + mChartWidth, mChartY + 65), ToColor(180, 180, 180, 128), 1); Drawing2D.DrawLine(new Vector2(mChartX, mChartY + 50), new Vector2(mChartX + mChartWidth, mChartY + 50), ToColor(180, 180, 180, 128), 1); Drawing2D.DrawLine(new Vector2(mChartX, mChartY + 35), new Vector2(mChartX + mChartWidth, mChartY + 35), ToColor(180, 180, 180, 128), 1); Drawing2D.DrawLine(new Vector2(mChartX, mChartY + 20), new Vector2(mChartX + mChartWidth, mChartY + 20), ToColor(180, 180, 180, 128), 1); Drawing2D.DrawLine(new Vector2(mChartX, mChartY + 5), new Vector2(mChartX + mChartWidth, mChartY + 5), ToColor(180, 180, 180, 128), 1); Drawing2D.DrawLine(new Vector2(mChartX, mChartY - 10), new Vector2(mChartX + mChartWidth, mChartY - 10), ToColor(180, 180, 180, 128), 1); Drawing2D.DrawLine(new Vector2(mChartX, mChartY - 25), new Vector2(mChartX + mChartWidth, mChartY - 25), ToColor(180, 180, 180, 128), 1); Drawing2D.DrawText("Time", mChartX + mChartWidth, mChartY + mChartHeight - 10, 11, ToColor(240, 240, 240), mBitmapFont); Drawing2D.DrawText("Value", mChartX + 5, mChartY - 25, 11, ToColor(240, 240, 240), mBitmapFont); // Draw Series DrawSeries(mChartValuesRed, ToColor(232, 62, 83)); DrawSeries(mChartValuesYellow, ToColor(248, 222, 104)); }
/// <summary> /// Arcs Example /// </summary> private void DrawArcs() { mRectangleY += mRectangleHeight + 20; Drawing2D.DrawRect(new Rect(mRectangleX, mRectangleY, mRectangleWidth, mRectangleHeight)); Drawing2D.DrawText("Arcs", mRectangleX + 5, mRectangleY + 5, 18, Color.white, mBitmapFont); float x = 15 - mSampleWidth; float y = mRectangleY + 50; float radius = mRectangleHeight - 60; Drawing2D.DrawArc(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 8, 0, 270, ToColor(36, 86, 188), 2f, CustomTextureLines); Drawing2D.DrawArc(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 12, 90, 270, ToColor(93, 166, 221), 2f, CustomTextureLines); Drawing2D.DrawArc(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 16, 0, 180, ToColor(21, 179, 89), 4f, CustomTextureLines); radius = mRectangleHeight - 50; y = mRectangleY + 40; Drawing2D.DrawDashedArc(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 12, 0, 270, ToColor(175, 217, 141), 3f, 3f); Drawing2D.DrawDashedArc(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 12, 45, 225, ToColor(248, 222, 104), 4f, 3f); Drawing2D.DrawDashedArc(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, 12, 90, 270, ToColor(255, 196, 126), 6f, 3f); Drawing2D.FillCircle(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, ToColor(255, 112, 92)); Drawing2D.DrawDashedArc(new Vector2((x) + ((mSampleWidth / 2) - radius), y), radius + 2, 12, 90, 270, ToColor(255, 112, 92), 6f, 3f); Drawing2D.FillCircle(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius * 1.15f, ToColor(232, 62, 83)); Drawing2D.DrawDashedArc(new Vector2((x) + ((mSampleWidth / 2) - radius), y), (radius * 1.15f) + 2, 12, 0, 180, ToColor(232, 62, 83), 6f, 3f); }
/// <summary> /// Triangles Example /// </summary> private void DrawTriangles() { mRectangleY += mRectangleHeight + 20; Drawing2D.DrawRect(new Rect(mRectangleX, mRectangleY, mRectangleWidth, mRectangleHeight)); Drawing2D.DrawText("Triangles", mRectangleX + 5, mRectangleY + 5, 18, Color.white, mBitmapFont); float x = 15 - mSampleWidth; float y = mRectangleY + 50; x += mSampleWidth + 50; Drawing2D.DrawTriangle(new Vector2(x, y), new Vector2(x + 30, y - 15), new Vector2(x + 15, y + 15), ToColor(36, 86, 188), 2f); x += mSampleWidth; Drawing2D.DrawTriangle(new Vector2(x - 10, y + 5), new Vector2(x + 60, y - 20), new Vector2(x + 15, y + 15), ToColor(93, 166, 221), 4f); x += mSampleWidth; Drawing2D.DrawTriangle(new Vector2(x + 5, y - 10), new Vector2(x + 40, y - 15), new Vector2(x + 15, y + 20), ToColor(21, 179, 89), 2f); x += mSampleWidth + 20; Drawing2D.DrawDashedTriangle(new Vector2(x - 20, y), new Vector2(x + 30, y - 5), new Vector2(x + 15, y + 15), ToColor(175, 217, 141), 2f, 3f); x += mSampleWidth; Drawing2D.DrawDashedTriangle(new Vector2(x - 10, y - 15), new Vector2(x + 60, y - 20), new Vector2(x + 15, y + 15), ToColor(248, 222, 104), 4f, 3); x += mSampleWidth; Drawing2D.DrawDashedTriangle(new Vector2(x - 35, y - 30), new Vector2(x + 60, y - 25), new Vector2(x + 15, y + 20), ToColor(255, 196, 126), 6f, 3); Drawing2D.FillTriangle(new Vector2(x += mSampleWidth, y - 20), new Vector2(x + 50, y), new Vector2(x + 30, y + 20), ToColor(255, 112, 92)); Drawing2D.FillTriangle(new Vector2(x += mSampleWidth, y), new Vector2(x + 90, y - 20), new Vector2(x + 20, y + 20), ToColor(232, 62, 83)); }
public static void Draw(GameModel model, Painter painter, Graphics g, Int32 totalClientWidth, Int32 totalClientHeight) { s_penWhite = new Pen(Color.White, (Single)(5 * model.Camera.CurrentScale)); ScreenModelPressYourLuck screenModel = model.SMPressYourLuck; Position logPosBoundary = screenModel.LogPosSelectorBoundary; for (Int32 colIndex = 0; colIndex < 5; colIndex++) { for (Int32 rowIndex = 0; rowIndex < 5; rowIndex++) { Position logPos = new Position(logPosBoundary.UpperLeftX + 25 + 50 * colIndex, logPosBoundary.UpperLeftY + 50 + 50 * rowIndex, 50, 50); Position dispPos = model.Camera.MapLogicalToDisplay(logPos, true); SolidBrush sb = GetSolidBrushForOutcome(screenModel.RatingGrid[colIndex, rowIndex]); Drawing2D.DrawRect(g, sb, dispPos); } } Position logPosSelected = new Position(logPosBoundary.UpperLeftX + 25 + 50 * screenModel.SelectedX, logPosBoundary.UpperLeftY + 50 + 50 * screenModel.SelectedY, 50, 50); Drawing2D.DrawRectBorder(g, s_penWhite, model.Camera.MapLogicalToDisplay(logPosSelected, true)); s_penWhite.Dispose(); }
/// <summary> /// /// </summary> private void OnGUI() { // Set the 0,0 at the top-left corner of this panel mParentRect = Drawing2D.GetWorldRect(this.transform as RectTransform); Drawing2D.SetParentBounds(mParentRect); if (Event.current.type == EventType.Repaint) { mNumSamples = 8; mRectangleY = 10; mRectangleWidth = mParentRect.width - 20; mSampleWidth = (mParentRect.width - 30) / (mNumSamples); DrawLines(); DrawRectangles(); DrawCircles(); DrawArcs(); DrawTriangles(); DrawPolygons(); DrawCompound(); } Drawing2D.ClearParentBounds(); }
public override void DrawWorldBounds() { var worldRect = new Rect(DemoUtils.offset.x, DemoUtils.offset.y, world.width, world.height); Drawing2D.DrawRect(worldRect, DemoUtils.worldBoundsColor); }
public void DrawLine(Vector2 pointA, Vector2 pointB, Color color) { Drawing2D.DrawLine(pointA, pointB, color); }
private void DrawVertex(Vertex v) { Drawing2D.FillCircle(v.position + DemoUtils.offset, DemoUtils.vertexSize, DemoUtils.vertexColor); }
public void DrawTriangle(Vector2 a, Vector2 b, Vector2 c, Color color, float lineWidth) { Drawing2D.DrawTriangle(a, b, c, color, lineWidth); }
/// <summary> /// /// </summary> private void DrawCompound() { mNumSamples = 7; mSampleWidth = (mParentRect.width - 30) / (mNumSamples); mRectangleY += mRectangleHeight + 20; Drawing2D.DrawRect(new Rect(mRectangleX, mRectangleY, mRectangleWidth, mRectangleHeight)); Drawing2D.DrawText("Other", mRectangleX + 5, mRectangleY + 5, 18, Color.white, mBitmapFont); float x = 15 - mSampleWidth; float y = mRectangleY + 35; float height = mRectangleHeight - 55; // Bars Chart x += 50; Drawing2D.FillRect(new Rect((x += mSampleWidth + 20), y - 10, 15, 50), ToColor(36, 86, 188), CustomTexture3DVertical); Drawing2D.FillRect(new Rect(x + 15, y, 15, 40), ToColor(175, 217, 141), CustomTexture3DVertical); Drawing2D.FillRect(new Rect(x + 30, y + 20, 15, 20), ToColor(255, 112, 92), CustomTexture3DVertical); Drawing2D.FillRect(new Rect(x + 45, y - 5, 15, 45), ToColor(93, 166, 221), CustomTexture3DVertical); // Progress Bar (circle) float radius = mRectangleHeight - 60; y += 5; x -= 100; Drawing2D.DrawArc(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius * 1.5f, 32, 270, 270, ToColor(21, 179, 89), 8f, CustomTextureLines); Drawing2D.FillCircle(new Vector2((x) + ((mSampleWidth / 2) - radius), y), radius * 1.45f, ToColor(21, 179, 89, 128)); Drawing2D.DrawText("75%", (x) + ((mSampleWidth / 2) - radius - 15), y - 9, 18, Color.white, mBitmapFont); y -= 5; // Progress Bar x += 30; CustomTextureProgressBar.wrapMode = TextureWrapMode.Repeat; Drawing2D.DrawRect(new Rect(x += mSampleWidth, y, mSampleWidth - mSamplesMargin, height - 5), Color.white, 1f); Drawing2D.FillRect(new Rect(x, y + 1, mSampleWidth - mSamplesMargin - 20, height - 5 - 1), ToColor(255, 255, 255, 200), CustomTextureProgressBar, new Vector2(4, 1)); Drawing2D.DrawText("85%", (x) + ((mSampleWidth / 2) - 30), y + 1, 17, Color.white, mBitmapFont); //Drawing2D.DrawGUIText("85%", (x) + ((mSampleWidth / 2) - 30), y + 1, 17, Color.white); // X-Y Axis x += 60; Drawing2D.DrawArrow(new Vector2(x += mSampleWidth + 20, y + 35), new Vector2(x + 40, y + 35), ToColor(255, 112, 92), 4, 20, 25); Drawing2D.DrawText("X", x + 45, y + 15, 12, ToColor(255, 112, 92), mBitmapFont); Drawing2D.DrawArrow(new Vector2(x, y + 35), new Vector2(x, y - 5), ToColor(248, 222, 104), 4, 20, 25); Drawing2D.DrawText("Y", x + 10, y - 15, 12, ToColor(248, 222, 104), mBitmapFont); // Chart x -= 110; Drawing2D.DrawLine(new Vector2(x += mSampleWidth + 20, y + 35), new Vector2(x + 250, y + 35), ToColor(240, 240, 240), 2); // X Axis Drawing2D.DrawLine(new Vector2(x, y + 35), new Vector2(x, y - 25), ToColor(240, 240, 240), 2); // Y Axis Drawing2D.DrawLine(new Vector2(x, y + 20), new Vector2(x + 250, y + 20), ToColor(180, 180, 180, 128), 1); // 10 Axis Drawing2D.DrawLine(new Vector2(x, y + 5), new Vector2(x + 250, y + 5), ToColor(180, 180, 180, 128), 1); // 20 Axis Drawing2D.DrawLine(new Vector2(x, y - 10), new Vector2(x + 250, y - 10), ToColor(180, 180, 180, 128), 1); // 30 Axis Drawing2D.DrawLine(new Vector2(x, y - 25), new Vector2(x + 250, y - 25), ToColor(180, 180, 180, 128), 1); // 30 Axis Drawing2D.DrawText("Time", x + 220, y + 20, 11, ToColor(240, 240, 240), mBitmapFont); Drawing2D.DrawText("Value", x + 5, y - 25, 11, ToColor(240, 240, 240), mBitmapFont); Vector2[] vertices = new Vector2[12]; vertices[0] = new Vector2(x + 10, y + 30); vertices[1] = new Vector2(x + 30, y + 15); vertices[2] = new Vector2(x + 50, y + 20); vertices[3] = new Vector2(x + 70, y + 25); vertices[4] = new Vector2(x + 90, y + 15); vertices[5] = new Vector2(x + 110, y - 5); vertices[6] = new Vector2(x + 130, y - 15); vertices[7] = new Vector2(x + 150, y - 25); vertices[8] = new Vector2(x + 170, y - 5); vertices[9] = new Vector2(x + 190, y - 10); vertices[10] = new Vector2(x + 210, y - 15); vertices[11] = new Vector2(x + 230, y - 20); Drawing2D.DrawPolygon(vertices, ToColor(232, 62, 83), 4f, null, true); // Picture x += 110; Drawing2D.FillQuad(new Vector2((x += mSampleWidth) + 40, y + 5), 140, 64, Color.white, 8, CustomTexturePicture, null); Drawing2D.DrawQuad(new Vector2((x) + 40, y + 5), 140, 64, Color.white, 3, 8); x -= 20; Drawing2D.FillQuad(new Vector2((x += mSampleWidth) + 40, y + 5), 140, 64, Color.green, -6, CustomTexturePicture, null); Drawing2D.DrawQuad(new Vector2((x) + 40, y + 5), 140, 64, Color.white, 1, -6); }