public static void DrawEditorText(Alt.GUI.PaintEventArgs e, string text, string gameObjectName, Alt.Sketch.Size clientSize, int invalidateFPS, Alt.Sketch.Rendering.RenderType renderType)
        {
            if (text.StartsWith("AltGUI "))
            {
                text = text.Substring(7);
            }

            //e.Graphics.TextRenderingHint = Alt.Sketch.TextRenderingHint.SingleBitPerPixelGridFit;

            double sizeK   = 1.4;
            int    hoffset = 4;
            int    voffset = 6;

            e.Graphics.DrawString("AltGUI", EditorTextFont, Alt.Sketch.Brushes.LightBlue, new Alt.Sketch.Point(hoffset, 5));
            e.Graphics.DrawString(text,
                                  EditorTextFont, Alt.Sketch.Brushes.Yellow, new Alt.Sketch.Point(hoffset, voffset + EditorTextFont.Size * sizeK));
            voffset += 1;
            e.Graphics.DrawString("[" + gameObjectName + "]",
                                  EditorTextFont, Alt.Sketch.Brushes.Yellow, new Alt.Sketch.Point(hoffset, voffset + EditorTextFont.Size * sizeK * 2));
            voffset += 2;
            e.Graphics.DrawString("Max FPS: " + invalidateFPS.ToString(),
                                  EditorTextFont, Alt.Sketch.Brushes.WhiteSmoke, new Alt.Sketch.Point(hoffset, voffset + EditorTextFont.Size * sizeK * 3 + 1));
            e.Graphics.DrawString("Render Type: " + (renderType == Alt.Sketch.Rendering.RenderType.Software ? "Software" : "Hardware"),
                                  EditorTextFont, Alt.Sketch.Brushes.WhiteSmoke, new Alt.Sketch.Point(hoffset, voffset + EditorTextFont.Size * sizeK * 4 + 2));
            e.Graphics.DrawString("Size: " + clientSize.Width.ToString() + " x " + clientSize.Height.ToString(),
                                  EditorTextFont, Alt.Sketch.Brushes.WhiteSmoke, new Alt.Sketch.Point(hoffset, voffset + EditorTextFont.Size * sizeK * 5 + 3));
        }
Beispiel #2
0
        protected virtual void OnPaint(Alt.GUI.PaintEventArgs e)
        {
            ProcessResize();

            if (Child != null)
            {
                Child.InjectRender(e);
            }
        }
        void DoPaintInternal(Alt.GUI.PaintEventArgs e)
        {
                        #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                e.Graphics.FillRectangle(Alt.Sketch.Color.SteelBlue, e.ClipRectangle);
                e.Graphics.DrawRectangle(Alt.Sketch.Color.DodgerBlue, e.ClipRectangle - Alt.Sketch.Size.One);
            }
                        #endif

            DoPaint(e);
        }
Beispiel #4
0
        void DoPaint(Alt.GUI.PaintEventArgs e)
        {
                        #if UNITY_EDITOR
            if (Application.isPlaying)
                        #endif
            {
                OnPaintBackground(e);

                OnPaint(e);
            }

            if (!e.Handled)
            {
                AltGUIControlHost host = gameObject.GetComponentInParent <AltGUIControlHost>();
                if (host != null)
                {
                    host.DoPaint(e);

                                        #if UNITY_EDITOR
                    if (!Application.isPlaying)
                    {
                        return;
                    }
                                        #endif
                }
                                #if UNITY_EDITOR
                else if (!Application.isPlaying)
                {
                    AltSketchPaintHandler.DrawEditorText(e,
                                                         EditorName,
                                                         gameObject != null ? gameObject.name : "Unknown",
                                                         ClientSize,
                                                         MaxFPS,
                                                         RenderType);
                    return;
                }
                                #endif

                if (m_Paint != null)
                {
                    m_Paint(this, e);
                }

                m_onPaint.Invoke(e);
            }
        }
        protected override void OnPaint(Alt.GUI.PaintEventArgs e)
        {
            base.OnPaint(e);


            Alt.Sketch.Graphics graphics = e.Graphics;


            Matrix matrix = graphics.Transform;

            {
                //  correct offset
                Alt.Sketch.Rect clientRectangle = ClientRectangle;
                Alt.Sketch.Rect rect            = clientRectangle;
                double          targetX         = (m_TargetX - (clientRectangle.Width / 2)) * clientRectangle.Width / rect.Width + clientRectangle.Width / 2;
                double          targetY         = (m_TargetY - (clientRectangle.Height / 2)) * clientRectangle.Height / rect.Height + clientRectangle.Height / 2;
                graphics.TranslateTransform(targetX, targetY);

                graphics.RotateTransform(angle);

                int radialStep = 30;
                int nSteps     = 5;
                int lineDXY    = radialStep * (nSteps + 1);

                graphics.FillCircle(m_TargetBrush, 0, 0, radialStep * nSteps);

                graphics.SmoothingMode = SmoothingMode.AntiAlias;

                graphics.DrawLine(m_TargetPen, 0, -lineDXY, 0, lineDXY);
                graphics.DrawLine(m_TargetPen, -lineDXY, 0, lineDXY, 0);

                for (int i = 1; i <= nSteps; i++)
                {
                    graphics.DrawCircle(m_TargetPen, 0, 0, radialStep * i);
                }
            }
            graphics.Transform = matrix;
        }
Beispiel #6
0
 protected override void DoPaint(Alt.GUI.PaintEventArgs e)
 {
     m_Paint.DoPaint(e);
 }
Beispiel #7
0
 protected virtual void OnPaintBackground(Alt.GUI.PaintEventArgs e)
 {
 }
Beispiel #8
0
 protected virtual void OnPaint(Alt.GUI.PaintEventArgs e)
 {
 }
 protected abstract void DoPaint(Alt.GUI.PaintEventArgs e);
 protected override void OnPaintBackground(Alt.GUI.PaintEventArgs pevent)
 {
     //base.OnPaintBackground (pevent);
 }