protected override string Render(AreaCircle circle)
        {
            var x = circle.Rectangle.X + circle.Rectangle.Width / 2;
            var y = circle.Rectangle.Y + circle.Rectangle.Height / 2;
            var r = (circle.Rectangle.Width + circle.Rectangle.Height) / 4;
            var s = new StringBuilder();

            s.AppendLine("ctx.beginPath();");
            s.AppendLine($"ctx.arc({x}, {y}, {r}, 0, 2 * Math.PI);");

            if (circle.Fill)
            {
                s.AppendLine("ctx.fill();");
            }

            if (circle.Stroke)
            {
                s.AppendLine("ctx.stroke();");
            }

            return(s.ToString());
        }
Example #2
0
        protected override string Render(AreaCircle circle)
        {
            var x = circle.Rectangle.X + circle.Rectangle.Width / 2;
            var y = circle.Rectangle.Y + circle.Rectangle.Height / 2;
            var r = (circle.Rectangle.Width + circle.Rectangle.Height) / 4;

            if (circle.Fill && circle.Stroke)
            {
                return($@"<circle cx=""{x}"" cy=""{y}"" r=""{r}"" stroke=""{ColorToHtml(StrokeColor)}"" stroke-width=""{StrokeWidth}"" fill=""{ColorToHtml(FillColor)}"" />");
            }

            if (circle.Fill)
            {
                return($@"<circle cx=""{x}"" cy=""{y}"" r=""{r}"" fill=""{ColorToHtml(FillColor)}"" />");
            }

            if (circle.Stroke)
            {
                return($@"<circle cx=""{x}"" cy=""{y}"" r=""{r}"" stroke=""{ColorToHtml(StrokeColor)}"" stroke-width=""{StrokeWidth}"" fill=""none"" />");
            }

            return("");
        }
Example #3
0
 protected abstract string Render(AreaCircle circle);
Example #4
0
        /// <summary>
        /// Deletes all current textures
        /// </summary>
        public static void Reset()
        {
            //Texs
            foreach (DictionaryEntry ent in m_ColorTextures)
            {
                if (ent.Value != null)
                {
                    Texture tex = (Texture)ent.Value;
                    tex.Dispose();
                    tex = null;
                }
            }

            foreach (DictionaryEntry ent in m_Textures)
            {
                if (ent.Value != null)
                {
                    Texture tex = (Texture)ent.Value;
                    tex.Dispose();
                    tex = null;
                }
            }

            if (m_NPC != null)
            {
                NPC.Dispose();
                NPC = null;
            }
            if (m_Null != null)
            {
                Null.Dispose();
                Null = null;
            }
            if (m_Mob != null)
            {
                Mob.Dispose();
                Mob = null;
            }

            if (m_AreaCircle != null)
            {
                AreaCircle.Dispose();
                AreaCircle = null;
            }

            if (m_AreaSquare != null)
            {
                AreaSquare.Dispose();
                AreaSquare = null;
            }

            if (m_DefaultObject != null)
            {
                DefaultObject.Dispose();
                DefaultObject = null;
            }

            m_ColorTextures.Clear();
            m_Textures.Clear();
            GC.Collect();
        }