geometry fix
This commit is contained in:
parent
2d9d2a15a9
commit
e21d7bd5f7
@ -509,7 +509,7 @@ final function DrawWhiteBox(float XS, float YS, optional bool bClip)
|
|||||||
Canvas.DrawTile(ItemTex, XS, YS, 19, 45, 1,1, ,bClip);
|
Canvas.DrawTile(ItemTex, XS, YS, 19, 45, 1,1, ,bClip);
|
||||||
}
|
}
|
||||||
|
|
||||||
final function DrawCornerSmart(out float X, float Y, int Edge, int CornerPosition, int CornerShape)
|
final function DrawCornerSmart(float X, float Y, int Edge, int CornerPosition, int CornerShape)
|
||||||
{
|
{
|
||||||
switch (CornerPosition)
|
switch (CornerPosition)
|
||||||
{
|
{
|
||||||
@ -521,12 +521,10 @@ final function DrawCornerSmart(out float X, float Y, int Edge, int CornerPositio
|
|||||||
case ECS_BeveledCorner:
|
case ECS_BeveledCorner:
|
||||||
Canvas.SetPos(X, Y);
|
Canvas.SetPos(X, Y);
|
||||||
DrawCornerTex(Edge, 0);
|
DrawCornerTex(Edge, 0);
|
||||||
X += Edge;
|
|
||||||
return;
|
return;
|
||||||
case ECS_VerticalCorner:
|
case ECS_VerticalCorner:
|
||||||
Canvas.SetPos(X, Y - Edge);
|
Canvas.SetPos(X, Y - Edge);
|
||||||
DrawCornerTex(Edge, 1);
|
DrawCornerTex(Edge, 1);
|
||||||
X += Edge;
|
|
||||||
return;
|
return;
|
||||||
case ECS_HorisontalCorner:
|
case ECS_HorisontalCorner:
|
||||||
Canvas.SetPos(X - Edge, Y);
|
Canvas.SetPos(X - Edge, Y);
|
||||||
@ -539,19 +537,16 @@ final function DrawCornerSmart(out float X, float Y, int Edge, int CornerPositio
|
|||||||
case ECS_Corner:
|
case ECS_Corner:
|
||||||
return;
|
return;
|
||||||
case ECS_BeveledCorner:
|
case ECS_BeveledCorner:
|
||||||
Canvas.SetPos(X, Y);
|
Canvas.SetPos(X - Edge, Y);
|
||||||
DrawCornerTex(Edge, 1);
|
DrawCornerTex(Edge, 1);
|
||||||
X += Edge;
|
|
||||||
return;
|
return;
|
||||||
case ECS_VerticalCorner:
|
case ECS_VerticalCorner:
|
||||||
Canvas.SetPos(X, Y - Edge);
|
Canvas.SetPos(X - Edge, Y - Edge);
|
||||||
DrawCornerTex(Edge, 0);
|
DrawCornerTex(Edge, 0);
|
||||||
X += Edge;
|
|
||||||
return;
|
return;
|
||||||
case ECS_HorisontalCorner:
|
case ECS_HorisontalCorner:
|
||||||
Canvas.SetPos(X, Y);
|
Canvas.SetPos(X, Y);
|
||||||
DrawCornerTex(Edge, 3);
|
DrawCornerTex(Edge, 3);
|
||||||
X += Edge;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case ECP_BottomLeft:
|
case ECP_BottomLeft:
|
||||||
@ -560,17 +555,15 @@ final function DrawCornerSmart(out float X, float Y, int Edge, int CornerPositio
|
|||||||
case ECS_Corner:
|
case ECS_Corner:
|
||||||
return;
|
return;
|
||||||
case ECS_BeveledCorner:
|
case ECS_BeveledCorner:
|
||||||
Canvas.SetPos(X, Y);
|
Canvas.SetPos(X, Y - Edge);
|
||||||
DrawCornerTex(Edge, 2);
|
DrawCornerTex(Edge, 2);
|
||||||
X += Edge;
|
|
||||||
return;
|
return;
|
||||||
case ECS_VerticalCorner:
|
case ECS_VerticalCorner:
|
||||||
Canvas.SetPos(X, Y);
|
Canvas.SetPos(X, Y);
|
||||||
DrawCornerTex(Edge, 3);
|
DrawCornerTex(Edge, 3);
|
||||||
X += Edge;
|
|
||||||
return;
|
return;
|
||||||
case ECS_HorisontalCorner:
|
case ECS_HorisontalCorner:
|
||||||
Canvas.SetPos(X - Edge, Y);
|
Canvas.SetPos(X - Edge, Y - Edge);
|
||||||
DrawCornerTex(Edge, 0);
|
DrawCornerTex(Edge, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -580,76 +573,64 @@ final function DrawCornerSmart(out float X, float Y, int Edge, int CornerPositio
|
|||||||
case ECS_Corner:
|
case ECS_Corner:
|
||||||
return;
|
return;
|
||||||
case ECS_BeveledCorner:
|
case ECS_BeveledCorner:
|
||||||
Canvas.SetPos(X, Y);
|
Canvas.SetPos(X - Edge, Y - Edge);
|
||||||
DrawCornerTex(Edge, 3);
|
DrawCornerTex(Edge, 3);
|
||||||
X += Edge;
|
|
||||||
return;
|
return;
|
||||||
case ECS_VerticalCorner:
|
case ECS_VerticalCorner:
|
||||||
Canvas.SetPos(X, Y);
|
Canvas.SetPos(X - Edge, Y);
|
||||||
DrawCornerTex(Edge, 2);
|
DrawCornerTex(Edge, 2);
|
||||||
X += Edge;
|
|
||||||
return;
|
return;
|
||||||
case ECS_HorisontalCorner:
|
case ECS_HorisontalCorner:
|
||||||
Canvas.SetPos(X, Y);
|
Canvas.SetPos(X, Y - Edge);
|
||||||
DrawCornerTex(Edge, 1);
|
DrawCornerTex(Edge, 1);
|
||||||
X += Edge;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final function FillSmart(out float X, float Y, float W, float H, int Edge, int LeftShape, int RightShape)
|
|
||||||
{
|
|
||||||
if (LeftShape != ECS_HorisontalCorner && LeftShape != ECS_Corner)
|
|
||||||
{
|
|
||||||
W -= Edge;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RightShape != ECS_HorisontalCorner && RightShape != ECS_Corner)
|
|
||||||
{
|
|
||||||
W -= Edge;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LeftShape != ECS_VerticalCorner)
|
|
||||||
{
|
|
||||||
Canvas.SetPos(X, Y);
|
|
||||||
DrawWhiteBox(W, H);
|
|
||||||
}
|
|
||||||
|
|
||||||
X += W;
|
|
||||||
}
|
|
||||||
|
|
||||||
final function DrawRectBoxSmart(float X, float Y, float W, float H, int Edge, int TopLeftShape, int TopRightShape, int BottomLeftShape, int BottomRightShape)
|
final function DrawRectBoxSmart(float X, float Y, float W, float H, int Edge, int TopLeftShape, int TopRightShape, int BottomLeftShape, int BottomRightShape)
|
||||||
{
|
{
|
||||||
local float TopY, MidY, BottomY, XPos;
|
local float BoxX, BoxY, BoxW, BoxH;
|
||||||
local int FillCount;
|
|
||||||
local float MidRectHeight;
|
|
||||||
|
|
||||||
FillCount = 0;
|
|
||||||
|
|
||||||
if (TopLeftShape != ECS_VerticalCorner)
|
|
||||||
FillCount++;
|
|
||||||
if (BottomLeftShape != ECS_VerticalCorner)
|
|
||||||
FillCount++;
|
|
||||||
MidRectHeight = H - Edge * FillCount;
|
|
||||||
|
|
||||||
TopY = Y; MidY = TopY + (TopLeftShape == ECS_VerticalCorner ? 0 : Edge); BottomY = MidY + MidRectHeight;
|
|
||||||
|
|
||||||
// Top Line
|
// Top Line
|
||||||
XPos = X;
|
DrawCornerSmart(X, Y, Edge, ECP_TopLeft, TopLeftShape);
|
||||||
DrawCornerSmart(XPos, TopY, Edge, ECP_TopLeft, TopLeftShape);
|
|
||||||
FillSmart(XPos, TopY, W, Edge, Edge, TopLeftShape, TopRightShape);
|
BoxX = X; BoxY = Y; BoxW = W; BoxH = Edge;
|
||||||
DrawCornerSmart(XPos, TopY, Edge, ECP_TopRight, TopRightShape);
|
if (TopLeftShape == ECS_BeveledCorner)
|
||||||
|
{
|
||||||
|
BoxX += Edge;
|
||||||
|
BoxW -= Edge;
|
||||||
|
}
|
||||||
|
if (TopRightShape == ECS_BeveledCorner)
|
||||||
|
{
|
||||||
|
BoxW -= Edge;
|
||||||
|
}
|
||||||
|
Canvas.SetPos(BoxX, Y);
|
||||||
|
DrawWhiteBox(BoxW, Edge);
|
||||||
|
|
||||||
|
DrawCornerSmart(X + W, Y, Edge, ECP_TopRight, TopRightShape);
|
||||||
|
|
||||||
// Mid Line
|
// Mid Line
|
||||||
XPos = X;
|
Canvas.SetPos(X, Y + Edge);
|
||||||
FillSmart(XPos, MidY, W, MidRectHeight, Edge, ECS_Corner, ECS_Corner);
|
DrawWhiteBox(W, H - Edge * 2);
|
||||||
|
|
||||||
// Bottom Line
|
// Bottom Line
|
||||||
XPos = X;
|
DrawCornerSmart(X, Y + H, Edge, ECP_BottomLeft, BottomLeftShape);
|
||||||
DrawCornerSmart(XPos, BottomY, Edge, ECP_BottomLeft, BottomLeftShape);
|
|
||||||
FillSmart(XPos, BottomY, W, Edge, Edge, BottomLeftShape, BottomRightShape);
|
BoxX = X; BoxY = Y + H - Edge; BoxW = W; BoxH = Edge;
|
||||||
DrawCornerSmart(XPos, BottomY, Edge, ECP_BottomRight, BottomRightShape);
|
if (BottomLeftShape == ECS_BeveledCorner)
|
||||||
|
{
|
||||||
|
BoxX += Edge;
|
||||||
|
BoxW -= Edge;
|
||||||
|
}
|
||||||
|
if (BottomRightShape == ECS_BeveledCorner)
|
||||||
|
{
|
||||||
|
BoxW -= Edge;
|
||||||
|
}
|
||||||
|
Canvas.SetPos(BoxX, Y + H - Edge);
|
||||||
|
DrawWhiteBox(BoxW, Edge);
|
||||||
|
|
||||||
|
DrawCornerSmart(X + W, Y + H, Edge, ECP_BottomRight, BottomRightShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
final function DrawRectBox(float X, float Y, float Width, float Height, int Edge, optional byte Extrav)
|
final function DrawRectBox(float X, float Y, float Width, float Height, int Edge, optional byte Extrav)
|
||||||
|
@ -108,7 +108,7 @@ function DrawRectPreviewWithText(float X, float Y, float WH, int Shape, float Fo
|
|||||||
local float TextWidth;
|
local float TextWidth;
|
||||||
local float TextHeight;
|
local float TextHeight;
|
||||||
|
|
||||||
Canvas.SetDrawColor(150, 150, 150, 200);
|
Canvas.SetDrawColor(50, 50, 50, 200);
|
||||||
Owner.CurrentStyle.DrawRectBox(X, Y, WH, WH, 16, Shape);
|
Owner.CurrentStyle.DrawRectBox(X, Y, WH, WH, 16, Shape);
|
||||||
|
|
||||||
Canvas.SetDrawColor(250, 250, 250, 255);
|
Canvas.SetDrawColor(250, 250, 250, 255);
|
||||||
@ -132,7 +132,7 @@ function DrawRectPreview(float FontScalar)
|
|||||||
Height = Canvas.ClipY * 0.4;
|
Height = Canvas.ClipY * 0.4;
|
||||||
|
|
||||||
BoxWH = Width / 13;
|
BoxWH = Width / 13;
|
||||||
BoxWHD = BoxWH * 0.3;
|
BoxWHD = BoxWH * 0.5;
|
||||||
|
|
||||||
X = XPosCenter - Width * 0.5;
|
X = XPosCenter - Width * 0.5;
|
||||||
Y = YPosCenter - Height * 0.5;
|
Y = YPosCenter - Height * 0.5;
|
||||||
|
Loading…
Reference in New Issue
Block a user