mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 08:31:14 +00:00
- some work on the base classes for menus. None of this is being used yet.
This commit is contained in:
parent
8578a5a12e
commit
d5b908186c
11 changed files with 189 additions and 74 deletions
|
@ -101,7 +101,7 @@ void DListMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
DListMenuItem *DListMenu::GetItem(FName name)
|
DMenuItemBase *DListMenu::GetItem(FName name)
|
||||||
{
|
{
|
||||||
for(unsigned i=0;i<mDesc->mItems.Size(); i++)
|
for(unsigned i=0;i<mDesc->mItems.Size(); i++)
|
||||||
{
|
{
|
||||||
|
@ -274,27 +274,27 @@ void DListMenu::Drawer ()
|
||||||
// base class for menu items
|
// base class for menu items
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
IMPLEMENT_CLASS(DListMenuItem, true, false)
|
IMPLEMENT_CLASS(DMenuItemBase, true, false)
|
||||||
|
|
||||||
bool DListMenuItem::CheckCoordinate(int x, int y)
|
bool DMenuItemBase::CheckCoordinate(int x, int y)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DListMenuItem::Ticker()
|
void DMenuItemBase::Ticker()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DListMenuItem::Drawer(bool selected)
|
void DMenuItemBase::Drawer(bool selected)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DListMenuItem::Selectable()
|
bool DMenuItemBase::Selectable()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DListMenuItem::DrawSelector(int xofs, int yofs, FTextureID tex)
|
void DMenuItemBase::DrawSelector(int xofs, int yofs, FTextureID tex)
|
||||||
{
|
{
|
||||||
if (tex.isNull())
|
if (tex.isNull())
|
||||||
{
|
{
|
||||||
|
@ -315,57 +315,57 @@ void DListMenuItem::DrawSelector(int xofs, int yofs, FTextureID tex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DListMenuItem::Activate()
|
bool DMenuItemBase::Activate()
|
||||||
{
|
{
|
||||||
return false; // cannot be activated
|
return false; // cannot be activated
|
||||||
}
|
}
|
||||||
|
|
||||||
FName DListMenuItem::GetAction(int *pparam)
|
FName DMenuItemBase::GetAction(int *pparam)
|
||||||
{
|
{
|
||||||
return mAction;
|
return mAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DListMenuItem::SetString(int i, const char *s)
|
bool DMenuItemBase::SetString(int i, const char *s)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DListMenuItem::GetString(int i, char *s, int len)
|
bool DMenuItemBase::GetString(int i, char *s, int len)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DListMenuItem::SetValue(int i, int value)
|
bool DMenuItemBase::SetValue(int i, int value)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DListMenuItem::GetValue(int i, int *pvalue)
|
bool DMenuItemBase::GetValue(int i, int *pvalue)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DListMenuItem::Enable(bool on)
|
void DMenuItemBase::Enable(bool on)
|
||||||
{
|
{
|
||||||
mEnabled = on;
|
mEnabled = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DListMenuItem::MenuEvent(int mkey, bool fromcontroller)
|
bool DMenuItemBase::MenuEvent(int mkey, bool fromcontroller)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DListMenuItem::MouseEvent(int type, int x, int y)
|
bool DMenuItemBase::MouseEvent(int type, int x, int y)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DListMenuItem::CheckHotkey(int c)
|
bool DMenuItemBase::CheckHotkey(int c)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DListMenuItem::GetWidth()
|
int DMenuItemBase::GetWidth()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,7 @@ int DListMenuItem::GetWidth()
|
||||||
IMPLEMENT_CLASS(DListMenuItemStaticPatch, false, false)
|
IMPLEMENT_CLASS(DListMenuItemStaticPatch, false, false)
|
||||||
|
|
||||||
DListMenuItemStaticPatch::DListMenuItemStaticPatch(int x, int y, FTextureID patch, bool centered)
|
DListMenuItemStaticPatch::DListMenuItemStaticPatch(int x, int y, FTextureID patch, bool centered)
|
||||||
: DListMenuItem(x, y)
|
: DMenuItemBase(x, y)
|
||||||
{
|
{
|
||||||
mTexture = patch;
|
mTexture = patch;
|
||||||
mCentered = centered;
|
mCentered = centered;
|
||||||
|
@ -415,7 +415,7 @@ void DListMenuItemStaticPatch::Drawer(bool selected)
|
||||||
IMPLEMENT_CLASS(DListMenuItemStaticText, false, false)
|
IMPLEMENT_CLASS(DListMenuItemStaticText, false, false)
|
||||||
|
|
||||||
DListMenuItemStaticText::DListMenuItemStaticText(int x, int y, const char *text, FFont *font, EColorRange color, bool centered)
|
DListMenuItemStaticText::DListMenuItemStaticText(int x, int y, const char *text, FFont *font, EColorRange color, bool centered)
|
||||||
: DListMenuItem(x, y)
|
: DMenuItemBase(x, y)
|
||||||
{
|
{
|
||||||
mText = text;
|
mText = text;
|
||||||
mFont = font;
|
mFont = font;
|
||||||
|
@ -452,7 +452,7 @@ void DListMenuItemStaticText::Drawer(bool selected)
|
||||||
IMPLEMENT_CLASS(DListMenuItemSelectable, false, false)
|
IMPLEMENT_CLASS(DListMenuItemSelectable, false, false)
|
||||||
|
|
||||||
DListMenuItemSelectable::DListMenuItemSelectable(int x, int y, int height, FName action, int param)
|
DListMenuItemSelectable::DListMenuItemSelectable(int x, int y, int height, FName action, int param)
|
||||||
: DListMenuItem(x, y, action)
|
: DMenuItemBase(x, y, action)
|
||||||
{
|
{
|
||||||
mHeight = height;
|
mHeight = height;
|
||||||
mParam = param;
|
mParam = param;
|
||||||
|
|
|
@ -92,12 +92,12 @@ struct FMenuDescriptor
|
||||||
virtual size_t PropagateMark() { return 0; }
|
virtual size_t PropagateMark() { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DListMenuItem;
|
class DMenuItemBase;
|
||||||
class DOptionMenuItem;
|
class DOptionMenuItem;
|
||||||
|
|
||||||
struct FListMenuDescriptor : public FMenuDescriptor
|
struct FListMenuDescriptor : public FMenuDescriptor
|
||||||
{
|
{
|
||||||
TArray<DListMenuItem *> mItems;
|
TArray<DMenuItemBase *> mItems;
|
||||||
int mSelectedItem;
|
int mSelectedItem;
|
||||||
int mSelectOfsX;
|
int mSelectOfsX;
|
||||||
int mSelectOfsY;
|
int mSelectOfsY;
|
||||||
|
@ -255,9 +255,9 @@ public:
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
class DListMenuItem : public DObject
|
class DMenuItemBase : public DObject
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(DListMenuItem, DObject)
|
DECLARE_CLASS(DMenuItemBase, DObject)
|
||||||
protected:
|
protected:
|
||||||
int mXpos, mYpos;
|
int mXpos, mYpos;
|
||||||
FName mAction;
|
FName mAction;
|
||||||
|
@ -265,7 +265,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
|
|
||||||
DListMenuItem(int xpos = 0, int ypos = 0, FName action = NAME_None)
|
DMenuItemBase(int xpos = 0, int ypos = 0, FName action = NAME_None)
|
||||||
{
|
{
|
||||||
mXpos = xpos;
|
mXpos = xpos;
|
||||||
mYpos = ypos;
|
mYpos = ypos;
|
||||||
|
@ -295,9 +295,9 @@ public:
|
||||||
void SetX(int x) { mXpos = x; }
|
void SetX(int x) { mXpos = x; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DListMenuItemStaticPatch : public DListMenuItem
|
class DListMenuItemStaticPatch : public DMenuItemBase
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(DListMenuItemStaticPatch, DListMenuItem)
|
DECLARE_CLASS(DListMenuItemStaticPatch, DMenuItemBase)
|
||||||
protected:
|
protected:
|
||||||
FTextureID mTexture;
|
FTextureID mTexture;
|
||||||
bool mCentered;
|
bool mCentered;
|
||||||
|
@ -308,9 +308,9 @@ public:
|
||||||
void Drawer(bool selected);
|
void Drawer(bool selected);
|
||||||
};
|
};
|
||||||
|
|
||||||
class DListMenuItemStaticText : public DListMenuItem
|
class DListMenuItemStaticText : public DMenuItemBase
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(DListMenuItemStaticText, DListMenuItem)
|
DECLARE_CLASS(DListMenuItemStaticText, DMenuItemBase)
|
||||||
protected:
|
protected:
|
||||||
FString mText;
|
FString mText;
|
||||||
FFont *mFont;
|
FFont *mFont;
|
||||||
|
@ -329,9 +329,9 @@ public:
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
class DListMenuItemPlayerDisplay : public DListMenuItem
|
class DListMenuItemPlayerDisplay : public DMenuItemBase
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(DListMenuItemPlayerDisplay, DListMenuItem)
|
DECLARE_CLASS(DListMenuItemPlayerDisplay, DMenuItemBase)
|
||||||
|
|
||||||
FListMenuDescriptor *mOwner;
|
FListMenuDescriptor *mOwner;
|
||||||
FTexture *mBackdrop;
|
FTexture *mBackdrop;
|
||||||
|
@ -379,9 +379,9 @@ public:
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
class DListMenuItemSelectable : public DListMenuItem
|
class DListMenuItemSelectable : public DMenuItemBase
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(DListMenuItemSelectable, DListMenuItem)
|
DECLARE_CLASS(DListMenuItemSelectable, DMenuItemBase)
|
||||||
protected:
|
protected:
|
||||||
int mHotkey;
|
int mHotkey;
|
||||||
int mHeight;
|
int mHeight;
|
||||||
|
@ -523,22 +523,22 @@ class DListMenu : public DMenu
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FListMenuDescriptor *mDesc;
|
FListMenuDescriptor *mDesc;
|
||||||
DListMenuItem *mFocusControl;
|
DMenuItemBase *mFocusControl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DListMenu(DMenu *parent = NULL, FListMenuDescriptor *desc = NULL);
|
DListMenu(DMenu *parent = NULL, FListMenuDescriptor *desc = NULL);
|
||||||
virtual void Init(DMenu *parent = NULL, FListMenuDescriptor *desc = NULL);
|
virtual void Init(DMenu *parent = NULL, FListMenuDescriptor *desc = NULL);
|
||||||
DListMenuItem *GetItem(FName name);
|
DMenuItemBase *GetItem(FName name);
|
||||||
bool Responder (event_t *ev);
|
bool Responder (event_t *ev);
|
||||||
bool MenuEvent (int mkey, bool fromcontroller);
|
bool MenuEvent (int mkey, bool fromcontroller);
|
||||||
bool MouseEvent(int type, int x, int y);
|
bool MouseEvent(int type, int x, int y);
|
||||||
void Ticker ();
|
void Ticker ();
|
||||||
void Drawer ();
|
void Drawer ();
|
||||||
void SetFocus(DListMenuItem *fc)
|
void SetFocus(DMenuItemBase *fc)
|
||||||
{
|
{
|
||||||
mFocusControl = fc;
|
mFocusControl = fc;
|
||||||
}
|
}
|
||||||
bool CheckFocus(DListMenuItem *fc)
|
bool CheckFocus(DMenuItemBase *fc)
|
||||||
{
|
{
|
||||||
return mFocusControl == fc;
|
return mFocusControl == fc;
|
||||||
}
|
}
|
||||||
|
@ -555,9 +555,9 @@ public:
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
class DOptionMenuItem : public DListMenuItem
|
class DOptionMenuItem : public DMenuItemBase
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(DOptionMenuItem, DListMenuItem)
|
DECLARE_ABSTRACT_CLASS(DOptionMenuItem, DMenuItemBase)
|
||||||
protected:
|
protected:
|
||||||
FString mLabel;
|
FString mLabel;
|
||||||
bool mCentered;
|
bool mCentered;
|
||||||
|
@ -566,7 +566,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DOptionMenuItem(const char *text = nullptr, FName action = NAME_None, bool center = false)
|
DOptionMenuItem(const char *text = nullptr, FName action = NAME_None, bool center = false)
|
||||||
: DListMenuItem(0, 0, action)
|
: DMenuItemBase(0, 0, action)
|
||||||
{
|
{
|
||||||
mLabel = text;
|
mLabel = text;
|
||||||
mCentered = center;
|
mCentered = center;
|
||||||
|
|
|
@ -294,7 +294,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
FTextureID tex = GetMenuTexture(sc.String);
|
FTextureID tex = GetMenuTexture(sc.String);
|
||||||
|
|
||||||
DListMenuItem *it = new DListMenuItemStaticPatch(x, y, tex, centered);
|
DMenuItemBase *it = new DListMenuItemStaticPatch(x, y, tex, centered);
|
||||||
desc->mItems.Push(it);
|
desc->mItems.Push(it);
|
||||||
}
|
}
|
||||||
else if (sc.Compare("StaticText") || sc.Compare("StaticTextCentered"))
|
else if (sc.Compare("StaticText") || sc.Compare("StaticTextCentered"))
|
||||||
|
@ -315,7 +315,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
||||||
cr = V_FindFontColor(sc.String);
|
cr = V_FindFontColor(sc.String);
|
||||||
if (cr == CR_UNTRANSLATED && !sc.Compare("untranslated")) cr = desc->mFontColor;
|
if (cr == CR_UNTRANSLATED && !sc.Compare("untranslated")) cr = desc->mFontColor;
|
||||||
}
|
}
|
||||||
DListMenuItem *it = new DListMenuItemStaticText(x, y, label, desc->mFont, cr, centered);
|
DMenuItemBase *it = new DListMenuItemStaticText(x, y, label, desc->mFont, cr, centered);
|
||||||
desc->mItems.Push(it);
|
desc->mItems.Push(it);
|
||||||
}
|
}
|
||||||
else if (sc.Compare("PatchItem"))
|
else if (sc.Compare("PatchItem"))
|
||||||
|
@ -335,7 +335,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
||||||
param = sc.Number;
|
param = sc.Number;
|
||||||
}
|
}
|
||||||
|
|
||||||
DListMenuItem *it = new DListMenuItemPatch(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, tex, action, param);
|
DMenuItemBase *it = new DListMenuItemPatch(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, tex, action, param);
|
||||||
desc->mItems.Push(it);
|
desc->mItems.Push(it);
|
||||||
desc->mYpos += desc->mLinespacing;
|
desc->mYpos += desc->mLinespacing;
|
||||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
||||||
|
@ -357,7 +357,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
||||||
param = sc.Number;
|
param = sc.Number;
|
||||||
}
|
}
|
||||||
|
|
||||||
DListMenuItem *it = new DListMenuItemText(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, param);
|
DMenuItemBase *it = new DListMenuItemText(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, param);
|
||||||
desc->mItems.Push(it);
|
desc->mItems.Push(it);
|
||||||
desc->mYpos += desc->mLinespacing;
|
desc->mYpos += desc->mLinespacing;
|
||||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
||||||
|
@ -426,7 +426,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
||||||
int ofs = sc.Number;
|
int ofs = sc.Number;
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
DListMenuItem *it = new DPlayerNameBox(desc->mXpos, desc->mYpos, desc->mLinespacing, ofs, text, desc->mFont, desc->mFontColor, sc.String);
|
DMenuItemBase *it = new DPlayerNameBox(desc->mXpos, desc->mYpos, desc->mLinespacing, ofs, text, desc->mFont, desc->mFontColor, sc.String);
|
||||||
desc->mItems.Push(it);
|
desc->mItems.Push(it);
|
||||||
desc->mYpos += desc->mLinespacing;
|
desc->mYpos += desc->mLinespacing;
|
||||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
||||||
|
@ -444,7 +444,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
values = sc.String;
|
values = sc.String;
|
||||||
}
|
}
|
||||||
DListMenuItem *it = new DValueTextItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, values);
|
DMenuItemBase *it = new DValueTextItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, values);
|
||||||
desc->mItems.Push(it);
|
desc->mItems.Push(it);
|
||||||
desc->mYpos += desc->mLinespacing;
|
desc->mYpos += desc->mLinespacing;
|
||||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
||||||
|
@ -465,7 +465,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
sc.MustGetNumber();
|
sc.MustGetNumber();
|
||||||
int step = sc.Number;
|
int step = sc.Number;
|
||||||
DListMenuItem *it = new DSliderItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, action, min, max, step);
|
DMenuItemBase *it = new DSliderItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, action, min, max, step);
|
||||||
desc->mItems.Push(it);
|
desc->mItems.Push(it);
|
||||||
desc->mYpos += desc->mLinespacing;
|
desc->mYpos += desc->mLinespacing;
|
||||||
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
|
||||||
|
@ -1081,7 +1081,7 @@ static void BuildEpisodeMenu()
|
||||||
ld->mSelectedItem = ld->mItems.Size();
|
ld->mSelectedItem = ld->mItems.Size();
|
||||||
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
|
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
|
||||||
{
|
{
|
||||||
DListMenuItem *it;
|
DMenuItemBase *it;
|
||||||
if (AllEpisodes[i].mPicName.IsNotEmpty())
|
if (AllEpisodes[i].mPicName.IsNotEmpty())
|
||||||
{
|
{
|
||||||
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
|
||||||
|
@ -1465,7 +1465,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
||||||
for(unsigned int i = 0; i < AllSkills.Size(); i++)
|
for(unsigned int i = 0; i < AllSkills.Size(); i++)
|
||||||
{
|
{
|
||||||
FSkillInfo &skill = AllSkills[i];
|
FSkillInfo &skill = AllSkills[i];
|
||||||
DListMenuItem *li;
|
DMenuItemBase *li;
|
||||||
// Using a different name for skills that must be confirmed makes handling this easier.
|
// Using a different name for skills that must be confirmed makes handling this easier.
|
||||||
FName action = (skill.MustConfirm && !AllEpisodes[gs->Episode].mNoSkill) ?
|
FName action = (skill.MustConfirm && !AllEpisodes[gs->Episode].mNoSkill) ?
|
||||||
NAME_StartgameConfirm : NAME_Startgame;
|
NAME_StartgameConfirm : NAME_Startgame;
|
||||||
|
|
|
@ -402,7 +402,7 @@ public:
|
||||||
if (mParentMenu->IsKindOf(RUNTIME_CLASS(DOptionMenu)))
|
if (mParentMenu->IsKindOf(RUNTIME_CLASS(DOptionMenu)))
|
||||||
{
|
{
|
||||||
DOptionMenu *m = barrier_cast<DOptionMenu*>(mParentMenu);
|
DOptionMenu *m = barrier_cast<DOptionMenu*>(mParentMenu);
|
||||||
DListMenuItem *it = m->GetItem(NAME_Controlmessage);
|
DMenuItemBase *it = m->GetItem(NAME_Controlmessage);
|
||||||
if (it != NULL)
|
if (it != NULL)
|
||||||
{
|
{
|
||||||
it->SetValue(0, which);
|
it->SetValue(0, which);
|
||||||
|
@ -1242,7 +1242,7 @@ IMPLEMENT_CLASS(DOptionMenuTextField, false, false)
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
// [TP] DOptionMenuNumberField
|
// [TP] FOptionMenuNumberField
|
||||||
//
|
//
|
||||||
// A numeric input field widget, for use with number CVars where sliders are inappropriate (i.e.
|
// A numeric input field widget, for use with number CVars where sliders are inappropriate (i.e.
|
||||||
// where the user is interested in the exact value specifically)
|
// where the user is interested in the exact value specifically)
|
||||||
|
|
|
@ -355,9 +355,8 @@ void FBackdropTexture::Render()
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
IMPLEMENT_CLASS(DListMenuItemPlayerDisplay, false, false)
|
IMPLEMENT_CLASS(DListMenuItemPlayerDisplay, false, false)
|
||||||
|
|
||||||
DListMenuItemPlayerDisplay::DListMenuItemPlayerDisplay(FListMenuDescriptor *menu, int x, int y, PalEntry c1, PalEntry c2, bool np, FName action)
|
DListMenuItemPlayerDisplay::DListMenuItemPlayerDisplay(FListMenuDescriptor *menu, int x, int y, PalEntry c1, PalEntry c2, bool np, FName action)
|
||||||
: DListMenuItem(x, y, action)
|
: DMenuItemBase(x, y, action)
|
||||||
{
|
{
|
||||||
mOwner = menu;
|
mOwner = menu;
|
||||||
|
|
||||||
|
|
|
@ -499,11 +499,11 @@ class DPlayerMenu : public DListMenu
|
||||||
void UpdateTranslation();
|
void UpdateTranslation();
|
||||||
void SendNewColor (int red, int green, int blue);
|
void SendNewColor (int red, int green, int blue);
|
||||||
|
|
||||||
void PlayerNameChanged(DListMenuItem *li);
|
void PlayerNameChanged(DMenuItemBase *li);
|
||||||
void ColorSetChanged (DListMenuItem *li);
|
void ColorSetChanged (DMenuItemBase *li);
|
||||||
void ClassChanged (DListMenuItem *li);
|
void ClassChanged (DMenuItemBase *li);
|
||||||
void AutoaimChanged (DListMenuItem *li);
|
void AutoaimChanged (DMenuItemBase *li);
|
||||||
void SkinChanged (DListMenuItem *li);
|
void SkinChanged (DMenuItemBase *li);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -527,7 +527,7 @@ IMPLEMENT_CLASS(DPlayerMenu, false, false)
|
||||||
|
|
||||||
void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
|
void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
|
||||||
{
|
{
|
||||||
DListMenuItem *li;
|
DMenuItemBase *li;
|
||||||
|
|
||||||
Super::Init(parent, desc);
|
Super::Init(parent, desc);
|
||||||
PickPlayerClass();
|
PickPlayerClass();
|
||||||
|
@ -655,7 +655,7 @@ bool DPlayerMenu::Responder (event_t *ev)
|
||||||
{
|
{
|
||||||
// turn the player sprite around
|
// turn the player sprite around
|
||||||
mRotation = 8 - mRotation;
|
mRotation = 8 - mRotation;
|
||||||
DListMenuItem *li = GetItem(NAME_Playerdisplay);
|
DMenuItemBase *li = GetItem(NAME_Playerdisplay);
|
||||||
if (li != NULL)
|
if (li != NULL)
|
||||||
{
|
{
|
||||||
li->SetValue(DListMenuItemPlayerDisplay::PDF_ROTATION, mRotation);
|
li->SetValue(DListMenuItemPlayerDisplay::PDF_ROTATION, mRotation);
|
||||||
|
@ -745,7 +745,7 @@ void DPlayerMenu::SendNewColor (int red, int green, int blue)
|
||||||
|
|
||||||
void DPlayerMenu::UpdateColorsets()
|
void DPlayerMenu::UpdateColorsets()
|
||||||
{
|
{
|
||||||
DListMenuItem *li = GetItem(NAME_Color);
|
DMenuItemBase *li = GetItem(NAME_Color);
|
||||||
if (li != NULL)
|
if (li != NULL)
|
||||||
{
|
{
|
||||||
int sel = 0;
|
int sel = 0;
|
||||||
|
@ -781,7 +781,7 @@ void DPlayerMenu::UpdateSkins()
|
||||||
{
|
{
|
||||||
int sel = 0;
|
int sel = 0;
|
||||||
int skin;
|
int skin;
|
||||||
DListMenuItem *li = GetItem(NAME_Skin);
|
DMenuItemBase *li = GetItem(NAME_Skin);
|
||||||
if (li != NULL)
|
if (li != NULL)
|
||||||
{
|
{
|
||||||
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
|
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
|
||||||
|
@ -824,7 +824,7 @@ void DPlayerMenu::UpdateSkins()
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void DPlayerMenu::PlayerNameChanged(DListMenuItem *li)
|
void DPlayerMenu::PlayerNameChanged(DMenuItemBase *li)
|
||||||
{
|
{
|
||||||
char pp[MAXPLAYERNAME+1];
|
char pp[MAXPLAYERNAME+1];
|
||||||
const char *p;
|
const char *p;
|
||||||
|
@ -852,7 +852,7 @@ void DPlayerMenu::PlayerNameChanged(DListMenuItem *li)
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void DPlayerMenu::ColorSetChanged (DListMenuItem *li)
|
void DPlayerMenu::ColorSetChanged (DMenuItemBase *li)
|
||||||
{
|
{
|
||||||
int sel;
|
int sel;
|
||||||
|
|
||||||
|
@ -862,9 +862,9 @@ void DPlayerMenu::ColorSetChanged (DListMenuItem *li)
|
||||||
|
|
||||||
if (sel > 0) mycolorset = PlayerColorSets[sel-1];
|
if (sel > 0) mycolorset = PlayerColorSets[sel-1];
|
||||||
|
|
||||||
DListMenuItem *red = GetItem(NAME_Red);
|
DMenuItemBase *red = GetItem(NAME_Red);
|
||||||
DListMenuItem *green = GetItem(NAME_Green);
|
DMenuItemBase *green = GetItem(NAME_Green);
|
||||||
DListMenuItem *blue = GetItem(NAME_Blue);
|
DMenuItemBase *blue = GetItem(NAME_Blue);
|
||||||
|
|
||||||
// disable the sliders if a valid colorset is selected
|
// disable the sliders if a valid colorset is selected
|
||||||
if (red != NULL) red->Enable(mycolorset == -1);
|
if (red != NULL) red->Enable(mycolorset == -1);
|
||||||
|
@ -885,7 +885,7 @@ void DPlayerMenu::ColorSetChanged (DListMenuItem *li)
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void DPlayerMenu::ClassChanged (DListMenuItem *li)
|
void DPlayerMenu::ClassChanged (DMenuItemBase *li)
|
||||||
{
|
{
|
||||||
if (PlayerClasses.Size () == 1)
|
if (PlayerClasses.Size () == 1)
|
||||||
{
|
{
|
||||||
|
@ -919,7 +919,7 @@ void DPlayerMenu::ClassChanged (DListMenuItem *li)
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void DPlayerMenu::SkinChanged (DListMenuItem *li)
|
void DPlayerMenu::SkinChanged (DMenuItemBase *li)
|
||||||
{
|
{
|
||||||
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
|
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
|
||||||
players[consoleplayer].userinfo.GetPlayerClassNum() == -1)
|
players[consoleplayer].userinfo.GetPlayerClassNum() == -1)
|
||||||
|
@ -950,7 +950,7 @@ void DPlayerMenu::SkinChanged (DListMenuItem *li)
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void DPlayerMenu::AutoaimChanged (DListMenuItem *li)
|
void DPlayerMenu::AutoaimChanged (DMenuItemBase *li)
|
||||||
{
|
{
|
||||||
int sel;
|
int sel;
|
||||||
|
|
||||||
|
@ -971,7 +971,7 @@ bool DPlayerMenu::MenuEvent (int mkey, bool fromcontroller)
|
||||||
int v;
|
int v;
|
||||||
if (mDesc->mSelectedItem >= 0)
|
if (mDesc->mSelectedItem >= 0)
|
||||||
{
|
{
|
||||||
DListMenuItem *li = mDesc->mItems[mDesc->mSelectedItem];
|
DMenuItemBase *li = mDesc->mItems[mDesc->mSelectedItem];
|
||||||
if (li->MenuEvent(mkey, fromcontroller))
|
if (li->MenuEvent(mkey, fromcontroller))
|
||||||
{
|
{
|
||||||
FName current = li->GetAction(NULL);
|
FName current = li->GetAction(NULL);
|
||||||
|
@ -1067,7 +1067,7 @@ bool DPlayerMenu::MenuEvent (int mkey, bool fromcontroller)
|
||||||
bool DPlayerMenu::MouseEvent(int type, int x, int y)
|
bool DPlayerMenu::MouseEvent(int type, int x, int y)
|
||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
DListMenuItem *li = mFocusControl;
|
DMenuItemBase *li = mFocusControl;
|
||||||
bool res = Super::MouseEvent(type, x, y);
|
bool res = Super::MouseEvent(type, x, y);
|
||||||
if (li == NULL) li = mFocusControl;
|
if (li == NULL) li = mFocusControl;
|
||||||
if (li != NULL)
|
if (li != NULL)
|
||||||
|
|
|
@ -66,7 +66,8 @@ enum EColorRange
|
||||||
CR_PURPLE,
|
CR_PURPLE,
|
||||||
CR_DARKGRAY,
|
CR_DARKGRAY,
|
||||||
CR_CYAN,
|
CR_CYAN,
|
||||||
NUM_TEXT_COLORS
|
NUM_TEXT_COLORS,
|
||||||
|
FORCE_DWORD = 0x7fffffff // required for script access.
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int NumTextColors;
|
extern int NumTextColors;
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
#include "zscript/actor.txt"
|
#include "zscript/actor.txt"
|
||||||
#include "zscript/actor_checks.txt"
|
#include "zscript/actor_checks.txt"
|
||||||
|
|
||||||
|
#include "zscript/menu/menu.txt"
|
||||||
|
#include "zscript/menu/menuitembase.txt"
|
||||||
|
|
||||||
#include "zscript/inventory/inventory.txt"
|
#include "zscript/inventory/inventory.txt"
|
||||||
#include "zscript/inventory/inv_misc.txt"
|
#include "zscript/inventory/inv_misc.txt"
|
||||||
#include "zscript/inventory/stateprovider.txt"
|
#include "zscript/inventory/stateprovider.txt"
|
||||||
|
|
|
@ -34,6 +34,35 @@ struct TexMan
|
||||||
|
|
||||||
struct Screen native
|
struct Screen native
|
||||||
{
|
{
|
||||||
|
enum EColorRange
|
||||||
|
{
|
||||||
|
CR_UNDEFINED = -1,
|
||||||
|
CR_BRICK,
|
||||||
|
CR_TAN,
|
||||||
|
CR_GRAY,
|
||||||
|
CR_GREY = CR_GRAY,
|
||||||
|
CR_GREEN,
|
||||||
|
CR_BROWN,
|
||||||
|
CR_GOLD,
|
||||||
|
CR_RED,
|
||||||
|
CR_BLUE,
|
||||||
|
CR_ORANGE,
|
||||||
|
CR_WHITE,
|
||||||
|
CR_YELLOW,
|
||||||
|
CR_UNTRANSLATED,
|
||||||
|
CR_BLACK,
|
||||||
|
CR_LIGHTBLUE,
|
||||||
|
CR_CREAM,
|
||||||
|
CR_OLIVE,
|
||||||
|
CR_DARKGREEN,
|
||||||
|
CR_DARKRED,
|
||||||
|
CR_DARKBROWN,
|
||||||
|
CR_PURPLE,
|
||||||
|
CR_DARKGRAY,
|
||||||
|
CR_CYAN,
|
||||||
|
NUM_TEXT_COLORS
|
||||||
|
};
|
||||||
|
|
||||||
native static void DrawHUDTexture(TextureID tex, double x, double y);
|
native static void DrawHUDTexture(TextureID tex, double x, double y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
17
wadsrc/static/zscript/menu/menu.txt
Normal file
17
wadsrc/static/zscript/menu/menu.txt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
class Menu : Object native
|
||||||
|
{
|
||||||
|
//native static int MenuTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FOptionMenuSettings
|
||||||
|
{
|
||||||
|
int mTitleColor;
|
||||||
|
int mFontColor;
|
||||||
|
int mFontColorValue;
|
||||||
|
int mFontColorMore;
|
||||||
|
int mFontColorHeader;
|
||||||
|
int mFontColorHighlight;
|
||||||
|
int mFontColorSelection;
|
||||||
|
int mLinespacing;
|
||||||
|
}
|
66
wadsrc/static/zscript/menu/menuitembase.txt
Normal file
66
wadsrc/static/zscript/menu/menuitembase.txt
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
// base class for menu items
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
class MenuItemBase : Object native
|
||||||
|
{
|
||||||
|
protected int mXpos, mYpos;
|
||||||
|
protected Name mAction;
|
||||||
|
|
||||||
|
bool mEnabled;
|
||||||
|
|
||||||
|
protected void Init(int xpos = 0, int ypos = 0, Name actionname = 'None')
|
||||||
|
{
|
||||||
|
mXpos = xpos;
|
||||||
|
mYpos = ypos;
|
||||||
|
mAction = actionname;
|
||||||
|
mEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool CheckCoordinate(int x, int y) { return false; }
|
||||||
|
virtual void Ticker() {}
|
||||||
|
virtual void Drawer(bool selected) {}
|
||||||
|
virtual bool Selectable() {return false; }
|
||||||
|
virtual bool Activate() { return false; }
|
||||||
|
virtual Name, int GetAction() { return mAction, 0; }
|
||||||
|
virtual bool SetString(int i, String s) { return false; }
|
||||||
|
virtual bool, String GetString(int i) { return false, ""; }
|
||||||
|
virtual bool SetValue(int i, int value) { return false; }
|
||||||
|
virtual bool, int GetValue(int i) { return false, 0; }
|
||||||
|
virtual void Enable(bool on) { mEnabled = on; }
|
||||||
|
virtual bool MenuEvent (int mkey, bool fromcontroller) { return false; }
|
||||||
|
virtual bool MouseEvent(int type, int x, int y) { return false; }
|
||||||
|
virtual bool CheckHotkey(int c) { return false; }
|
||||||
|
virtual int GetWidth() { return 0; }
|
||||||
|
virtual void OffsetPositionY(int ydelta) { mYpos += ydelta; }
|
||||||
|
virtual int GetY() { return mYpos; }
|
||||||
|
virtual int GetX() { return mXpos; }
|
||||||
|
virtual void SetX(int x) { mXpos = x; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
virtual void DrawSelector(int xofs, int yofs, TextureID tex)
|
||||||
|
{
|
||||||
|
if (tex.isNull())
|
||||||
|
{
|
||||||
|
if ((Menu.MenuTime() % 8) < 6)
|
||||||
|
{
|
||||||
|
screen.DrawText(ConFont, OptionSettings.mFontColorSelection,
|
||||||
|
(mXpos + xofs - 160) * CleanXfac + screen.GetWidth() / 2,
|
||||||
|
(mYpos + yofs - 100) * CleanYfac + screen.GetHeight() / 2,
|
||||||
|
"\xd",
|
||||||
|
DTA_CellX, 8 * CleanXfac,
|
||||||
|
DTA_CellY, 8 * CleanYfac,
|
||||||
|
TAG_DONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screen.DrawTexture (tex, mXpos + xofs, mYpos + yofs, DTA_Clean, true, TAG_DONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue