mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- implemented Blood's menu caption
This commit is contained in:
parent
3dbb8cbb11
commit
1e131eda9e
7 changed files with 18 additions and 8 deletions
|
@ -1131,6 +1131,8 @@ void SetDefaultMenuColors()
|
||||||
OptionSettings.mFontColorHeader = CR_DARKGRAY;
|
OptionSettings.mFontColorHeader = CR_DARKGRAY;
|
||||||
OptionSettings.mFontColorHighlight = CR_WHITE;
|
OptionSettings.mFontColorHighlight = CR_WHITE;
|
||||||
OptionSettings.mFontColorSelection = CR_DARKRED;
|
OptionSettings.mFontColorSelection = CR_DARKRED;
|
||||||
|
auto cls = PClass::FindClass("MenuCustomizerBlood");
|
||||||
|
if (cls) menuCustomizer = cls->CreateNew();
|
||||||
}
|
}
|
||||||
else if (g_gameType & GAMEFLAG_RRALL)
|
else if (g_gameType & GAMEFLAG_RRALL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -434,7 +434,7 @@ OptionMenuSettings
|
||||||
|
|
||||||
DefaultOptionMenu
|
DefaultOptionMenu
|
||||||
{
|
{
|
||||||
Position 85
|
Position -20
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionMenu "OptionsMenu" protected
|
OptionMenu "OptionsMenu" protected
|
||||||
|
|
|
@ -5,6 +5,7 @@ version "4.3"
|
||||||
#include "zscript/events.zs"
|
#include "zscript/events.zs"
|
||||||
#include "zscript/dictionary.zs"
|
#include "zscript/dictionary.zs"
|
||||||
#include "zscript/gamescreen.zs"
|
#include "zscript/gamescreen.zs"
|
||||||
|
#include "zscript/razebase.zs"
|
||||||
|
|
||||||
#include "zscript/ui/menu/colorpickermenu.zs"
|
#include "zscript/ui/menu/colorpickermenu.zs"
|
||||||
#include "zscript/ui/menu/joystickmenu.zs"
|
#include "zscript/ui/menu/joystickmenu.zs"
|
||||||
|
|
|
@ -6,19 +6,22 @@ class MenuCustomizerBlood : MenuCustomize
|
||||||
let font = generic_ui? NewConsoleFont : BigFont; // this ignores the passed font intentionally.
|
let font = generic_ui? NewConsoleFont : BigFont; // this ignores the passed font intentionally.
|
||||||
let texid = tileFiles.GetTexture(2038, true);
|
let texid = tileFiles.GetTexture(2038, true);
|
||||||
let texsize = TexMan.GetScaledSize(texid);
|
let texsize = TexMan.GetScaledSize(texid);
|
||||||
let fonth = fnt.GetGlyphHeight("A");
|
let fonth = font.GetGlyphHeight("A");
|
||||||
if (drawit)
|
if (drawit)
|
||||||
{
|
{
|
||||||
int width = font.StringWidth(title);
|
int width = font.StringWidth(title);
|
||||||
if (texid.isValid())
|
if (texid.isValid())
|
||||||
{
|
{
|
||||||
double scalex = 1.; // Expand the box if the text is longer
|
double scalex = 1.; // Expand the box if the text is longer
|
||||||
if (texsize.X - 10 < width) scalex = texsize.X / (boxwidth - 10);
|
if (texsize.X - 10 < width) scalex = width / (texsize.X - 10);
|
||||||
screen.DrawTexture(texid, false, 160, 20, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, DTA_ScaleX, scalex);
|
screen.DrawTexture(texid, false, 160, 20, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, DTA_ScaleX, scalex);
|
||||||
}
|
}
|
||||||
screen.DrawText(fnt, Font.CR_UNDEFINED, 160 - width / 2, 20 - fonth / 2, text, DTA_FullscreenScale, FSMode_Fit320x200Top);
|
screen.DrawText(font, Font.CR_UNDEFINED, 160 - width / 2, 20 - fonth / 2, title, DTA_FullscreenScale, FSMode_Fit320x200Top);
|
||||||
}
|
}
|
||||||
|
double fx, fy, fw, fh;
|
||||||
|
[fx, fy, fw, fh] = Screen.GetFullscreenRect(320, 200, FSMode_ScaleToFit43Top);
|
||||||
int h = texid.isValid()? texsize.Y : fonth;
|
int h = texid.isValid()? texsize.Y : fonth;
|
||||||
return y + h * screen.GetHeight() * CleanYfac_1 / 200; // option menus use Clean?fac_1 so we have to convert to that screen space.
|
Console.Printf("%f, %f, %d", texsize.Y, fh, int((h)*fh / 200));
|
||||||
|
return int((y+h) * fh / 200); // This must be the covered height of the header in true pixels.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
wadsrc/static/zscript/razebase.zs
Normal file
5
wadsrc/static/zscript/razebase.zs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
struct TileFiles
|
||||||
|
{
|
||||||
|
native static TextureID GetTexture(int tile, bool animate = false);
|
||||||
|
}
|
|
@ -5,6 +5,6 @@ class MenuCustomize
|
||||||
virtual int DrawCaption(String title, Font fnt, int y, bool drawit)
|
virtual int DrawCaption(String title, Font fnt, int y, bool drawit)
|
||||||
{
|
{
|
||||||
screen.DrawText(fnt, OptionMenuSettings.mTitleColor, (screen.GetWidth() - fnt.StringWidth(title) * CleanXfac_1) / 2, 10 * CleanYfac_1, title, DTA_CleanNoMove_1, true);
|
screen.DrawText(fnt, OptionMenuSettings.mTitleColor, (screen.GetWidth() - fnt.StringWidth(title) * CleanXfac_1) / 2, 10 * CleanYfac_1, title, DTA_CleanNoMove_1, true);
|
||||||
return y + fnt.GetHeight();
|
return (y + fnt.GetHeight()) * CleanYfac_1; // return is spacing in screen pixels.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,9 +456,8 @@ class OptionMenu : Menu
|
||||||
{
|
{
|
||||||
y = DrawCaption(mDesc.mTitle, -y, true);
|
y = DrawCaption(mDesc.mTitle, -y, true);
|
||||||
}
|
}
|
||||||
mDesc.mDrawTop = y;
|
mDesc.mDrawTop = y / CleanYfac_1; // mouse checks are done in clean space.
|
||||||
int fontheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
|
int fontheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
|
||||||
y *= CleanYfac_1;
|
|
||||||
|
|
||||||
int indent = GetIndent();
|
int indent = GetIndent();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue