- added a caption drawer control for ListMenus.

This commit is contained in:
Christoph Oelckers 2020-10-06 23:11:04 +02:00
parent 1ea6084478
commit 3ddc544a85
2 changed files with 38 additions and 4 deletions

View file

@ -6,10 +6,10 @@
LISTMENU "MainMenu"
{
/*
class "$.MainMenu"
//class "$.MainMenu"
ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{
/*
position 160, 55, 115
centermenu
animatedtransition
@ -20,11 +20,13 @@ LISTMENU "MainMenu"
NativeTextItem "$MNU_HELP", "h", "HelpMenu"
NativeTextItem "$MNU_CREDITS", "c", "CreditsMenu"
NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu"
*/
}
ifgame(Blood)
{
CaptionItem "Blood"
/*
position 160, 45, 150
caption "Blood"
centermenu
Linespacing 20
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
@ -34,9 +36,11 @@ LISTMENU "MainMenu"
NativeTextItem "$MNU_HELP", "h", "HelpMenu"
NativeTextItem "$MNU_CREDITS", "c", "CreditsMenu"
NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu"
*/
}
ifgame(ShadowWarrior)
{
/*
Position 55, 32
Linespacing 17
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
@ -53,9 +57,11 @@ LISTMENU "MainMenu"
NativeTextItem "$MNU_HOWTOORDER", "h", "CreditsMenu"
}
NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu"
*/
}
ifgame(Exhumed)
{
/*
Position 160, 65
centermenu
linespacing 22
@ -64,8 +70,8 @@ LISTMENU "MainMenu"
NativeTextItem "3462", "m", "StartGame", 0
NativeTextItem "3463", "v", "OptionsMenu"
NativeTextItem "3464", "q", "QuitMenu"
}
*/
}
}
//-------------------------------------------------------------------------------------------

View file

@ -340,3 +340,31 @@ class ListMenuItemPatchItem : ListMenuItemSelectable
}
//=============================================================================
//
// caption - draws a text using the customizer's caption hook
//
//=============================================================================
class ListMenuItemCaptionItem : ListMenuItem
{
String mText;
Font mFont;
void Init(ListMenuDescriptor desc, String text, String fnt = "BigFont")
{
Super.Init(0, 0);
mText = text;
mFont = Font.FindFont(fnt);
}
override void Draw(bool selected, ListMenuDescriptor desc)
{
let font = generic_ui || !desc.mFont ? NewSmallFont : desc.mFont;
if (font && mText.Length() > 0)
{
menuCustomizer.DrawCaption(mText, font, 0, true);
}
}
}