mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 11:50:49 +00:00
- menu code update.
This commit is contained in:
parent
53980787b6
commit
be55e26689
4 changed files with 48 additions and 64 deletions
|
@ -369,6 +369,7 @@ struct CVar native
|
||||||
native void SetString(String s);
|
native void SetString(String s);
|
||||||
native int GetRealType();
|
native int GetRealType();
|
||||||
native int ResetToDefault();
|
native int ResetToDefault();
|
||||||
|
native int GetGlyphHeight(String charcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct GIFont version("2.4")
|
struct GIFont version("2.4")
|
||||||
|
|
|
@ -191,9 +191,25 @@ class ListMenu : Menu
|
||||||
{
|
{
|
||||||
int sel = -1;
|
int sel = -1;
|
||||||
|
|
||||||
// convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture
|
int w = mDesc.DisplayWidth();
|
||||||
x = ((x - (screen.GetWidth() / 2)) / CleanXfac) + 160;
|
double sx, sy;
|
||||||
y = ((y - (screen.GetHeight() / 2)) / CleanYfac) + 100;
|
if (w == ListMenuDescriptor.CleanScale)
|
||||||
|
{
|
||||||
|
// convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture
|
||||||
|
x = ((x - (screen.GetWidth() / 2)) / CleanXfac) + 160;
|
||||||
|
y = ((y - (screen.GetHeight() / 2)) / CleanYfac) + 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// for fullscreen scale, transform coordinates so that for the given rect the coordinates are within (0, 0, w, h)
|
||||||
|
int h = mDesc.DisplayHeight();
|
||||||
|
double fx, fy, fw, fh;
|
||||||
|
[fx, fy, fw, fh] = Screen.GetFullscreenRect(w, h, FSMode_ScaleToFit43);
|
||||||
|
|
||||||
|
x = int((x - fx) * w / fw);
|
||||||
|
y = int((y - fy) * h / fh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mFocusControl != NULL)
|
if (mFocusControl != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -239,15 +239,7 @@ class OptionMenu : Menu
|
||||||
|
|
||||||
if (y <= 0)
|
if (y <= 0)
|
||||||
{
|
{
|
||||||
let font = generic_ui || !mDesc.mFont? NewSmallFont : mDesc.mFont;
|
y = DrawCaption(mDesc.mTitle, y, false);
|
||||||
if (font && mDesc.mTitle.Length() > 0)
|
|
||||||
{
|
|
||||||
y = -y + font.GetHeight();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
y = -y;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
y *= CleanYfac_1;
|
y *= CleanYfac_1;
|
||||||
int rowheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
|
int rowheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
|
||||||
|
@ -430,25 +422,39 @@ class OptionMenu : Menu
|
||||||
return screen.GetWidth() / 2 + indent * CleanXfac_1;
|
return screen.GetWidth() / 2 + indent * CleanXfac_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
// draws and/or measures the caption.
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
virtual int DrawCaption(String title, int y, bool drawit)
|
||||||
|
{
|
||||||
|
let font = generic_ui || !mDesc.mFont ? NewSmallFont : mDesc.mFont;
|
||||||
|
if (font && mDesc.mTitle.Length() > 0)
|
||||||
|
{
|
||||||
|
return menuCustomizer.DrawCaption(title, font, y, drawit);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
override void Drawer ()
|
override void Drawer ()
|
||||||
{
|
{
|
||||||
int y = mDesc.mPosition;
|
int y = mDesc.mPosition;
|
||||||
|
|
||||||
if (y <= 0)
|
if (y <= 0)
|
||||||
{
|
{
|
||||||
let font = generic_ui || !mDesc.mFont? NewSmallFont : mDesc.mFont;
|
y = DrawCaption(mDesc.mTitle, -y, true);
|
||||||
if (font && mDesc.mTitle.Length() > 0)
|
|
||||||
{
|
|
||||||
let tt = Stringtable.Localize(mDesc.mTitle);
|
|
||||||
screen.DrawText (font, OptionMenuSettings.mTitleColor,
|
|
||||||
(screen.GetWidth() - font.StringWidth(tt) * CleanXfac_1) / 2, 10*CleanYfac_1,
|
|
||||||
tt, DTA_CleanNoMove_1, true);
|
|
||||||
y = -y + font.GetHeight();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
y = -y;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mDesc.mDrawTop = y;
|
mDesc.mDrawTop = y;
|
||||||
int fontheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
|
int fontheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
|
||||||
|
|
|
@ -1234,42 +1234,3 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
// Placeholder classes for overhauled video mode menu. Do not use!
|
|
||||||
// Their sole purpose is to support mods with full copy of embedded MENUDEF
|
|
||||||
//
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
class OptionMenuItemScreenResolution : OptionMenuItem
|
|
||||||
{
|
|
||||||
String mResTexts[3];
|
|
||||||
int mSelection;
|
|
||||||
int mHighlight;
|
|
||||||
int mMaxValid;
|
|
||||||
|
|
||||||
enum EValues
|
|
||||||
{
|
|
||||||
SRL_INDEX = 0x30000,
|
|
||||||
SRL_SELECTION = 0x30003,
|
|
||||||
SRL_HIGHLIGHT = 0x30004,
|
|
||||||
};
|
|
||||||
|
|
||||||
OptionMenuItemScreenResolution Init(String command)
|
|
||||||
{
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
override bool Selectable()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class VideoModeMenu : OptionMenu
|
|
||||||
{
|
|
||||||
static bool SetSelectedSize()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue