2017-10-25 22:21:13 +00:00
|
|
|
Class KFGUI_Button_CD extends KFGUI_Button;
|
|
|
|
|
|
|
|
function DrawMenu()
|
|
|
|
{
|
|
|
|
local float XL,YL,TS;
|
|
|
|
local byte i, FrameOpacity;
|
|
|
|
|
|
|
|
FrameOpacity = 200;
|
2020-11-28 20:04:55 +00:00
|
|
|
if(bDisabled)
|
2017-10-25 22:21:13 +00:00
|
|
|
Canvas.SetDrawColor(10, 10, 10, FrameOpacity);
|
2020-11-28 20:04:55 +00:00
|
|
|
else if(bPressedDown)
|
2017-10-25 22:21:13 +00:00
|
|
|
Canvas.SetDrawColor(20, 20, 20, FrameOpacity);
|
2020-11-28 20:04:55 +00:00
|
|
|
else if(bFocused)
|
2017-10-25 22:21:13 +00:00
|
|
|
Canvas.SetDrawColor(75, 75, 75, FrameOpacity);
|
|
|
|
else Canvas.SetDrawColor(45, 45, 45, FrameOpacity);
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
if(bIsHighlighted)
|
2017-10-25 22:21:13 +00:00
|
|
|
{
|
|
|
|
Canvas.DrawColor.R = Min(Canvas.DrawColor.R + 25, FrameOpacity);
|
2020-11-28 19:53:57 +00:00
|
|
|
Canvas.DrawColor.G = Min(Canvas.DrawColor.G + 25, FrameOpacity);
|
|
|
|
Canvas.DrawColor.B = Min(Canvas.DrawColor.B + 25, FrameOpacity);
|
2017-10-25 22:21:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Canvas.SetPos(0.f,0.f);
|
2020-11-28 20:04:55 +00:00
|
|
|
if(ExtravDir==255)
|
2017-10-25 22:21:13 +00:00
|
|
|
Owner.CurrentStyle.DrawWhiteBox(CompPos[2],CompPos[3]);
|
|
|
|
else Owner.CurrentStyle.DrawRectBox(0,0,CompPos[2],CompPos[3],Min(CompPos[2],CompPos[3])*0.2,ExtravDir);
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
if(OverlayTexture.Texture!=None)
|
2017-10-25 22:21:13 +00:00
|
|
|
{
|
|
|
|
Canvas.SetPos(0.f,0.f);
|
|
|
|
Canvas.DrawTile(OverlayTexture.Texture,CompPos[2],CompPos[3],OverlayTexture.U,OverlayTexture.V,OverlayTexture.UL,OverlayTexture.VL);
|
|
|
|
}
|
2020-11-28 20:04:55 +00:00
|
|
|
if(ButtonText!="")
|
2017-10-25 22:21:13 +00:00
|
|
|
{
|
|
|
|
// Chose the best font to fit this button.
|
|
|
|
i = Min(FontScale+Owner.CurrentStyle.DefaultFontSize,Owner.CurrentStyle.MaxFontScale);
|
2020-11-28 20:04:55 +00:00
|
|
|
while(true)
|
2017-10-25 22:21:13 +00:00
|
|
|
{
|
|
|
|
Canvas.Font = Owner.CurrentStyle.PickFont(i,TS);
|
|
|
|
Canvas.TextSize(ButtonText,XL,YL,TS,TS);
|
2020-11-28 20:04:55 +00:00
|
|
|
if(i==0 || (XL<(CompPos[2]*0.95) && YL<(CompPos[3]*0.95)))
|
2017-10-25 22:21:13 +00:00
|
|
|
break;
|
|
|
|
--i;
|
|
|
|
}
|
|
|
|
Canvas.SetPos((CompPos[2]-XL)*0.5,(CompPos[3]-YL)*0.5);
|
2020-11-28 20:04:55 +00:00
|
|
|
if(bDisabled)
|
2017-10-25 22:21:13 +00:00
|
|
|
Canvas.DrawColor = TextColor*0.5f;
|
|
|
|
else Canvas.DrawColor = TextColor;
|
|
|
|
Canvas.DrawText(ButtonText,,TS,TS,TextFontInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
|
|
|
}
|