Example #1
0
		private static void drawElt(RenderingContext rc, Element root, Vec2 parent, ref int x, ref int yPos, int[] path, int depth = 0)
		{
			if (!root.IsVisibleLocal || depth > 3)
			{
				return;
			}
            //Rect rC = new Rect(parent.X + (int)(root.X * 0.75), parent.Y + (int)(root.Y * 0.75), (int)(root.Width * 0.75), (int)(root.Height * 0.75));
            Rect rC = new Rect(parent.X + (int)(root.X * 0.75), parent.Y + (int)(root.Y * 0.75), (int)(root.Width * 0.75), (int)(root.Height * 0.75));

			if (rC.W < 20)
				return;
			string sPath = path[0].ToString("X3") + "-" + String.Join("-", path.Skip(1).Take(depth-1));
			int ix = depth > 0 ? path[depth - 1] : 0;
			var c = Color.FromArgb(255, 255 - 25 * (ix % 10), 255 - 25 * ((ix % 100) / 10), 255);

			string msg = string.Format("[{2}] {1:X8} : {0}", rC, root.Address, sPath);

			var v = rc.AddTextWithHeight(new Vec2(x, yPos), msg, c, 9, DrawTextFormat.Left);
			rc.AddTextWithHeight(new Vec2(rC.X, rC.Y + depth * 10 - 10), sPath, c, 8, DrawTextFormat.Left);

			rc.AddFrame(rC, c);
			yPos += v.Y;

			if (yPos > 1100)
			{
				yPos = 80;
				x += 300;
			}
			var pp = new Vec2(rC.X, rC.Y);
			for (int i = 0; i < root.Children.Count; i++)
			{
				var elt = root.Children[i];
				path[depth] = i;
				if (depth < 8)
					drawElt(rc, elt, pp, ref x, ref yPos, path, depth + 1);
			}
		}
Example #2
0
        private void RenderIconsOnMiniMap(RenderingContext rc, Element smallMinimap)
        {
            Vec2 playerPos = model.Player.GetComponent<Positioned>().GridPos;
            float pPosZ = model.Player.GetComponent<Render>().Z;

            const float scale = 240f;
            Rect clientRect = smallMinimap.GetClientRect();
            Vec2 minimapCenter = new Vec2(clientRect.X + clientRect.W/2, clientRect.Y + clientRect.H/2);
            double diag = Math.Sqrt(clientRect.W*clientRect.W + clientRect.H*clientRect.H)/2.0;
            foreach (MapIcon icon in _getIcons())
            {
                if (ShouldSkipIcon(icon))
                    continue;

                float iZ = icon.Entity.GetComponent<Render>().Z;
                Vec2 point = minimapCenter + MapIcon.deltaInWorldToMinimapDelta(icon.WorldPosition - playerPos, diag, scale, (int) ((iZ - pPosZ)/20));

                var texture = icon.MinimapIcon;
                int size = icon.Size;
                Rect rect = new Rect(point.X - size/2, point.Y - size/2, size, size);
                texture.DrawAt(rc, point, rect);
            }
        }
Example #3
0
        private static void drawElt(RenderingContext rc, Element root, Vec2 parent, ref int x, ref int yPos, int[] path, int depth = 0)
        {
            if ( /* !root.IsVisibleLocal || */ depth > MAX_DEPTH)
            {
                return;
            }
            var scale = root.Scale;
            Vec2f position = new Vec2f(parent.X + root.X * scale, parent.Y + root.Y * scale);
            Vec2 size = new Vec2((int)(root.Width * scale), (int)(root.Height * scale));

            //			if (rC.W < 20) return;

            string sPath = path[0].ToString("X3") + "-" + String.Join("-", path.Skip(1).Take(depth-1));
            int ix = depth > 0 ? path[depth - 1] : 0;
            var c = Color.FromArgb(255, 255 - 25 * (ix % 10), 255 - 25 * ((ix % 100) / 10), 255);

            string msg = string.Format("[{2}] {1:X8} : {0} {3}", position, root.Address, sPath, size);

            var v = rc.AddTextWithHeight(new Vec2(x, yPos), msg, c, 9, DrawTextFormat.Left);
            rc.AddTextWithHeight(new Vec2f(position.X, position.Y + depth * 10 - 10), sPath, c, 8, DrawTextFormat.Left);
            // rc.AddTextWithHeightAndOutline(new Vec2(rC.X, rC.Y + depth * 10 - 10), sPath, c, Color.Black, 8, DrawTextFormat.Left);

            rc.AddFrame(new Rect(position, size), c);
            yPos += v.Y;

            if (yPos > 1100)
            {
                yPos = 80;
                x += 300;
            }
            position.Y += root.ScrollY * root.Scale;

            List<Element> children = root.Children;
            for (int i = 0; i < children.Count && i < MAX_CHILDREN; i++)
            {
                var elt = children[i];
                path[depth] = i;
                drawElt(rc, elt, position, ref x, ref yPos, path, depth + 1);
            }
        }