mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-14 00:21:38 +00:00
- dynamically adjust SW's menu spacing based on language.
This commit is contained in:
parent
0f7d3d0cbb
commit
3512fe8fba
4 changed files with 52 additions and 1 deletions
|
@ -44,7 +44,8 @@ LISTMENU "MainMenu"
|
||||||
ifgame(ShadowWarrior)
|
ifgame(ShadowWarrior)
|
||||||
{
|
{
|
||||||
Position 55, 32
|
Position 55, 32
|
||||||
Linespacing 21
|
Linespacing 17
|
||||||
|
class SWMainMenu
|
||||||
SWLogo
|
SWLogo
|
||||||
SWTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
|
SWTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
|
||||||
SWTextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
|
SWTextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
|
||||||
|
@ -116,6 +117,7 @@ LISTMENU "IngameMenu"
|
||||||
{
|
{
|
||||||
Position 55, 32
|
Position 55, 32
|
||||||
Linespacing 17
|
Linespacing 17
|
||||||
|
class SWMainMenu
|
||||||
SWLogo
|
SWLogo
|
||||||
SWTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
|
SWTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
|
||||||
SWTextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
|
SWTextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
|
||||||
|
@ -195,6 +197,7 @@ LISTMENU "SkillMenu"
|
||||||
}
|
}
|
||||||
ifgame(ShadowWarrior)
|
ifgame(ShadowWarrior)
|
||||||
{
|
{
|
||||||
|
class SWMainMenu
|
||||||
CaptionItem "$MNU_DIFFICULTY"
|
CaptionItem "$MNU_DIFFICULTY"
|
||||||
Position 35, 32
|
Position 35, 32
|
||||||
Linespacing 17
|
Linespacing 17
|
||||||
|
|
|
@ -328,6 +328,36 @@ class ListMenu : Menu
|
||||||
{
|
{
|
||||||
mFocusControl = NULL;
|
mFocusControl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
void ChangeLineSpacing(int newspace)
|
||||||
|
{
|
||||||
|
double top = -32767;
|
||||||
|
|
||||||
|
for (int i = 0; i < mDesc.mItems.Size(); i++)
|
||||||
|
{
|
||||||
|
let selitem = ListMenuItemSelectable(mDesc.mItems[i]);
|
||||||
|
if (selitem)
|
||||||
|
{
|
||||||
|
let y = mDesc.mItems[i].GetY();
|
||||||
|
if (top == -32767)
|
||||||
|
{
|
||||||
|
top = y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
let newy = top + (y - top) / mDesc.mLineSpacing * newspace;
|
||||||
|
mDesc.mItems[i].SetY(newy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mDesc.mLineSpacing = newspace;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ class MenuItemBase : Object native ui version("2.4")
|
||||||
double GetY() { return mYpos; }
|
double GetY() { return mYpos; }
|
||||||
double GetX() { return mXpos; }
|
double GetX() { return mXpos; }
|
||||||
void SetX(double x) { mXpos = x; }
|
void SetX(double x) { mXpos = x; }
|
||||||
|
void SetY(double x) { mYpos = x; }
|
||||||
virtual void OnMenuCreated() {}
|
virtual void OnMenuCreated() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,23 @@ class SWMenuDelegate : RazeMenuDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
class SWMainMenu : ListMenu
|
||||||
|
{
|
||||||
|
override void Drawer()
|
||||||
|
{
|
||||||
|
let p = StringTable.Localize("REQUIRED_CHARACTERS", false);
|
||||||
|
int newls = (p == "REQUIRED_CHARACTERS")? 17 : 21;
|
||||||
|
if (newls != mDesc.mLineSpacing) ChangeLineSpacing(newls);
|
||||||
|
super.Drawer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
// logo
|
// logo
|
||||||
|
|
Loading…
Reference in a new issue