mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- use floats for menu item coordinates. This only has an effect in the ListMenu because the OptionMenu uses fixed offsets which work differently.
This commit is contained in:
parent
c0f588e234
commit
f3b6343e53
8 changed files with 68 additions and 66 deletions
|
@ -1117,7 +1117,7 @@ DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBi
|
||||||
return (DMenuItemBase*)p;
|
return (DMenuItemBase*)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
DMenuItemBase * CreateListMenuItemPatch(int x, int y, int height, int hotkey, FTextureID tex, FName command, int param)
|
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param)
|
||||||
{
|
{
|
||||||
auto c = PClass::FindClass("ListMenuItemPatchItem");
|
auto c = PClass::FindClass("ListMenuItemPatchItem");
|
||||||
auto p = c->CreateNew();
|
auto p = c->CreateNew();
|
||||||
|
@ -1127,7 +1127,7 @@ DMenuItemBase * CreateListMenuItemPatch(int x, int y, int height, int hotkey, FT
|
||||||
return (DMenuItemBase*)p;
|
return (DMenuItemBase*)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
DMenuItemBase * CreateListMenuItemText(int x, int y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param)
|
DMenuItemBase * CreateListMenuItemText(double x, double y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param)
|
||||||
{
|
{
|
||||||
auto c = PClass::FindClass("ListMenuItemTextItem");
|
auto c = PClass::FindClass("ListMenuItemTextItem");
|
||||||
auto p = c->CreateNew();
|
auto p = c->CreateNew();
|
||||||
|
|
|
@ -138,11 +138,11 @@ class DListMenuDescriptor : public DMenuDescriptor
|
||||||
public:
|
public:
|
||||||
TArray<DMenuItemBase *> mItems;
|
TArray<DMenuItemBase *> mItems;
|
||||||
int mSelectedItem;
|
int mSelectedItem;
|
||||||
int mSelectOfsX;
|
double mSelectOfsX;
|
||||||
int mSelectOfsY;
|
double mSelectOfsY;
|
||||||
FTextureID mSelector;
|
FTextureID mSelector;
|
||||||
int mDisplayTop;
|
int mDisplayTop;
|
||||||
int mXpos, mYpos;
|
double mXpos, mYpos;
|
||||||
int mWLeft, mWRight;
|
int mWLeft, mWRight;
|
||||||
int mLinespacing; // needs to be stored for dynamically created menus
|
int mLinespacing; // needs to be stored for dynamically created menus
|
||||||
int mAutoselect; // this can only be set by internal menu creation functions
|
int mAutoselect; // this can only be set by internal menu creation functions
|
||||||
|
@ -288,7 +288,7 @@ class DMenuItemBase : public DObject
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(DMenuItemBase, DObject)
|
DECLARE_CLASS(DMenuItemBase, DObject)
|
||||||
public:
|
public:
|
||||||
int mXpos, mYpos;
|
double mXpos, mYpos;
|
||||||
FNameNoInit mAction;
|
FNameNoInit mAction;
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ public:
|
||||||
bool SetValue(int i, int value);
|
bool SetValue(int i, int value);
|
||||||
bool GetValue(int i, int *pvalue);
|
bool GetValue(int i, int *pvalue);
|
||||||
void OffsetPositionY(int ydelta) { mYpos += ydelta; }
|
void OffsetPositionY(int ydelta) { mYpos += ydelta; }
|
||||||
int GetY() { return mYpos; }
|
double GetY() { return mYpos; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -355,7 +355,7 @@ DMenuItemBase * CreateOptionMenuItemStaticText(const char *name, bool v);
|
||||||
DMenuItemBase * CreateOptionMenuItemSubmenu(const char *label, FName cmd, int center);
|
DMenuItemBase * CreateOptionMenuItemSubmenu(const char *label, FName cmd, int center);
|
||||||
DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBindings *bindings);
|
DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBindings *bindings);
|
||||||
DMenuItemBase * CreateOptionMenuItemJoyConfigMenu(const char *label, IJoystickConfig *joy);
|
DMenuItemBase * CreateOptionMenuItemJoyConfigMenu(const char *label, IJoystickConfig *joy);
|
||||||
DMenuItemBase * CreateListMenuItemPatch(int x, int y, int height, int hotkey, FTextureID tex, FName command, int param);
|
DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param);
|
||||||
DMenuItemBase * CreateListMenuItemText(int x, int y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param);
|
DMenuItemBase * CreateListMenuItemText(double x, double y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -305,11 +305,11 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
desc->mSelector = GetMenuTexture(sc.String);
|
desc->mSelector = GetMenuTexture(sc.String);
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
sc.MustGetNumber();
|
sc.MustGetFloat();
|
||||||
desc->mSelectOfsX = sc.Number;
|
desc->mSelectOfsX = sc.Float;
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
sc.MustGetNumber();
|
sc.MustGetFloat();
|
||||||
desc->mSelectOfsY = sc.Number;
|
desc->mSelectOfsY = sc.Float;
|
||||||
}
|
}
|
||||||
else if (sc.Compare("Linespacing"))
|
else if (sc.Compare("Linespacing"))
|
||||||
{
|
{
|
||||||
|
@ -318,11 +318,11 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
|
||||||
}
|
}
|
||||||
else if (sc.Compare("Position"))
|
else if (sc.Compare("Position"))
|
||||||
{
|
{
|
||||||
sc.MustGetNumber();
|
sc.MustGetFloat();
|
||||||
desc->mXpos = sc.Number;
|
desc->mXpos = sc.Float;
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
sc.MustGetNumber();
|
sc.MustGetFloat();
|
||||||
desc->mYpos = sc.Number;
|
desc->mYpos = sc.Float;
|
||||||
}
|
}
|
||||||
else if (sc.Compare("Centermenu"))
|
else if (sc.Compare("Centermenu"))
|
||||||
{
|
{
|
||||||
|
@ -973,13 +973,13 @@ static void BuildEpisodeMenu()
|
||||||
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
||||||
{
|
{
|
||||||
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
|
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
|
||||||
int posy = ld->mYpos;
|
int posy = (int)ld->mYpos;
|
||||||
int topy = posy;
|
int topy = posy;
|
||||||
|
|
||||||
// Get lowest y coordinate of any static item in the menu
|
// Get lowest y coordinate of any static item in the menu
|
||||||
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
||||||
{
|
{
|
||||||
int y = ld->mItems[i]->GetY();
|
int y = (int)ld->mItems[i]->GetY();
|
||||||
if (y < topy) topy = y;
|
if (y < topy) topy = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1073,13 +1073,13 @@ static void BuildPlayerclassMenu()
|
||||||
// add player display
|
// add player display
|
||||||
ld->mSelectedItem = ld->mItems.Size();
|
ld->mSelectedItem = ld->mItems.Size();
|
||||||
|
|
||||||
int posy = ld->mYpos;
|
int posy = (int)ld->mYpos;
|
||||||
int topy = posy;
|
int topy = posy;
|
||||||
|
|
||||||
// Get lowest y coordinate of any static item in the menu
|
// Get lowest y coordinate of any static item in the menu
|
||||||
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
||||||
{
|
{
|
||||||
int y = ld->mItems[i]->GetY();
|
int y = (int)ld->mItems[i]->GetY();
|
||||||
if (y < topy) topy = y;
|
if (y < topy) topy = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1333,8 +1333,8 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
||||||
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
|
||||||
{
|
{
|
||||||
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
|
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
|
||||||
int x = ld->mXpos;
|
int x = (int)ld->mXpos;
|
||||||
int y = ld->mYpos;
|
int y = (int)ld->mYpos;
|
||||||
|
|
||||||
// Delete previous contents
|
// Delete previous contents
|
||||||
for(unsigned i=0; i<ld->mItems.Size(); i++)
|
for(unsigned i=0; i<ld->mItems.Size(); i++)
|
||||||
|
@ -1363,7 +1363,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
||||||
// Get lowest y coordinate of any static item in the menu
|
// Get lowest y coordinate of any static item in the menu
|
||||||
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
for(unsigned i = 0; i < ld->mItems.Size(); i++)
|
||||||
{
|
{
|
||||||
int y = ld->mItems[i]->GetY();
|
int y = (int)ld->mItems[i]->GetY();
|
||||||
if (y < topy) topy = y;
|
if (y < topy) topy = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1380,7 +1380,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
|
||||||
{
|
{
|
||||||
ld->mItems[i]->OffsetPositionY(topdelta);
|
ld->mItems[i]->OffsetPositionY(topdelta);
|
||||||
}
|
}
|
||||||
y = ld->mYpos = posy - topdelta;
|
ld->mYpos = y = posy - topdelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -4,11 +4,11 @@ class ListMenuDescriptor : MenuDescriptor native
|
||||||
{
|
{
|
||||||
native Array<ListMenuItem> mItems;
|
native Array<ListMenuItem> mItems;
|
||||||
native int mSelectedItem;
|
native int mSelectedItem;
|
||||||
native int mSelectOfsX;
|
native double mSelectOfsX;
|
||||||
native int mSelectOfsY;
|
native double mSelectOfsY;
|
||||||
native TextureID mSelector;
|
native TextureID mSelector;
|
||||||
native int mDisplayTop;
|
native int mDisplayTop;
|
||||||
native int mXpos, mYpos;
|
native double mXpos, mYpos;
|
||||||
native int mWLeft, mWRight;
|
native int mWLeft, mWRight;
|
||||||
native int mLinespacing; // needs to be stored for dynamically created menus
|
native int mLinespacing; // needs to be stored for dynamically created menus
|
||||||
native int mAutoselect; // this can only be set by internal menu creation functions
|
native int mAutoselect; // this can only be set by internal menu creation functions
|
||||||
|
@ -51,16 +51,16 @@ class ListMenu : Menu
|
||||||
mDesc = desc;
|
mDesc = desc;
|
||||||
if (desc.mCenter)
|
if (desc.mCenter)
|
||||||
{
|
{
|
||||||
int center = 160;
|
double center = 160;
|
||||||
for(int i=0; i < mDesc.mItems.Size(); i++)
|
for(int i=0; i < mDesc.mItems.Size(); i++)
|
||||||
{
|
{
|
||||||
int xpos = mDesc.mItems[i].GetX();
|
double xpos = mDesc.mItems[i].GetX();
|
||||||
int width = mDesc.mItems[i].GetWidth();
|
int width = mDesc.mItems[i].GetWidth();
|
||||||
int curx = mDesc.mSelectOfsX;
|
double curx = mDesc.mSelectOfsX;
|
||||||
|
|
||||||
if (width > 0 && mDesc.mItems[i].Selectable())
|
if (width > 0 && mDesc.mItems[i].Selectable())
|
||||||
{
|
{
|
||||||
int left = 160 - (width - curx) / 2 - curx;
|
double left = 160 - (width - curx) / 2 - curx;
|
||||||
if (left < center) center = left;
|
if (left < center) center = left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
class ListMenuItem : MenuItemBase
|
class ListMenuItem : MenuItemBase
|
||||||
{
|
{
|
||||||
void DrawSelector(int xofs, int yofs, TextureID tex)
|
void DrawSelector(double xofs, double yofs, TextureID tex)
|
||||||
{
|
{
|
||||||
if (tex.isNull())
|
if (tex.isNull())
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ class ListMenuItemStaticPatch : ListMenuItem
|
||||||
TextureID mTexture;
|
TextureID mTexture;
|
||||||
bool mCentered;
|
bool mCentered;
|
||||||
|
|
||||||
void Init(int x, int y, TextureID patch, bool centered = false)
|
void Init(double x, double y, TextureID patch, bool centered = false)
|
||||||
{
|
{
|
||||||
Super.Init(x, y);
|
Super.Init(x, y);
|
||||||
mTexture = patch;
|
mTexture = patch;
|
||||||
|
@ -82,17 +82,17 @@ class ListMenuItemStaticPatch : ListMenuItem
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = mXpos;
|
double x = mXpos;
|
||||||
Vector2 vec = TexMan.GetScaledSize(mTexture);
|
Vector2 vec = TexMan.GetScaledSize(mTexture);
|
||||||
if (mYpos >= 0)
|
if (mYpos >= 0)
|
||||||
{
|
{
|
||||||
if (mCentered) x -= int(vec.X) / 2;
|
if (mCentered) x -= vec.X / 2;
|
||||||
screen.DrawTexture (mTexture, true, x, mYpos, DTA_Clean, true);
|
screen.DrawTexture (mTexture, true, x, mYpos, DTA_Clean, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int x = (mXpos - 160) * CleanXfac + (Screen.GetWidth()>>1);
|
x = (mXpos - 160) * CleanXfac + (Screen.GetWidth()>>1);
|
||||||
if (mCentered) x -= (int(vec.X) * CleanXfac)/2;
|
if (mCentered) x -= (vec.X * CleanXfac)/2;
|
||||||
screen.DrawTexture (mTexture, true, x, -mYpos*CleanYfac, DTA_CleanNoMove, true);
|
screen.DrawTexture (mTexture, true, x, -mYpos*CleanYfac, DTA_CleanNoMove, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class ListMenuItemStaticPatch : ListMenuItem
|
||||||
|
|
||||||
class ListMenuItemStaticPatchCentered : ListMenuItemStaticPatch
|
class ListMenuItemStaticPatchCentered : ListMenuItemStaticPatch
|
||||||
{
|
{
|
||||||
void Init(int x, int y, TextureID patch)
|
void Init(double x, double y, TextureID patch)
|
||||||
{
|
{
|
||||||
Super.Init(x, y, patch, true);
|
Super.Init(x, y, patch, true);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ class ListMenuItemStaticText : ListMenuItem
|
||||||
int mColor;
|
int mColor;
|
||||||
bool mCentered;
|
bool mCentered;
|
||||||
|
|
||||||
void Init(ListMenuDescriptor desc, int x, int y, String text, int color = Font.CR_UNTRANSLATED)
|
void Init(ListMenuDescriptor desc, double x, double y, String text, int color = Font.CR_UNTRANSLATED)
|
||||||
{
|
{
|
||||||
Super.Init(x, y);
|
Super.Init(x, y);
|
||||||
mText = text;
|
mText = text;
|
||||||
|
@ -128,7 +128,7 @@ class ListMenuItemStaticText : ListMenuItem
|
||||||
mCentered = false;
|
mCentered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitDirect(int x, int y, String text, Font font, int color = Font.CR_UNTRANSLATED, bool centered = false)
|
void InitDirect(double x, double y, String text, Font font, int color = Font.CR_UNTRANSLATED, bool centered = false)
|
||||||
{
|
{
|
||||||
Super.Init(x, y);
|
Super.Init(x, y);
|
||||||
mText = text;
|
mText = text;
|
||||||
|
@ -144,13 +144,13 @@ class ListMenuItemStaticText : ListMenuItem
|
||||||
String text = Stringtable.Localize(mText);
|
String text = Stringtable.Localize(mText);
|
||||||
if (mYpos >= 0)
|
if (mYpos >= 0)
|
||||||
{
|
{
|
||||||
int x = mXpos;
|
double x = mXpos;
|
||||||
if (mCentered) x -= mFont.StringWidth(text)/2;
|
if (mCentered) x -= mFont.StringWidth(text)/2;
|
||||||
screen.DrawText(mFont, mColor, x, mYpos, text, DTA_Clean, true);
|
screen.DrawText(mFont, mColor, x, mYpos, text, DTA_Clean, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int x = (mXpos - 160) * CleanXfac + (Screen.GetWidth() >> 1);
|
double x = (mXpos - 160) * CleanXfac + (Screen.GetWidth() >> 1);
|
||||||
if (mCentered) x -= (mFont.StringWidth(text) * CleanXfac)/2;
|
if (mCentered) x -= (mFont.StringWidth(text) * CleanXfac)/2;
|
||||||
screen.DrawText (mFont, mColor, x, -mYpos*CleanYfac, text, DTA_CleanNoMove, true);
|
screen.DrawText (mFont, mColor, x, -mYpos*CleanYfac, text, DTA_CleanNoMove, true);
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ class ListMenuItemStaticText : ListMenuItem
|
||||||
|
|
||||||
class ListMenuItemStaticTextCentered : ListMenuItemStaticText
|
class ListMenuItemStaticTextCentered : ListMenuItemStaticText
|
||||||
{
|
{
|
||||||
void Init(ListMenuDescriptor desc, int x, int y, String text, int color = -1)
|
void Init(ListMenuDescriptor desc, double x, double y, String text, int color = -1)
|
||||||
{
|
{
|
||||||
Super.Init(desc, x, y, text, color);
|
Super.Init(desc, x, y, text, color);
|
||||||
mCentered = true;
|
mCentered = true;
|
||||||
|
@ -179,7 +179,7 @@ class ListMenuItemSelectable : ListMenuItem
|
||||||
int mHeight;
|
int mHeight;
|
||||||
int mParam;
|
int mParam;
|
||||||
|
|
||||||
protected void Init(int x, int y, int height, Name childmenu, int param = -1)
|
protected void Init(double x, double y, int height, Name childmenu, int param = -1)
|
||||||
{
|
{
|
||||||
Super.Init(x, y, childmenu);
|
Super.Init(x, y, childmenu);
|
||||||
mHeight = height;
|
mHeight = height;
|
||||||
|
@ -250,7 +250,7 @@ class ListMenuItemTextItem : ListMenuItemSelectable
|
||||||
mHotkey = hotkey.CharCodeAt(0);
|
mHotkey = hotkey.CharCodeAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitDirect(int x, int y, int height, String hotkey, String text, Font font, int color, int color2, Name child, int param = 0)
|
void InitDirect(double x, double y, int height, String hotkey, String text, Font font, int color, int color2, Name child, int param = 0)
|
||||||
{
|
{
|
||||||
Super.Init(x, y, height, child, param);
|
Super.Init(x, y, height, child, param);
|
||||||
mText = text;
|
mText = text;
|
||||||
|
@ -288,7 +288,7 @@ class ListMenuItemPatchItem : ListMenuItemSelectable
|
||||||
mTexture = patch;
|
mTexture = patch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitDirect(int x, int y, int height, TextureID patch, String hotkey, Name child, int param = 0)
|
void InitDirect(double x, double y, int height, TextureID patch, String hotkey, Name child, int param = 0)
|
||||||
{
|
{
|
||||||
Super.Init(x, y, height, child, param);
|
Super.Init(x, y, height, child, param);
|
||||||
mHotkey = hotkey.CharCodeAt(0);
|
mHotkey = hotkey.CharCodeAt(0);
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
class MenuItemBase : Object native
|
class MenuItemBase : Object native
|
||||||
{
|
{
|
||||||
protected native int mXpos, mYpos;
|
protected native double mXpos, mYpos;
|
||||||
protected native Name mAction;
|
protected native Name mAction;
|
||||||
native bool mEnabled;
|
native bool mEnabled;
|
||||||
|
|
||||||
void Init(int xpos = 0, int ypos = 0, Name actionname = 'None')
|
void Init(double xpos = 0, double ypos = 0, Name actionname = 'None')
|
||||||
{
|
{
|
||||||
mXpos = xpos;
|
mXpos = xpos;
|
||||||
mYpos = ypos;
|
mYpos = ypos;
|
||||||
|
@ -36,10 +36,10 @@ class MenuItemBase : Object native
|
||||||
virtual int GetIndent() { return 0; }
|
virtual int GetIndent() { return 0; }
|
||||||
virtual int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { return indent; }
|
virtual int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { return indent; }
|
||||||
|
|
||||||
void OffsetPositionY(int ydelta) { mYpos += ydelta; }
|
void OffsetPositionY(double ydelta) { mYpos += ydelta; }
|
||||||
int GetY() { return mYpos; }
|
double GetY() { return mYpos; }
|
||||||
int GetX() { return mXpos; }
|
double GetX() { return mXpos; }
|
||||||
void SetX(int x) { mXpos = x; }
|
void SetX(double x) { mXpos = x; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is only used to parse font color ranges in MENUDEF
|
// this is only used to parse font color ranges in MENUDEF
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void InitDirect(int x, int y, int height, int frameofs, String text, Font font, int color, Name command)
|
void InitDirect(double x, double y, int height, int frameofs, String text, Font font, int color, Name command)
|
||||||
{
|
{
|
||||||
Super.Init(x, y, height, command);
|
Super.Init(x, y, height, command);
|
||||||
mText = text;
|
mText = text;
|
||||||
|
@ -113,7 +113,7 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
protected void DrawBorder (int x, int y, int len)
|
protected void DrawBorder (double x, double y, int len)
|
||||||
{
|
{
|
||||||
let left = TexMan.CheckForTexture("M_LSLEFT", TexMan.Type_MiscPatch);
|
let left = TexMan.CheckForTexture("M_LSLEFT", TexMan.Type_MiscPatch);
|
||||||
let mid = TexMan.CheckForTexture("M_LSCNTR", TexMan.Type_MiscPatch);
|
let mid = TexMan.CheckForTexture("M_LSCNTR", TexMan.Type_MiscPatch);
|
||||||
|
@ -141,7 +141,9 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen.Clear(x, y, x + len, y + SmallFont.GetHeight() * 3/2, 0);
|
int xx = int(x - 160) * CleanXfac + screen.GetWidth()/2;
|
||||||
|
int yy = int(y - 100) * CleanXfac + screen.GetHeight()/2;
|
||||||
|
screen.Clear(xx, yy, xx + len*CleanXfac, yy + SmallFont.GetHeight() * CleanYfac * 3/2, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +163,7 @@ class ListMenuItemPlayerNameBox : ListMenuItemSelectable
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw player name box
|
// Draw player name box
|
||||||
int x = mXpos + mFont.StringWidth(text) + 16 + mFrameSize;
|
double x = mXpos + mFont.StringWidth(text) + 16 + mFrameSize;
|
||||||
DrawBorder (x, mYpos - mFrameSize, MAXPLAYERNAME+1);
|
DrawBorder (x, mYpos - mFrameSize, MAXPLAYERNAME+1);
|
||||||
if (!mEnter)
|
if (!mEnter)
|
||||||
{
|
{
|
||||||
|
@ -246,7 +248,7 @@ class ListMenuItemValueText : ListMenuItemSelectable
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void InitDirect(int x, int y, int height, String text, Font font, int color, int valuecolor, Name command, Name values)
|
void InitDirect(double x, double y, int height, String text, Font font, int color, int valuecolor, Name command, Name values)
|
||||||
{
|
{
|
||||||
Super.Init(x, y, height, command);
|
Super.Init(x, y, height, command);
|
||||||
mText = text;
|
mText = text;
|
||||||
|
@ -337,7 +339,7 @@ class ListMenuItemValueText : ListMenuItemSelectable
|
||||||
String text = Stringtable.Localize(mText);
|
String text = Stringtable.Localize(mText);
|
||||||
screen.DrawText(mFont, selected? OptionMenuSettings.mFontColorSelection : mFontColor, mXpos, mYpos, text, DTA_Clean, true);
|
screen.DrawText(mFont, selected? OptionMenuSettings.mFontColorSelection : mFontColor, mXpos, mYpos, text, DTA_Clean, true);
|
||||||
|
|
||||||
int x = mXpos + mFont.StringWidth(text) + 8;
|
double x = mXpos + mFont.StringWidth(text) + 8;
|
||||||
if (mSelections.Size() > 0)
|
if (mSelections.Size() > 0)
|
||||||
{
|
{
|
||||||
screen.DrawText(mFont, mFontColor2, x, mYpos, mSelections[mSelection], DTA_Clean, true);
|
screen.DrawText(mFont, mFontColor2, x, mYpos, mSelections[mSelection], DTA_Clean, true);
|
||||||
|
@ -385,7 +387,7 @@ class ListMenuItemSlider : ListMenuItemSelectable
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void InitDirect(int x, int y, int height, String text, Font font, int color, Name command, int min, int max, int step)
|
void InitDirect(double x, double y, int height, String text, Font font, int color, Name command, int min, int max, int step)
|
||||||
{
|
{
|
||||||
Super.Init(x, y, height, command);
|
Super.Init(x, y, height, command);
|
||||||
mText = text;
|
mText = text;
|
||||||
|
@ -463,7 +465,7 @@ class ListMenuItemSlider : ListMenuItemSelectable
|
||||||
lm.ReleaseFocus();
|
lm.ReleaseFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
int slide_left = SmallFont.StringWidth ("Green") + 8 + mXpos;
|
int slide_left = SmallFont.StringWidth ("Green") + 8 + int(mXpos);
|
||||||
int slide_right = slide_left + 12*8; // 12 char cells with 8 pixels each.
|
int slide_right = slide_left + 12*8; // 12 char cells with 8 pixels each.
|
||||||
|
|
||||||
if (type == Menu.MOUSE_Click)
|
if (type == Menu.MOUSE_Click)
|
||||||
|
@ -491,7 +493,7 @@ class ListMenuItemSlider : ListMenuItemSelectable
|
||||||
//
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
protected void DrawSlider (int x, int y)
|
protected void DrawSlider (double x, double y)
|
||||||
{
|
{
|
||||||
int range = mMaxrange - mMinrange;
|
int range = mMaxrange - mMinrange;
|
||||||
int cur = mSelection - mMinrange;
|
int cur = mSelection - mMinrange;
|
||||||
|
@ -515,8 +517,8 @@ class ListMenuItemSlider : ListMenuItemSelectable
|
||||||
|
|
||||||
screen.DrawText(mFont, selected? OptionMenuSettings.mFontColorSelection : mFontColor, mXpos, mYpos, text, DTA_Clean, true);
|
screen.DrawText(mFont, selected? OptionMenuSettings.mFontColorSelection : mFontColor, mXpos, mYpos, text, DTA_Clean, true);
|
||||||
|
|
||||||
int x = SmallFont.StringWidth ("Green") + 8 + mXpos;
|
double x = SmallFont.StringWidth ("Green") + 8 + mXpos;
|
||||||
int x2 = SmallFont.StringWidth (text) + 8 + mXpos;
|
double x2 = SmallFont.StringWidth (text) + 8 + mXpos;
|
||||||
DrawSlider (MAX(x2, x), mYpos);
|
DrawSlider (MAX(x2, x), mYpos);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -252,8 +252,8 @@ class ListMenuItemPlayerDisplay : ListMenuItem
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int x = (mXpos - 160) * CleanXfac + (screen.GetWidth() >> 1);
|
int x = int(mXpos - 160) * CleanXfac + (screen.GetWidth() >> 1);
|
||||||
int y = (mYpos - 100) * CleanYfac + (screen.GetHeight() >> 1);
|
int y = int(mYpos - 100) * CleanYfac + (screen.GetHeight() >> 1);
|
||||||
|
|
||||||
screen.DrawTexture(mBackdrop, false, x, y - 1,
|
screen.DrawTexture(mBackdrop, false, x, y - 1,
|
||||||
DTA_DestWidth, 72 * CleanXfac,
|
DTA_DestWidth, 72 * CleanXfac,
|
||||||
|
|
Loading…
Reference in a new issue