本文整理汇总了C#中RenderingContext.AddBox方法的典型用法代码示例。如果您正苦于以下问题:C# RenderingContext.AddBox方法的具体用法?C# RenderingContext.AddBox怎么用?C# RenderingContext.AddBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderingContext
的用法示例。
在下文中一共展示了RenderingContext.AddBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
{
Vec2 pos = mountPoints[UiMountPoint.LeftOfMinimap];
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Player = {0:X8}\r\n", model.Player.Address);
sb.AppendFormat("TheGame = {0:X8}\r\n", model.Internal.Address);
sb.AppendFormat("IngameState = {0:X8}\r\n", model.Internal.IngameState.Address);
sb.AppendFormat("IngameData = {0:X8}\r\n", model.Internal.IngameState.Data.Address);
sb.AppendFormat("InventoryFrame = {0:X8}\r\n", model.Internal.IngameState.IngameUi.InventoryPanel.Address);
var w1 = model.Internal.IngameState.IngameUi.InventoryPanel.MainWeaponSlot.GetItemAt();
//var flasks = model.Internal.IngameState.IngameUi.InventoryPanel.FlasksFrame;
//for (int i = 0; i < 5; i++)
//{
// var f1 = flasks.GetItemAt(i);
// if (f1 != null)
// sb.AppendFormat("F{1} = {0}\r\n",String.Join("; ", f1.EnumComponents().Select(kv => String.Format("{0}: {1:X8}", kv.Key, kv.Value))), i + 1);
//}
var szText = rc.AddTextWithHeight(pos, sb.ToString(), Color.White, 11, DrawTextFormat.Right);
Rect box = new Rect(pos.X - szText.X - 5, pos.Y - 5, szText.X + 10, szText.Y + 10);
rc.AddBox(box, Color.FromArgb(160, 0, 0, 0));
mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(pos.X, pos.Y + szText.Y + 10 + 5);
}
示例2: Render
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
{
int alpha = this.menuVisible ? 255 : 100;
rc.AddBox(this.bounds, Color.FromArgb(alpha, Color.Gray));
rc.AddTextWithHeight(new Vec2(Settings.PositionWidth + Settings.AnchorWidth / 2, Settings.PositionHeight + Settings.AnchorHeight / 2), "Menu", Color.Gray, 10, DrawTextFormat.Center | DrawTextFormat.VerticalCenter);
foreach (BooleanButton current in this.buttons)
current.Render(rc);
}
示例3: Render
public override void Render(RenderingContext rc)
{
if (!this.isVisible)
{
return;
}
Color color = this.isEnabled ? Color.Gray : Color.Crimson;
rc.AddTextWithHeight(new Vec2(base.Bounds.X + base.Bounds.W / 2, base.Bounds.Y + base.Bounds.H / 2), this.text, Color.White, 12, DrawTextFormat.VerticalCenter | DrawTextFormat.Center);
rc.AddBox(base.Bounds, Color.Black);
rc.AddBox(new Rect(base.Bounds.X + 1, base.Bounds.Y + 1, base.Bounds.W - 2, base.Bounds.H - 2), color);
if (this.children.Count > 0)
{
int num = (int)((float)(base.Bounds.W - 2) * 0.05f);
int num2 = (base.Bounds.H - 2) / 2;
rc.AddTexture("menu_submenu.png", new Rect(base.Bounds.X + base.Bounds.W - 1 - num, base.Bounds.Y + 1 + num2 - num2 / 2, num, num2));
}
foreach (MenuItem current in this.children)
{
current.Render(rc);
}
}
示例4: Render
public override void Render(RenderingContext rc)
{
if (!Settings.GetBool("ItemAlert") || !Settings.GetBool("ItemAlert.ShowText"))
{
return;
}
Rect clientRect = this.poe.Internal.game.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();
Vec2 rightTopAnchor = new Vec2(clientRect.X + clientRect.W, clientRect.Y + clientRect.H + 5);
int y = rightTopAnchor.Y;
int fontSize = Settings.GetInt("ItemAlert.ShowText.FontSize");
foreach (KeyValuePair<ExileBot.Entity, AlertDrawStyle> kv in this.currentAlerts)
{
if (!kv.Key.IsValid) continue;
string text = GetItemName(kv);
if( null == text ) continue;
AlertDrawStyle drawStyle = kv.Value;
int frameWidth = drawStyle.FrameWidth;
Vec2 vPadding = new Vec2(frameWidth + 5, frameWidth);
int frameMargin = frameWidth + 2;
Vec2 textPos = new Vec2(rightTopAnchor.X - vPadding.X, y + vPadding.Y);
var vTextFrame = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right);
int iconSize = vTextFrame.Y;
bool hasIcon = drawStyle.IconIndex >= 0;
int maxHeight = vTextFrame.Y + 2*vPadding.Y + frameMargin;
int maxWidth = vTextFrame.X + 2 * vPadding.X + (hasIcon ? iconSize : 0);
rc.AddBox(new Rect(rightTopAnchor.X - maxWidth, y, maxWidth, maxHeight), Color.FromArgb(180, 0, 0, 0));
if (hasIcon)
{
const float iconsInSprite = 4;
Rect iconPos = new Rect(textPos.X - iconSize - vTextFrame.X, textPos.Y, iconSize, iconSize);
RectUV uv = new RectUV(drawStyle.IconIndex / iconsInSprite, 0, (drawStyle.IconIndex + 1) / iconsInSprite, 1);
rc.AddSprite("item_icons.png", iconPos, uv);
}
if( frameWidth > 0) {
Rect frame = new Rect(rightTopAnchor.X - vTextFrame.X - 2*vPadding.X, y, vTextFrame.X + 2*vPadding.X, vTextFrame.Y + 2*vPadding.Y);
rc.AddFrame(frame, kv.Value.color, frameWidth);
}
y += vTextFrame.Y + 2 * vPadding.Y + frameMargin;
}
}
示例5: DrawEntityHealthbar
private void DrawEntityHealthbar(Color color, Color outline, Rect bg, float hpWidth, float esWidth, RenderingContext rc)
{
if (outline.ToArgb() != 0)
{
Rect rect = new Rect(bg.X - 2, bg.Y - 2, bg.W + 4, bg.H + 4);
rc.AddBox(rect, outline);
}
rc.AddTexture(Settings.GetBool("Healthbars.ShowIncrements") ? "healthbar_increment.png" : "healthbar.png", bg, color);
if ((int)hpWidth < bg.W)
{
Rect rect2 = new Rect(bg.X + (int)hpWidth, bg.Y, bg.W - (int)hpWidth, bg.H);
rc.AddTexture("healthbar_bg.png", rect2, color);
}
if (Settings.GetBool("Healthbars.ShowES"))
{
bg.W = (int)esWidth;
rc.AddTexture("esbar.png", bg, Color.White);
}
}
示例6: Render
public override void Render(RenderingContext rc)
{
if (!Settings.GetBool("DangerAlert.ShowText"))
{
return;
}
Rect rect = this.poe.Window.ClientRect();
int num = rect.W / 2 + rect.X;
int num2 = (int)((float)rect.H * 0.2f) + rect.Y;
int num3 = 0;
int num4 = 0;
HashSet<string> hashSet = new HashSet<string>();
foreach (KeyValuePair<Entity, string> current in this.currentAlerts)
{
if (current.Key.IsAlive && !hashSet.Contains(current.Value))
{
hashSet.Add(current.Value);
}
}
int @int = Settings.GetInt("DangerAlert.ShowText.FontSize");
foreach (string current2 in hashSet)
{
Vec2 vec = rc.AddTextWithHeight(new Vec2(num, num2), current2, Color.Red, @int, DrawTextFormat.Center);
if (vec.X > num3)
{
num3 = vec.X;
}
num2 += vec.Y;
num4 += vec.Y;
}
if (num3 > 0)
{
Rect rect2 = new Rect(num - num3 / 2 - 5, (int)((float)rect.H * 0.2f) + rect.Y - 5, num3 + 10, num4 + 10);
rc.AddBox(rect2, Color.FromArgb(Settings.GetInt("DangerAlert.ShowText.BgAlpha"), 1, 1, 1));
}
}
示例7: Render
public override void Render(RenderingContext rc)
{
if (!this.isVisible)
{
return;
}
rc.AddBox(base.Bounds, Color.Black);
rc.AddBox(new Rect(base.Bounds.X + 1, base.Bounds.Y + 1, base.Bounds.W - 2, base.Bounds.H - 2), Color.Gray);
for (int c = 0; c < 3; c++ )
{
Rect barBounds = new Rect(base.Bounds.X, base.Bounds.Y + (base.Bounds.H / 3 * c), base.Bounds.W - 15, base.Bounds.H / 3);
rc.AddTextWithHeight(new Vec2(barBounds.X + barBounds.W / 2, barBounds.Y + barBounds.H / 3), bars[c].Name + ": " + this.value.PrimaryColorValue(bars[c]), Color.White, 11, DrawTextFormat.VerticalCenter | DrawTextFormat.Center);
rc.AddBox(new Rect(barBounds.X + 5, barBounds.Y + (3 * barBounds.H / 4), barBounds.W - 10, 4), bars[c]);
rc.AddBox(new Rect(barBounds.X + 5 + ((barBounds.W - 10) * this.value.PrimaryColorValue(bars[c]) / 255) - 2, barBounds.Y + (3 * barBounds.H / 4) - 2, 4, 8), Color.White);
}
Rect preview = new Rect(base.Bounds.X + base.Bounds.W - 12, base.Bounds.Y + 2, 10, base.Bounds.H - 4);
rc.AddBox(preview, Color.Black);
rc.AddBox(new Rect(preview.X + 1, preview.Y + 1, preview.W - 2, preview.H - 2), this.value);
}
示例8: Render
public override void Render(RenderingContext rc)
{
if (!Settings.GetBool("Tooltip") || !Settings.GetBool("Tooltip.ShowItemMods"))
return;
Element uiHover = this.poe.Internal.IngameState.UIHover;
Entity poeEntity = uiHover.AsObject<InventoryItemIcon>().Item;
if (poeEntity.address == 0 || !poeEntity.IsValid)
return;
Tooltip tooltip = uiHover.AsObject<InventoryItemIcon>().Tooltip;
if (tooltip == null)
return;
Element childAtIndex1 = tooltip.GetChildAtIndex(0);
if (childAtIndex1 == null)
return;
Element childAtIndex2 = childAtIndex1.GetChildAtIndex(1);
if (childAtIndex2 == null)
return;
Rect clientRect = childAtIndex2.GetClientRect();
Rect headerRect = childAtIndex1.GetChildAtIndex(0).GetClientRect();
if (this.poeEntity == null || this.poeEntity.ID != poeEntity.ID) {
this.mods = new List<MaxRolls_Current>();
//List<Poe_ItemMod> impMods = poeEntity.GetComponent<Mods>().ImplicitMods;
List<ItemMod> expMods = poeEntity.GetComponent<Mods>().ItemMods;
int ilvl = poeEntity.GetComponent<Mods>().ItemLevel;
foreach (ItemMod item in expMods)
{
this.mods.Add(new MaxRolls_Current(item.Name, item.Level, ilvl));
}
this.poeEntity = poeEntity;
}
int tooltipBotY=clientRect.Y + clientRect.H;
int i = tooltipBotY;
// Implicit mods
//foreach (Poe_ItemMod item in impMods)
//{
// rc.AddTextWithHeight(new Vec2(clientRect.X, i), item.Name, Color.Yellow, 9, DrawTextFormat.Left);
// rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 10, i), item.Level.ToString(), Color.White, 6, DrawTextFormat.Left);
// i += 20;
//}
foreach (MaxRolls_Current item in this.mods)
{
rc.AddTextWithHeight(new Vec2(clientRect.X, i), item.name, item.color, 8, DrawTextFormat.Left);
i += 20;
rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 100, i), item.max, Color.White, 8, DrawTextFormat.Left);
rc.AddTextWithHeight(new Vec2(clientRect.X + 30, i), item.curr, Color.White, 8, DrawTextFormat.Left);
i += 20;
if (item.curr2 != null && item.max2 != null)
{
rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 100, i), item.max2, Color.White, 8, DrawTextFormat.Left);
rc.AddTextWithHeight(new Vec2(clientRect.X + 30, i), item.curr2, Color.White, 8, DrawTextFormat.Left);
i += 20;
}
}
if (i > tooltipBotY)
{
Rect helpRect = new Rect(clientRect.X + 1, tooltipBotY, clientRect.W, i - tooltipBotY);
rc.AddBox(helpRect, Color.FromArgb(220, Color.Black));
}
}
示例9: Render
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
{
if (!Settings.Enabled)
{
return;
}
int num = this.model.Memory.ReadInt(this.model.Memory.BaseAddress + model.Memory.offsets.FileRoot, new int[]
{
12
});
if (num != this.lastCount)
{
this.lastCount = num;
this.Parse();
}
if (this.disp.Count > 0)
{
Vec2 vec = mountPoints[UiMountPoint.LeftOfMinimap];
int num2 = vec.Y;
int maxWidth = 0;
foreach (string current in this.disp)
{
Vec2 vec2 = rc.AddTextWithHeight(new Vec2(vec.X, num2), current, Color.White, Settings.FontSize, DrawTextFormat.Right);
if (vec2.X + 10 > maxWidth)
{
maxWidth = vec2.X + 10;
}
num2 += vec2.Y;
}
if (maxWidth > 0 && Settings.BgAlpha > 0)
{
Rect bounds = new Rect(vec.X - maxWidth + 5, vec.Y - 5, maxWidth, num2 - vec.Y + 10);
rc.AddBox(bounds, Color.FromArgb(Settings.BgAlpha, 1, 1, 1));
mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(vec.X, vec.Y + 5 + bounds.H);
}
}
}
示例10: Render
public override void Render(RenderingContext rc)
{
if (!Settings.GetBool("PreloadAlert"))
{
return;
}
int num = this.poe.Memory.ReadInt(this.poe.Memory.BaseAddress + poe.Memory.offsets.FileRoot, new int[]
{
12
});
if (num != this.lastCount)
{
this.lastCount = num;
this.Parse();
}
if (this.disp.Count > 0)
{
Rect clientRect = this.poe.Internal.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();
Rect rect = this.overlay.XphRenderer.Bounds;
Vec2 vec = new Vec2(clientRect.X - 10, rect.Y + rect.H + 10);
int num2 = vec.Y;
int num3 = clientRect.W;
int @int = Settings.GetInt("PreloadAlert.FontSize");
int int2 = Settings.GetInt("PreloadAlert.BgAlpha");
foreach (string current in this.disp)
{
Vec2 vec2 = rc.AddTextWithHeight(new Vec2(vec.X, num2), current, Color.White, @int, DrawTextFormat.Right);
if (vec2.X + 10 > num3)
{
num3 = vec2.X + 10;
}
num2 += vec2.Y;
}
if (num3 > 0 && int2 > 0)
{
this.bounds = new Rect(vec.X - num3 + 5, vec.Y - 5, num3, num2 - vec.Y + 10);
rc.AddBox(this.bounds, Color.FromArgb(int2, 1, 1, 1));
}
}
}
示例11: RenderRolls
private void RenderRolls(RenderingContext rc, Rect clientRect)
{
int yPosTooltil = clientRect.Y + clientRect.H + 5;
int i = yPosTooltil + 4;
// Implicit mods
if( Settings.ShowImplicitMod)
foreach (RollValue mod in this._implicitMods)
{
i = drawStatLine(rc, mod, clientRect, i, true);
i += 6;
}
if (Settings.ShowItemMods)
foreach (RollValue item in this._explicitMods)
{
i = drawStatLine(rc, item, clientRect, i);
i += 4;
}
if (i > yPosTooltil + 4)
{
Rect helpRect = new Rect(clientRect.X + 1, yPosTooltil, clientRect.W, i - yPosTooltil);
rc.AddBox(helpRect, Color.FromArgb(220, Color.Black));
}
}
示例12: Render
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
{
if (this.model.Player != null && this.model.Player.GetComponent<Player>().Level >= 100)
{
return;
}
if (!this.hasStarted)
{
this.startXp = this.model.Player.GetComponent<Player>().XP;
this.startTime = DateTime.Now;
this.lastCalcTime = DateTime.Now;
this.hasStarted = true;
return;
}
DateTime dtNow = DateTime.Now;
TimeSpan delta = dtNow - this.lastCalcTime;
if (delta.TotalSeconds > 1)
{
calculateRemainingExp(dtNow);
this.lastCalcTime = dtNow;
}
int fontSize = Settings.FontSize;
int bgAlpha = Settings.BgAlpha;
Vec2 mapWithOffset = mountPoints[UiMountPoint.LeftOfMinimap];
int yCursor = 0;
Vec2 rateTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y), this.curDisplayString, Color.White, fontSize, DrawTextFormat.Right);
yCursor += rateTextSize.Y;
Vec2 remainingTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y + yCursor), this.curTimeLeftString, Color.White, fontSize, DrawTextFormat.Right);
yCursor += remainingTextSize.Y;
int thirdLine = mapWithOffset.Y + yCursor;
int textWidth = Math.Max(rateTextSize.X, remainingTextSize.X) + 10;
string strTimer = null;
if (Settings.ShowZoneAndTimeSpent)
{
Vec2 areaLevelNote = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, thirdLine), this.model.Area.CurrentArea.DisplayName, Color.White, fontSize, DrawTextFormat.Right);
strTimer = AreaInstance.GetTimeString(dtNow - this.model.Area.CurrentArea.TimeEntered);
Vec2 timerSize = rc.MeasureString(strTimer, fontSize, DrawTextFormat.Left);
yCursor += areaLevelNote.Y;
textWidth = Math.Max(textWidth, areaLevelNote.X + timerSize.X + 20 + 10);
}
Rect clientRect = model.Internal.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();
int width = Math.Max(textWidth, Math.Max(clientRect.W, 0/*this.overlay.PreloadAlert.Bounds.W*/));
Rect rect = new Rect(mapWithOffset.X - width + 5, mapWithOffset.Y - 5, width, yCursor + 10);
if( Settings.ShowClock)
rc.AddTextWithHeight(new Vec2(rect.X + 5, mapWithOffset.Y), dtNow.ToShortTimeString(), Color.White, fontSize, DrawTextFormat.Left);
if( Settings.ShowZoneAndTimeSpent)
rc.AddTextWithHeight(new Vec2(rect.X + 5, thirdLine), strTimer, Color.White, fontSize, DrawTextFormat.Left);
rc.AddBox(rect, Color.FromArgb(bgAlpha, 1, 1, 1));
mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(mapWithOffset.X, mapWithOffset.Y + 5 + rect.H);
}
示例13: Render
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
{
if (!hasStarted)
{
lastCalcTime = DateTime.Now;
hasStarted = true;
return;
}
DateTime dtNow = DateTime.Now;
TimeSpan delta = dtNow - lastCalcTime;
if (delta.TotalSeconds > dps_period)
{
ixDamageMemory++;
if (ixDamageMemory >= damageMemory.Length)
ixDamageMemory = 0;
damageMemory[ixDamageMemory] = CalculateDps(delta);
lastCalcTime = dtNow;
}
Vec2 mapWithOffset = mountPoints[UiMountPoint.LeftOfMinimap];
int dps = ((int)damageMemory.Average());
if (maxDps < dps)
maxDps = dps;
var textSize = rc.AddTextWithHeight(mapWithOffset, dps + " DPS", Color.White, Settings.DpsFontSize, DrawTextFormat.Right);
var tx2 = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y + textSize.Y), maxDps + " peak DPS", Color.White, Settings.PeakFontSize, DrawTextFormat.Right);
int width = Math.Max(tx2.X, textSize.X);
Rect rect = new Rect(mapWithOffset.X - 5 - width, mapWithOffset.Y - 5, width + 10, textSize.Y + tx2.Y + 10);
rc.AddBox(rect, Color.FromArgb(160, Color.Black));
mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(mapWithOffset.X, mapWithOffset.Y + 5 + rect.H);
}
示例14: Render
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
{
if (!Settings.ShowText || !alertsText.Any())
{
return;
}
Rect rect = model.Window.ClientRect();
int xScreenCenter = rect.W / 2 + rect.X;
int yPos = rect.H * Settings.YPosition / 100 + rect.Y;
var playerPos = model.Player.GetComponent<Positioned>().GridPos;
int fontSize = Settings.TextFontSize;
bool first = true;
Rect rectBackground = new Rect();
foreach (var alert in alertsText)
{
int cntAlive = alert.Value.Count(c => c.IsAlive);
if (cntAlive == 0)
continue;
Vec2 textSize = rc.MeasureString(alert.Key, fontSize, DrawTextFormat.Center);
int iconSize = 3 + textSize.Y;
int xPos = xScreenCenter - textSize.X / 2 - 6;
rc.AddTextWithHeight(new Vec2(xPos + 6, yPos), alert.Key, Color.Red, fontSize, DrawTextFormat.Left);
int cntArrows = 1;
rectBackground = new Rect(xPos - cntAlive * iconSize, yPos, textSize.X + 12 + cntAlive * iconSize, textSize.Y);
if (first) // vertical padding above
{
if( !Settings.StackUp)
rectBackground.Y -= 5;
rectBackground.H += 5;
first = false;
}
rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1));
foreach (EntityWrapper mob in alert.Value)
{
if (!mob.IsAlive)
continue;
Vec2 delta = mob.GetComponent<Positioned>().GridPos - playerPos;
double phi;
double distance = delta.GetPolarCoordinates(out phi);
RectUV uv = GetDirectionsUv(phi, distance);
Rect rectDirection = new Rect(xPos - cntArrows * iconSize, yPos, rectBackground.H, rectBackground.H);
cntArrows++;
rc.AddSprite("directions.png", rectDirection, uv, Color.Red);
}
yPos += Settings.StackUp ? -textSize.Y : textSize.Y;
}
if (!first) // vertical padding below
{
rectBackground.Y = rectBackground.Y + (Settings.StackUp ? - rectBackground.H - 5: rectBackground.H);
rectBackground.H = 5;
rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1));
}
}
示例15: drawItem
private static Vec2 drawItem(RenderingContext rc, AlertDrawStyle drawStyle, Vec2 delta, int x, int y, Vec2 vPadding, string text,
int fontSize)
{
// collapse padding when there's a frame
vPadding.X -= drawStyle.FrameWidth;
vPadding.Y -= drawStyle.FrameWidth;
// item will appear to have equal size
double phi;
var distance = delta.GetPolarCoordinates(out phi);
//text = text + " @ " + (int)distance + " : " + (int)(phi / Math.PI * 180) + " : " + xSprite;
int compassOffset = fontSize + 8;
Vec2 textPos = new Vec2(x - vPadding.X - compassOffset, y + vPadding.Y);
Vec2 vTextSize = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right);
int iconSize = drawStyle.IconIndex >= 0 ? vTextSize.Y : 0;
int fullHeight = vTextSize.Y + 2 * vPadding.Y + 2 * drawStyle.FrameWidth;
int fullWidth = vTextSize.X + 2 * vPadding.X + iconSize + 2 * drawStyle.FrameWidth + compassOffset;
rc.AddBox(new Rect(x - fullWidth, y, fullWidth - compassOffset, fullHeight), Color.FromArgb(180, 0, 0, 0));
var rectUV = GetDirectionsUv(phi, distance);
rc.AddSprite("directions.png", new Rect(x - vPadding.X - compassOffset + 6, y + vPadding.Y, vTextSize.Y, vTextSize.Y), rectUV);
if (iconSize > 0)
{
const float iconsInSprite = 6;
Rect iconPos = new Rect(textPos.X - iconSize - vTextSize.X, textPos.Y, iconSize, iconSize);
RectUV uv = new RectUV(drawStyle.IconIndex/iconsInSprite, 0, (drawStyle.IconIndex + 1)/iconsInSprite, 1);
rc.AddSprite("item_icons.png", iconPos, uv);
}
if (drawStyle.FrameWidth > 0)
{
Rect frame = new Rect(x - fullWidth, y, fullWidth - compassOffset , fullHeight);
rc.AddFrame(frame, drawStyle.color, drawStyle.FrameWidth);
}
return new Vec2(fullWidth, fullHeight);
}