-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Код:
enum FontRenderFlag_t
{
FONT_LEFT = 0,
FONT_RIGHT = 1,
FONT_CENTER = 2
};
void visuals::DrawString(unsigned long font, int x, int y, Color color, unsigned long alignment, const char* msg, ...)
{
va_list va_alist;
char buf[1024];
va_start (va_alist, msg);
_vsnprintf_s(buf, sizeof(buf), msg, va_alist);
va_end (va_alist);
wchar_t wbuf[1024];
MultiByteToWideChar(CP_UTF8, 0, buf, 256, wbuf, 256);
int r = 255, g = 255, b = 255, a = 255;
color.GetColor(r, g, b, a);
int width, height;
g_pSurface->GetTextSize(font, wbuf, width, height);
if (alignment & FONT_RIGHT)
x -= width;
if (alignment & FONT_CENTER)
x -= width / 2;
g_pSurface->DrawSetTextFont(font);
g_pSurface->DrawSetTextColor(r, g, b, a);
g_pSurface->DrawSetTextPos(x, y - height / 2);
g_pSurface->DrawPrintText(wbuf, wcslen(wbuf));
}
std::string GetTimeString()
{
time_t current_time;
struct tm* time_info;
static char timeString[10];
time(¤t_time);
time_info = localtime(¤t_time);
strftime(timeString, sizeof(timeString), "%X", time_info);
return timeString;
}
int getfps()
{
return static_cast<int>(1.f / g_pGlobals->frametime);
}
int gettickrate()
{
return static_cast<int>(1.f / g_pGlobals->interval_per_tick);
}
//int get_ping()
//{
// auto net_channel = g_pEngine->GetNetChannelInfo();
// return static_cast<int>(net_channel->GetLatency(FLOW_INCOMING) * 1000);
//}
void visuals::DrawWatermark()
{
float small_pixel_11 = g_pSurface->CreateFont();
g_pSurface->SetFontGlyphSet(small_pixel_11, "Smallest Pixel-7", 11, 100, 0, 0, FONTFLAG_DROPSHADOW);
float verdanaBold_12 = g_pSurface->CreateFont();
g_pSurface->SetFontGlyphSet(verdanaBold_12, "Comic Sans", 24, 700, 0, 0, FONTFLAG_DROPSHADOW);
int alpha;
int centerW, centerH;
int monstw, monsth;
int w, h;
g_pEngine->GetScreenSize(w, h);
centerW = w / 2;
centerH = h / 2;
monstw = w;
monsth = h;
alpha = 255;
/// RGB crap ///
static float rainbow;
rainbow += 0.0005;
if (rainbow > 1.f)
rainbow = 0.f;
Color wmline = Color::FromHSB(rainbow, 1.f, 1.f);
/// RECT 1///
//g_pSurface->DrawSetColor(Color(0, 0, 0, 50));
//g_pSurface->DrawFilledRect((centerW * 2) - 410, 9, (centerW * 2) - 420 + 122, 29 + 29);
g_pSurface->DrawSetColor(Color(60, 60, 60, 100));
g_pSurface->DrawFilledRect((centerW * 2) - 409, 10, (centerW * 2) - 419 + 120, 30 + 27);
g_pSurface->DrawSetColor(Color(25, 25, 25, 155));
g_pSurface->DrawFilledRect((centerW * 2) - 408, 11, (centerW * 2) - 418 + 118, 31 + 25);
g_pSurface->DrawSetColor(Color(60, 60, 60));
g_pSurface->DrawFilledRect((centerW * 2) - 405, 14, (centerW * 2) - 415 + 112, 34 + 19);
g_pSurface->DrawSetColor(Color(28, 28, 28));
g_pSurface->DrawFilledRect((centerW * 2) - 404, 15, (centerW * 2) - 414 + 110, 35 + 17);
g_pSurface->DrawSetColor(Color(14, 14, 14));
g_pSurface->DrawFilledRect((centerW * 2) - 400, 20, (centerW * 2) - 418 + 110, 30 + 17);
/// LINE ON TOP OF WATERMARK 1///
g_pSurface->DrawSetColor(Color(wmline));
g_pSurface->DrawFilledRect((centerW * 2) - 400, 19, (centerW * 2) - 413 + 105, 19 + 3);
/// RECT 2///
g_pSurface->DrawSetColor(Color(60, 60, 60, 100));
g_pSurface->DrawFilledRect((centerW * 2) - 289, 10, (centerW * 2) - 209 + 120, 30 + 27);
g_pSurface->DrawSetColor(Color(25, 25, 25, 155));
g_pSurface-> DrawFilledRect ((centerW * 2) - 288, 11, (centerW * 2) - 208 + 118, 31 + 25);
g_pSurface-> DrawSetColor (Color (60, 60, 60));
g_pSurface-> DrawFilledRect ((centerW * 2) - 285, 14, (centerW * 2) - 205 + 112, 34 + 19);
g_pSurface-> DrawSetColor (Color (28, 28, 28));
g_pSurface-> DrawFilledRect ((centerW * 2) - 284, 15, (centerW * 2) - 204 + 110, 35 + 17);
g_pSurface-> DrawSetColor (Color (14, 14, 14));
g_pSurface-> DrawFilledRect ((centerW * 2) - 280, 20, (centerW * 2) - 208 + 110, 30 + 17);
/// LINE ON TOP OF WATERMARK 2 ///
g_pSurface-> DrawSetColor (Color (wmline));
g_pSurface-> DrawFilledRect ((centerW * 2) - 280, 19, (centerW * 2) - 203 + 105, 19 + 3);
/// RECT 3 ///
g_pSurface-> DrawSetColor (Color (60, 60, 60, 100));
g_pSurface-> DrawFilledRect ((centerW * 2) - 79, 10, (centerW * 2) - 149 + 120, 30 + 27);
g_pSurface-> DrawSetColor (Color (25, 25, 25, 155));
g_pSurface-> DrawFilledRect ((centerW * 2) - 78, 11, (centerW * 2) - 148 + 118, 31 + 25);
g_pSurface-> DrawSetColor (Color (60, 60, 60));
g_pSurface-> DrawFilledRect ((centerW * 2) - 75, 14, (centerW * 2) - 145 + 112, 34 + 19);
g_pSurface-> DrawSetColor (Color (28, 28, 28));
g_pSurface-> DrawFilledRect ((centerW * 2) - 74, 15, (centerW * 2) - 144 + 110, 35 + 17);
g_pSurface-> DrawSetColor (Color (14, 14, 14));
g_pSurface-> DrawFilledRect ((centerW * 2) - 70, 20, (centerW * 2) - 148 + 110, 30 + 17);
/// LINE ON TOP OF WATERMARK 3 ///
g_pSurface-> DrawSetColor (Color (wmline));
g_pSurface-> DrawFilledRect ((centerW * 2) - 70, 19, (centerW * 2) - 143 + 105, 19 + 3);
/// TEXT ///
DrawString (small_pixel_11, (centerW * 2) - 387, 33, Color (wmline), FONT_LEFT, ("TIME:% s"), GetTimeString (). C_str ());
DrawString (small_pixel_11, (centerW * 2) - 275, 33, Color (wmline), FONT_LEFT, ("FPS:% d"), getfps ());
// DrawString (small_pixel_11, (centerW * 2) - 225, 33, Color (wmline), FONT_LEFT, ("PING:% d"), get_ping ());
DrawString (small_pixel_11, (centerW * 2) - 150, 33, Color (wmline), FONT_LEFT, ("RATE:% d"), gettickrate ());
DrawString (verdanaBold_12, (centerW * 2) - 65, 33, Color (wmline), FONT_LEFT, ("F"));
} [/ CODE][ATTACH type="full"]53694[/ATTACH]
Вложения
-
832.2 KB Просмотры: 922