Merge branch 'master' of https://github.com/nullworks/cathook
This commit is contained in:
commit
770cf961fb
@ -29,13 +29,14 @@ namespace fonts
|
|||||||
#if ENABLE_ENGINE_DRAWING
|
#if ENABLE_ENGINE_DRAWING
|
||||||
struct font
|
struct font
|
||||||
{
|
{
|
||||||
font(std::string path, int fontsize) : size{ fontsize }, path{ path }
|
font(std::string path, int fontsize, bool outline = false) : size{ fontsize }, path{ path }, outline{ outline }
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
std::string path;
|
std::string path;
|
||||||
int size;
|
int size;
|
||||||
bool init = false;
|
bool init = false;
|
||||||
|
bool outline = false;
|
||||||
operator unsigned int();
|
operator unsigned int();
|
||||||
void stringSize(std::string string, float *x, float *y);
|
void stringSize(std::string string, float *x, float *y);
|
||||||
void Init();
|
void Init();
|
||||||
|
@ -90,11 +90,12 @@ font::operator unsigned int()
|
|||||||
}
|
}
|
||||||
void font::Init()
|
void font::Init()
|
||||||
{
|
{
|
||||||
size += 1;
|
size += 3;
|
||||||
static std::string filename;
|
static std::string filename;
|
||||||
filename.append("ab");
|
filename.append("ab");
|
||||||
id = g_ISurface->CreateFont();
|
id = g_ISurface->CreateFont();
|
||||||
g_ISurface->SetFontGlyphSet(id, filename.c_str(), size, 500, 0, 0, vgui::ISurface::FONTFLAG_ANTIALIAS | vgui::ISurface::FONTFLAG_ADDITIVE);
|
auto flag = outline ? vgui::ISurface::FONTFLAG_OUTLINE | vgui::ISurface::FONTFLAG_ANTIALIAS : vgui::ISurface::FONTFLAG_ANTIALIAS;
|
||||||
|
g_ISurface->SetFontGlyphSet(id, filename.c_str(), size, 500, 0, 0, flag);
|
||||||
g_ISurface->AddCustomFontFile(filename.c_str(), path.c_str());
|
g_ISurface->AddCustomFontFile(filename.c_str(), path.c_str());
|
||||||
init = true;
|
init = true;
|
||||||
}
|
}
|
||||||
@ -130,8 +131,8 @@ void Initialize()
|
|||||||
#if !ENABLE_ENGINE_DRAWING
|
#if !ENABLE_ENGINE_DRAWING
|
||||||
glez::preInit();
|
glez::preInit();
|
||||||
#endif
|
#endif
|
||||||
fonts::menu.reset(new fonts::font(DATA_PATH "/fonts/verasans.ttf", 14));
|
fonts::menu.reset(new fonts::font(DATA_PATH "/fonts/verasans.ttf", 14, true));
|
||||||
fonts::esp.reset(new fonts::font(DATA_PATH "/fonts/verasans.ttf", 14));
|
fonts::esp.reset(new fonts::font(DATA_PATH "/fonts/verasans.ttf", 14, true));
|
||||||
|
|
||||||
texture_white = g_ISurface->CreateNewTextureID();
|
texture_white = g_ISurface->CreateNewTextureID();
|
||||||
unsigned char colorBuffer[4] = { 255, 255, 255, 255 };
|
unsigned char colorBuffer[4] = { 255, 255, 255, 255 };
|
||||||
@ -144,7 +145,7 @@ void String(int x, int y, rgba_t rgba, const char *text, fonts::font &font)
|
|||||||
glez::draw::outlined_string(x, y, text, font, rgba, colors::black, nullptr, nullptr);
|
glez::draw::outlined_string(x, y, text, font, rgba, colors::black, nullptr, nullptr);
|
||||||
#else
|
#else
|
||||||
rgba = rgba * 255.0f;
|
rgba = rgba * 255.0f;
|
||||||
g_ISurface->DrawSetTextPos(x, y);
|
g_ISurface->DrawSetTextPos(x, y - 2);
|
||||||
g_ISurface->DrawSetTextFont(font);
|
g_ISurface->DrawSetTextFont(font);
|
||||||
g_ISurface->DrawSetTextColor(rgba.r, rgba.g, rgba.b, rgba.a);
|
g_ISurface->DrawSetTextColor(rgba.r, rgba.g, rgba.b, rgba.a);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user