mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- groundwork for menus with a fixed virtual screen size.
This commit is contained in:
parent
89cc69710c
commit
acd71f7019
4 changed files with 51 additions and 13 deletions
|
@ -69,6 +69,7 @@ CVAR(Bool, m_blockcontrollers, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
CVAR (Float, snd_menuvolume, 0.6f, CVAR_ARCHIVE)
|
||||
CVAR(Int, m_use_mouse, 2, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(Int, m_show_backbutton, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, m_cleanscale, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
static DMenu *GetCurrentMenu()
|
||||
{
|
||||
|
@ -147,6 +148,14 @@ void DListMenuDescriptor::Reset()
|
|||
mFontColor = CR_UNTRANSLATED;
|
||||
mFontColor2 = CR_UNTRANSLATED;
|
||||
mFromEngine = false;
|
||||
mVirtWidth = mVirtHeight = -1; // default to clean scaling
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DListMenuDescriptor, Reset)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DListMenuDescriptor);
|
||||
self->Reset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1034,6 +1043,8 @@ DEFINE_FIELD(DListMenuDescriptor, mFont)
|
|||
DEFINE_FIELD(DListMenuDescriptor, mFontColor)
|
||||
DEFINE_FIELD(DListMenuDescriptor, mFontColor2)
|
||||
DEFINE_FIELD(DListMenuDescriptor, mCenter)
|
||||
DEFINE_FIELD(DListMenuDescriptor, mVirtWidth)
|
||||
DEFINE_FIELD(DListMenuDescriptor, mVirtHeight)
|
||||
|
||||
DEFINE_FIELD(DOptionMenuDescriptor, mItems)
|
||||
DEFINE_FIELD(DOptionMenuDescriptor, mTitle)
|
||||
|
|
|
@ -88,6 +88,8 @@ public:
|
|||
EColorRange mFontColor2;
|
||||
bool mCenter;
|
||||
bool mFromEngine;
|
||||
int mVirtWidth;
|
||||
int mVirtHeight;
|
||||
|
||||
void Reset();
|
||||
size_t PropagateMark() override;
|
||||
|
|
|
@ -366,6 +366,28 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
|
|||
sc.MustGetString();
|
||||
desc->mNetgameMessage = sc.String;
|
||||
}
|
||||
else if (sc.Compare("size"))
|
||||
{
|
||||
if (sc.CheckNumber())
|
||||
{
|
||||
desc->mVirtWidth = sc.Number;
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetNumber();
|
||||
desc->mVirtHeight = sc.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.MustGetString();
|
||||
if (sc.Compare("clean"))
|
||||
{
|
||||
desc->mVirtWidth = -1;
|
||||
}
|
||||
if (sc.Compare("optclean"))
|
||||
{
|
||||
desc->mVirtWidth = -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool success = false;
|
||||
|
@ -631,6 +653,7 @@ static void ParseListMenu(FScanner &sc)
|
|||
sc.MustGetString();
|
||||
|
||||
DListMenuDescriptor *desc = Create<DListMenuDescriptor>();
|
||||
desc->Reset();
|
||||
desc->mMenuName = sc.String;
|
||||
desc->mSelectedItem = -1;
|
||||
desc->mAutoselect = -1;
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
class ListMenuDescriptor : MenuDescriptor native
|
||||
{
|
||||
enum
|
||||
{
|
||||
CleanScale = -1,
|
||||
OptCleanScale = -2
|
||||
};
|
||||
native Array<ListMenuItem> mItems;
|
||||
native int mSelectedItem;
|
||||
native double mSelectOfsX;
|
||||
|
@ -16,21 +21,18 @@ class ListMenuDescriptor : MenuDescriptor native
|
|||
native int mFontColor;
|
||||
native int mFontColor2;
|
||||
native bool mCenter;
|
||||
native int mVirtWidth, mVirtHeight;
|
||||
|
||||
void Reset()
|
||||
native void Reset();
|
||||
int DisplayWidth()
|
||||
{
|
||||
// Reset the default settings (ignore all other values in the struct)
|
||||
mSelectOfsX = 0;
|
||||
mSelectOfsY = 0;
|
||||
mSelector.SetInvalid();
|
||||
mDisplayTop = 0;
|
||||
mXpos = 0;
|
||||
mYpos = 0;
|
||||
mLinespacing = 0;
|
||||
mNetgameMessage = "";
|
||||
mFont = NULL;
|
||||
mFontColor = Font.CR_UNTRANSLATED;
|
||||
mFontColor2 = Font.CR_UNTRANSLATED;
|
||||
if (mVirtWidth == OptCleanScale) return m_cleanscale ? CleanScale : 320;
|
||||
return mVirtWidth;
|
||||
}
|
||||
int DisplayHeight()
|
||||
{
|
||||
if (mVirtWidth == OptCleanScale) return m_cleanscale ? CleanScale : 200;
|
||||
return mVirtHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue