Use text styles.

This commit is contained in:
momo5502 2016-02-05 18:13:34 +01:00
parent 497a4ecefb
commit 17f5c5e436
3 changed files with 18 additions and 5 deletions

View File

@ -56,14 +56,15 @@ namespace Components
Game::Font* font = Game::R_RegisterFont("fonts/normalFont");
float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
// Change the color when attaching a debugger
if (IsDebuggerPresent())
{
color[0] = 1.00f;
color[1] = 0.53f;
color[2] = 0.23f;
color[0] = 0.6588f;
color[1] = 1.0000f;
color[2] = 0.0000f;
}
Game::R_AddCmdDrawText("DEBUG-BUILD", 0x7FFFFFFF, font, 15.0f, 10.0f + Game::R_TextHeight(font), 1.0f, 1.0f, 0.0f, color, 0);
Game::R_AddCmdDrawText("DEBUG-BUILD", 0x7FFFFFFF, font, 15.0f, 10.0f + Game::R_TextHeight(font), 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_SHADOWED);
});
#else
Utils::Hook::Set(0x6D70AC, Exception::SetUnhandledExceptionFilterStub);

View File

@ -170,7 +170,7 @@ namespace Components
Game::Font* font = Game::R_RegisterFont("fonts/consoleFont"); // Inlining that seems to skip xpos, no idea why xD
float color[4] = { 1.0f, 1.0f, 1.0f, (Game::CL_IsCgameInitialized() ? 0.3f : 1.0f) };
Game::R_AddCmdDrawText(Utils::VA("Loading FastFile: %s", FastFiles::Current().data()), 0x7FFFFFFF, font, 5.0f, static_cast<float>(Renderer::Height() - 5), 1.0f, 1.0f, 0.0f, color, 0);
Game::R_AddCmdDrawText(Utils::VA("Loading FastFile: %s", FastFiles::Current().data()), 0x7FFFFFFF, font, 5.0f, static_cast<float>(Renderer::Height() - 5), 1.0f, 1.0f, 0.0f, color, Game::ITEM_TEXTSTYLE_NORMAL);
});
Command::Add("loadzone", [] (Command::Params params)

View File

@ -365,6 +365,18 @@ namespace Game
const char *s2;
};
// Taken from menudefinition.h
enum itemTextStyle
{
ITEM_TEXTSTYLE_NORMAL = 0, // normal text
ITEM_TEXTSTYLE_SHADOWED = 3, // drop shadow ( need a color for this )
ITEM_TEXTSTYLE_SHADOWEDMORE = 6, // drop shadow ( need a color for this )
ITEM_TEXTSTYLE_BORDERED = 7, // border (stroke)
ITEM_TEXTSTYLE_BORDEREDMORE = 8, // more border :P
ITEM_TEXTSTYLE_MONOSPACE = 128,
ITEM_TEXTSTYLE_MONOSPACESHADOWED = 132,
};
#define ITEM_TYPE_TEXT 0 // simple text
#define ITEM_TYPE_BUTTON 1 // button, basically text with a border
#define ITEM_TYPE_RADIOBUTTON 2 // toggle button, may be grouped