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 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 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(); }