Исходник ⁠onetap.su v1 watermark, binds, spectators list

Забаненный
Статус
Оффлайн
Регистрация
31 Дек 2018
Сообщения
442
Реакции[?]
212
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Меня зовут slave бумага, okay maggots i wanna see 6 hot loads, и представляете, это мой первый dick, ха-ха погнали!

Код максимально flexible (в плане, что его можно стастить куда угодно, и реализовать с помощью него много всяких вижуальных features).
Комментариев тоже много, так что пожалуйста, читайте комменты, прежде чем писать что-либо в лс..........................................
От идеи до воплощения 1 день, так что код стайл может переходить от уровня линея до уровня дукари..

Color mode static:


Color mode rainbow:


Color mode gradient:


C++:
create_font(font::tahoma_8, XOR("Tahoma"), 12, 100, NONE);
C++:
#include "hud.h"

void c_hud::update_accent_color() {
    const auto freq = 1.f; /// Gradient speed (curr: 100%)

    const auto real_time = interfaces::globals->m_real_time * freq;

    switch (m_style.m_col_mode) {
        case STATIC: {
            m_style.m_col_accent[0] = m_style.m_col_fallback;
            m_style.m_col_accent[1] = m_style.m_col_fallback;

            break;
        }
        case RAINBOW: {
            /// Looks like pasted from fatality lua, but it isn't (no lie)
            const auto r = math::floor(math::sin(real_time + 0.f) * 127.f + 128.f);
            const auto g = math::floor(math::sin(real_time + 2.f) * 127.f + 128.f);
            const auto b = math::floor(math::sin(real_time + 4.f) * 127.f + 128.f);

            m_style.m_col_accent[0] = color(r, g, b, 200);
            m_style.m_col_accent[1] = color(r, g, b, 200);
            break;
        }
        case GRADIENT: {
            /// Looks like pasted from fatality lua, but it isn't (no lie)
            const auto r = math::floor(math::sin(real_time + 0.f) * 127.f + 128.f);
            const auto g = math::floor(math::sin(real_time + 2.f) * 127.f + 128.f);
            const auto b = math::floor(math::sin(real_time + 4.f) * 127.f + 128.f);

            m_style.m_col_accent[0] = color(b, g, r, 200);
            m_style.m_col_accent[1] = color(r, g, b, 200);
            break;
        }
    };
}

void c_hud::draw_watermark(uint8_t options) {
    /// Watermark text string stuff.
    auto text = string("figma.com");

    if (options & USER) {
        text += " | sove";
    }

    const auto net_channel = interfaces::engine->get_net_channel_info();

    /// Are net channel ptr is valid and we in game.
    if (net_channel && interfaces::engine->is_in_game()) {
        if (options & INCOMING) {
            /// Get incoming latency in milliseconds.
            const auto incoming_latency = std::max(0, static_cast<int>(std::round(net_channel->get_avg_latency(FLOW_INCOMING) * 1000.f)));

            text += " | incoming: " + std::to_string(incoming_latency) + "ms";
        }
        if (options & OUTGOING) {
            /// Get outgoing latency in milliseconds.
            const auto outgoing_latency = std::max(0, static_cast<int>(std::round(net_channel->get_avg_latency(FLOW_OUTGOING) * 1000.f)));

            text += " | outgoing: " + std::to_string(outgoing_latency) + "ms";
        }
    }
    if (options & TIME) {
        /// Get time.
        auto time = std::time(nullptr);  
        std::ostringstream time_ss;
        /// Format: 12:59:09.
        time_ss << std::put_time(std::localtime(&time), " | %H:%M:%S");

        text += time_ss.str().data();
    }

    /// Render stuff.

    /// Measures of string, that's will be rendered.
    const auto text_size = render::measure_text(font::tahoma_8, text);

    /// We ain't about this white text on yellow bg life.
    auto text_color = color(255, 255, 255);
    auto text_color_inverted = false; /// Useful for text shadow render.
    {
        const auto hue = m_style.m_col_accent[0].hue();

        if ((hue >= 0.2f) && (hue <= 0.6f)) {
            text_color = color(0, 0, 0);
            text_color_inverted = true;
        }
    }

    /// Background measures.
    const auto pos = vec2(render::m_screen_size.x - m_style.m_watermark_margins.x - (m_style.m_watermark_paddings.x * 2) - text_size.x, m_style.m_watermark_margins.y);
    const auto size = text_size + m_style.m_watermark_paddings * 2;

    const auto text_pos = pos + m_style.m_watermark_paddings;

    render::gradient(pos.x, pos.y, size.x, size.y, m_style.m_col_accent[0], m_style.m_col_accent[1]);

    /// Text shadow (if text isn't black).
    if (!text_color_inverted)
        render::text(text_pos.x + 1, text_pos.y + 1, font::tahoma_8, text, color(0, 0, 0, 200));
        /// 1 - shadow offset.

    render::text(text_pos.x, text_pos.y, font::tahoma_8, text, text_color);
}

void c_hud::draw_frame(const vec2& pos, const wstring& name, const std::vector<wstring>& first_column, const std::vector<wstring>& second_column) {
    /// Header label.
    auto text = name + L" (" + std::to_wstring(first_column.size()) + L")";

    /// Aayyaya initialization of variable, y value will be adjusted to all elements size.
            auto size = vec2(220, 0);

            auto line_pos = vec2(pos.x + m_style.m_pad_header_sides, pos.y + m_style.m_pad_header_top);
    const auto line_size = vec2(size.x - (m_style.m_pad_header_sides * 2), 4);

    const auto text_pos = vec2(line_pos.x + (line_size.x * 0.5f), line_pos.y);
    const auto text_size = render::measure_text(font::tahoma_8, text.c_str());

    const auto pad_text_line = text_size.y + 2;

    /// Adding little bit padding.
    line_pos.y += pad_text_line;

            auto base_pos = vec2(line_pos.x, line_pos.y + line_size.y + m_style.m_pad_header_bottom);
            auto base_size = vec2(line_size.x, (m_style.m_line_height * first_column.size()) + (m_style.m_pad_base * 2));

    /// Adjusted height of our crap.
    size.y += text_size.y + pad_text_line + line_size.y + m_style.m_pad_header_bottom + base_size.y;

    /// Outline measures.
    const auto outline_pos = pos - m_style.m_outline_size;
    const auto outline_size = size + (m_style.m_outline_size * 2);

    /// Outline.
    render::rect(outline_pos.x, outline_pos.y, outline_size.x, outline_size.y, m_style.m_col_outline);

    /// Beside outline.
    {
        /// Outer.
        render::outline(outline_pos.x - 1, outline_pos.y - 1, outline_size.x + 2, outline_size.y + 2, m_style.m_col_outer_outline);

        /// Inner.
        render::outline(outline_pos.x, outline_pos.y, outline_size.x, outline_size.y, m_style.m_col_inner_outline);
    }

    /// Inside outline.
    {
        const auto this_pos = outline_pos + m_style.m_outline_size;
        const auto this_size = outline_size - (m_style.m_outline_size * 2);

        /// Outer (also closet to base background, so render like it is).
        render::rect(this_pos.x, this_pos.y, this_size.x, this_size.y, m_style.m_col_outer_outline);

        /// Inner.
        render::outline(this_pos.x + 1, this_pos.y + 1, this_size.x - 2, this_size.y - 2, m_style.m_col_inner_outline);
    }

    /// Header.
    {
        /// Label shadow.
        render::text(text_pos.x + 1, text_pos.y + 1, font::tahoma_8, text.c_str(), color(0, 0, 0, 200), ALIGN_CENTER_X);

        /// Label.
        render::text(text_pos.x, text_pos.y, font::tahoma_8, text.c_str(), color(255, 255, 255, 200), ALIGN_CENTER_X);

        /// Base accent line.
        render::gradient(line_pos.x, line_pos.y, line_size.x, line_size.y, m_style.m_col_accent[0], m_style.m_col_accent[1]);

        /// Line shade.
        render::rect(line_pos.x, line_pos.y, line_size.x, line_size.y * 0.5f, color(255, 255, 255, 20));
    }

    /// Base.
    {
        /// Background.
        render::rect(base_pos.x, base_pos.y, base_size.x, base_size.y, m_style.m_col_base);

        /// Outer outline.
        render::outline(base_pos.x, base_pos.y, base_size.x, base_size.y, m_style.m_col_base_outer_outline);

        /// Inner outline.
        render::outline(base_pos.x + 1, base_pos.y + 1, base_size.x - 2, base_size.y - 2, m_style.m_col_base_inner_outline);

        /// Left column.
        if (!first_column.empty()) {
            /// C'mon, let's go.
            auto builder_pos = base_pos + m_style.m_pad_base;

            /// Ampersand imeni Platina300.
            for (const auto& item : first_column) {
                render::text(builder_pos.x, builder_pos.y, font::tahoma_8, item.c_str(), color(255, 255, 255, 200));

                builder_pos.y += m_style.m_line_height;
            }
        }

        /// Right column.
        if (!second_column.empty()) {
            /// C'mon, let's go.
            auto builder_pos = base_pos + m_style.m_pad_base;

            /// Right aligning text.
            builder_pos.x += base_size.x - (m_style.m_pad_base * 2);

            /// Ampersand imeni Platina300.
            for (const auto& item : second_column) {
                const auto text_size = render::measure_text(font::tahoma_8, item.c_str());

                /// Right aligning text.
                render::text(builder_pos.x - text_size.x, builder_pos.y, font::tahoma_8, item.c_str(), color(255, 255, 255, 200));

                builder_pos.y += m_style.m_line_height;
            }
        }
    }
}

void c_hud::draw_binds(const vec2& pos) {
    std::vector<wstring> binds_name;
    std::vector<wstring> binds_mode;

    if (true) {
        binds_name.emplace_back(L"а я еду suck");
        binds_mode.emplace_back(L"toggled");
    }
    if (true) {
        binds_name.emplace_back(L"suck some dick");
        binds_mode.emplace_back(L"disabled");
    }
    if (true) {
        binds_name.emplace_back(L"вокруг fucking slaves");
        binds_mode.emplace_back(L"fisting");
    }

    draw_frame(pos, L"binds", binds_name, binds_mode);
}

/// Simple spectators list.
void c_hud::draw_spectators(const vec2& pos) {
    if (!globals::local_player->is_alive())
        return;

    std::vector<wstring> spectators_name;

    for (auto i = 1u; i <= interfaces::globals->m_max_players; i++) {
        auto player = static_cast<c_cs_player*>(interfaces::entity_list->get_client_entity(i));
        if (!player)
            continue;

        if (player->m_spectating_target() != globals::local_player)
            continue;

        const auto info = player->get_info();

        //if (info.m_hltv || info.m_fake_player)
        //    continue;

        auto name = convert::to_unicode(info.m_name);

        std::transform(name.begin(), name.end(), name.begin(), towlower);

        spectators_name.emplace_back(name);
    }

    draw_frame(pos, L"spectators", spectators_name);
}

void c_hud::render() {
    /// Updating our accent color.
    update_accent_color();

    /// Change watermark options here.
    draw_watermark(USER | INCOMING | OUTGOING | TIME);

    draw_binds(vec2(1685, 60));

    draw_spectators(vec2(1685, 180));
}
C++:
#pragma once
#include "../../globals.h"

class c_hud : public singleton<c_hud> {
private:
    /// Elements accent color mode.
    enum e_color_mode {
        STATIC = 1, /// Just accent color
        RAINBOW,        /// Dynamic color
        GRADIENT    /// Gradient dynamic color
    };

    /// Watermark options to draw.
    enum e_watermark_options {
        NONE        = 0, /// Default argument, only logo will be drawn.
        USER        = (1 << 0), /// User name
        INCOMING = (1 << 1), /// Incoming latency (only in-game)
        OUTGOING = (1 << 2), /// Outgoing latency (only in-game)
        TIME        = (1 << 3)  /// Current Windows time
    };

    /// Color stuff.

    /// <summary> Returns color, based on current style. </summary>
    void update_accent_color();

    struct style_t {
        e_color_mode    m_col_mode = RAINBOW; /// Elements accent color mode.
        color                m_col_fallback = color(210, 150, 20, 200); /// Change your accent color here.
        color                m_col_accent[2]; /// Final color, will be used in elements rendering.

        /// Watermark stuff.
        vec2                m_watermark_paddings = vec2(5, 3);
        vec2                m_watermark_margins  = vec2(10, 10);

        /// Default elements stuff.
        size_t            m_outline_size            = 4; /// Main outline size (in pixels).
        size_t            m_line_height            = render::measure_text(font::tahoma_8, "A").y;

        size_t            m_pad_base                = 5;
        size_t            m_pad_header_top        = 6;
        size_t            m_pad_header_sides    = 6;
        size_t            m_pad_header_bottom    = 7;

        color                m_col_base                        = color(0, 0, 0);
        color                m_col_base_outer_outline    = color(0, 0, 0, 220);
        color                m_col_base_inner_outline    = color(255, 255, 255, 4);

        color                m_col_outline            = color(0, 0, 0, 200);
        color                m_col_outer_outline    = color(0, 0, 0, 220);
        color                m_col_inner_outline    = color(255, 255, 255, 8);
    } m_style;

    /// Elements rendering.

    /// <summary> Usage: draw_watermark(USER | OUTGOING | TIME) for user name, outgoing latency and time rendering. </summary>
    void draw_watermark    (uint8_t options = NONE);

    void draw_frame        (const vec2& pos, const wstring& name, const std::vector<wstring>& first_column, const std::vector<wstring>& second_column = {});
    void draw_binds        (const vec2& pos);
    void draw_spectators    (const vec2& pos);

public:
    /// <summary> Entry function. Should be called in d3dx9 or paint hook. </summary>
    void render();
};
Скрытое содержимое

FAQ YOU:

C++:
color == col_t
vec2 == vec2_t
wstring == std::wstring
string == std::string
math:: можно заменить на std::
hue() - https://github.com/DucaRii/csgo_modest/blob/master/shared/color/col_t.hpp#L99
measure_text(font, text) == get_text_size(font, text)
convert::to_unicode - https://github.com/lagcomp/wok-csgo-sdk-v2/blob/master/wok-csgo/utils/utils.h#L54
singleton - можете удалить, и вызывать с помощью c_hud::render()
не найден оператор для vec2 - https://github.com/DucaRii/csgo_modest/blob/master/shared/math/datatypes/vec2_t.hpp c+p
никак

Лови симпу, заслужил <3
 
mon
Начинающий
Статус
Оффлайн
Регистрация
10 Ноя 2020
Сообщения
97
Реакции[?]
8
Поинты[?]
0
Меня зовут slave бумага, okay maggots i wanna see 6 hot loads, и представляете, это мой первый dick, ха-ха погнали!

Код максимально flexible (в плане, что его можно стастить куда угодно, и реализовать с помощью него много всяких вижуальных features).
Комментариев тоже много, так что пожалуйста, читайте комменты, прежде чем писать что-либо в лс..........................................
От идеи до воплощения 1 день, так что код стайл может переходить от уровня линея до уровня дукари..

Color mode static:


Color mode rainbow:


Color mode gradient:


C++:
create_font(font::tahoma_8, XOR("Tahoma"), 12, 100, NONE);
C++:
#include "hud.h"

void c_hud::update_accent_color() {
    const auto freq = 1.f; /// Gradient speed (curr: 100%)

    const auto real_time = interfaces::globals->m_real_time * freq;

    switch (m_style.m_col_mode) {
        case STATIC: {
            m_style.m_col_accent[0] = m_style.m_col_fallback;
            m_style.m_col_accent[1] = m_style.m_col_fallback;

            break;
        }
        case RAINBOW: {
            /// Looks like pasted from fatality lua, but it isn't (no lie)
            const auto r = math::floor(math::sin(real_time + 0.f) * 127.f + 128.f);
            const auto g = math::floor(math::sin(real_time + 2.f) * 127.f + 128.f);
            const auto b = math::floor(math::sin(real_time + 4.f) * 127.f + 128.f);

            m_style.m_col_accent[0] = color(r, g, b, 200);
            m_style.m_col_accent[1] = color(r, g, b, 200);
            break;
        }
        case GRADIENT: {
            /// Looks like pasted from fatality lua, but it isn't (no lie)
            const auto r = math::floor(math::sin(real_time + 0.f) * 127.f + 128.f);
            const auto g = math::floor(math::sin(real_time + 2.f) * 127.f + 128.f);
            const auto b = math::floor(math::sin(real_time + 4.f) * 127.f + 128.f);

            m_style.m_col_accent[0] = color(b, g, r, 200);
            m_style.m_col_accent[1] = color(r, g, b, 200);
            break;
        }
    };
}

void c_hud::draw_watermark(uint8_t options) {
    /// Watermark text string stuff.
    auto text = string("figma.com");

    if (options & USER) {
        text += " | sove";
    }

    const auto net_channel = interfaces::engine->get_net_channel_info();

    /// Are net channel ptr is valid and we in game.
    if (net_channel && interfaces::engine->is_in_game()) {
        if (options & INCOMING) {
            /// Get incoming latency in milliseconds.
            const auto incoming_latency = std::max(0, static_cast<int>(std::round(net_channel->get_avg_latency(FLOW_INCOMING) * 1000.f)));

            text += " | incoming: " + std::to_string(incoming_latency) + "ms";
        }
        if (options & OUTGOING) {
            /// Get outgoing latency in milliseconds.
            const auto outgoing_latency = std::max(0, static_cast<int>(std::round(net_channel->get_avg_latency(FLOW_OUTGOING) * 1000.f)));

            text += " | outgoing: " + std::to_string(outgoing_latency) + "ms";
        }
    }
    if (options & TIME) {
        /// Get time.
        auto time = std::time(nullptr);  
        std::ostringstream time_ss;
        /// Format: 12:59:09.
        time_ss << std::put_time(std::localtime(&time), " | %H:%M:%S");

        text += time_ss.str().data();
    }

    /// Render stuff.

    /// Measures of string, that's will be rendered.
    const auto text_size = render::measure_text(font::tahoma_8, text);

    /// We ain't about this white text on yellow bg life.
    auto text_color = color(255, 255, 255);
    auto text_color_inverted = false; /// Useful for text shadow render.
    {
        const auto hue = m_style.m_col_accent[0].hue();

        if ((hue >= 0.2f) && (hue <= 0.6f)) {
            text_color = color(0, 0, 0);
            text_color_inverted = true;
        }
    }

    /// Background measures.
    const auto pos = vec2(render::m_screen_size.x - m_style.m_watermark_margins.x - (m_style.m_watermark_paddings.x * 2) - text_size.x, m_style.m_watermark_margins.y);
    const auto size = text_size + m_style.m_watermark_paddings * 2;

    const auto text_pos = pos + m_style.m_watermark_paddings;

    render::gradient(pos.x, pos.y, size.x, size.y, m_style.m_col_accent[0], m_style.m_col_accent[1]);

    /// Text shadow (if text isn't black).
    if (!text_color_inverted)
        render::text(text_pos.x + 1, text_pos.y + 1, font::tahoma_8, text, color(0, 0, 0, 200));
        /// 1 - shadow offset.

    render::text(text_pos.x, text_pos.y, font::tahoma_8, text, text_color);
}

void c_hud::draw_frame(const vec2& pos, const wstring& name, const std::vector<wstring>& first_column, const std::vector<wstring>& second_column) {
    /// Header label.
    auto text = name + L" (" + std::to_wstring(first_column.size()) + L")";

    /// Aayyaya initialization of variable, y value will be adjusted to all elements size.
            auto size = vec2(220, 0);

            auto line_pos = vec2(pos.x + m_style.m_pad_header_sides, pos.y + m_style.m_pad_header_top);
    const auto line_size = vec2(size.x - (m_style.m_pad_header_sides * 2), 4);

    const auto text_pos = vec2(line_pos.x + (line_size.x * 0.5f), line_pos.y);
    const auto text_size = render::measure_text(font::tahoma_8, text.c_str());

    const auto pad_text_line = text_size.y + 2;

    /// Adding little bit padding.
    line_pos.y += pad_text_line;

            auto base_pos = vec2(line_pos.x, line_pos.y + line_size.y + m_style.m_pad_header_bottom);
            auto base_size = vec2(line_size.x, (m_style.m_line_height * first_column.size()) + (m_style.m_pad_base * 2));

    /// Adjusted height of our crap.
    size.y += text_size.y + pad_text_line + line_size.y + m_style.m_pad_header_bottom + base_size.y;

    /// Outline measures.
    const auto outline_pos = pos - m_style.m_outline_size;
    const auto outline_size = size + (m_style.m_outline_size * 2);

    /// Outline.
    render::rect(outline_pos.x, outline_pos.y, outline_size.x, outline_size.y, m_style.m_col_outline);

    /// Beside outline.
    {
        /// Outer.
        render::outline(outline_pos.x - 1, outline_pos.y - 1, outline_size.x + 2, outline_size.y + 2, m_style.m_col_outer_outline);

        /// Inner.
        render::outline(outline_pos.x, outline_pos.y, outline_size.x, outline_size.y, m_style.m_col_inner_outline);
    }

    /// Inside outline.
    {
        const auto this_pos = outline_pos + m_style.m_outline_size;
        const auto this_size = outline_size - (m_style.m_outline_size * 2);

        /// Outer (also closet to base background, so render like it is).
        render::rect(this_pos.x, this_pos.y, this_size.x, this_size.y, m_style.m_col_outer_outline);

        /// Inner.
        render::outline(this_pos.x + 1, this_pos.y + 1, this_size.x - 2, this_size.y - 2, m_style.m_col_inner_outline);
    }

    /// Header.
    {
        /// Label shadow.
        render::text(text_pos.x + 1, text_pos.y + 1, font::tahoma_8, text.c_str(), color(0, 0, 0, 200), ALIGN_CENTER_X);

        /// Label.
        render::text(text_pos.x, text_pos.y, font::tahoma_8, text.c_str(), color(255, 255, 255, 200), ALIGN_CENTER_X);

        /// Base accent line.
        render::gradient(line_pos.x, line_pos.y, line_size.x, line_size.y, m_style.m_col_accent[0], m_style.m_col_accent[1]);

        /// Line shade.
        render::rect(line_pos.x, line_pos.y, line_size.x, line_size.y * 0.5f, color(255, 255, 255, 20));
    }

    /// Base.
    {
        /// Background.
        render::rect(base_pos.x, base_pos.y, base_size.x, base_size.y, m_style.m_col_base);

        /// Outer outline.
        render::outline(base_pos.x, base_pos.y, base_size.x, base_size.y, m_style.m_col_base_outer_outline);

        /// Inner outline.
        render::outline(base_pos.x + 1, base_pos.y + 1, base_size.x - 2, base_size.y - 2, m_style.m_col_base_inner_outline);

        /// Left column.
        if (!first_column.empty()) {
            /// C'mon, let's go.
            auto builder_pos = base_pos + m_style.m_pad_base;

            /// Ampersand imeni Platina300.
            for (const auto& item : first_column) {
                render::text(builder_pos.x, builder_pos.y, font::tahoma_8, item.c_str(), color(255, 255, 255, 200));

                builder_pos.y += m_style.m_line_height;
            }
        }

        /// Right column.
        if (!second_column.empty()) {
            /// C'mon, let's go.
            auto builder_pos = base_pos + m_style.m_pad_base;

            /// Right aligning text.
            builder_pos.x += base_size.x - (m_style.m_pad_base * 2);

            /// Ampersand imeni Platina300.
            for (const auto& item : second_column) {
                const auto text_size = render::measure_text(font::tahoma_8, item.c_str());

                /// Right aligning text.
                render::text(builder_pos.x - text_size.x, builder_pos.y, font::tahoma_8, item.c_str(), color(255, 255, 255, 200));

                builder_pos.y += m_style.m_line_height;
            }
        }
    }
}

void c_hud::draw_binds(const vec2& pos) {
    std::vector<wstring> binds_name;
    std::vector<wstring> binds_mode;

    if (true) {
        binds_name.emplace_back(L"а я еду suck");
        binds_mode.emplace_back(L"toggled");
    }
    if (true) {
        binds_name.emplace_back(L"suck some dick");
        binds_mode.emplace_back(L"disabled");
    }
    if (true) {
        binds_name.emplace_back(L"вокруг fucking slaves");
        binds_mode.emplace_back(L"fisting");
    }

    draw_frame(pos, L"binds", binds_name, binds_mode);
}

/// Simple spectators list.
void c_hud::draw_spectators(const vec2& pos) {
    if (!globals::local_player->is_alive())
        return;

    std::vector<wstring> spectators_name;

    for (auto i = 1u; i <= interfaces::globals->m_max_players; i++) {
        auto player = static_cast<c_cs_player*>(interfaces::entity_list->get_client_entity(i));
        if (!player)
            continue;

        if (player->m_spectating_target() != globals::local_player)
            continue;

        const auto info = player->get_info();

        //if (info.m_hltv || info.m_fake_player)
        //    continue;

        auto name = convert::to_unicode(info.m_name);

        std::transform(name.begin(), name.end(), name.begin(), towlower);

        spectators_name.emplace_back(name);
    }

    draw_frame(pos, L"spectators", spectators_name);
}

void c_hud::render() {
    /// Updating our accent color.
    update_accent_color();

    /// Change watermark options here.
    draw_watermark(USER | INCOMING | OUTGOING | TIME);

    draw_binds(vec2(1685, 60));

    draw_spectators(vec2(1685, 180));
}
C++:
#pragma once
#include "../../globals.h"

class c_hud : public singleton<c_hud> {
private:
    /// Elements accent color mode.
    enum e_color_mode {
        STATIC = 1, /// Just accent color
        RAINBOW,        /// Dynamic color
        GRADIENT    /// Gradient dynamic color
    };

    /// Watermark options to draw.
    enum e_watermark_options {
        NONE        = 0, /// Default argument, only logo will be drawn.
        USER        = (1 << 0), /// User name
        INCOMING = (1 << 1), /// Incoming latency (only in-game)
        OUTGOING = (1 << 2), /// Outgoing latency (only in-game)
        TIME        = (1 << 3)  /// Current Windows time
    };

    /// Color stuff.

    /// <summary> Returns color, based on current style. </summary>
    void update_accent_color();

    struct style_t {
        e_color_mode    m_col_mode = RAINBOW; /// Elements accent color mode.
        color                m_col_fallback = color(210, 150, 20, 200); /// Change your accent color here.
        color                m_col_accent[2]; /// Final color, will be used in elements rendering.

        /// Watermark stuff.
        vec2                m_watermark_paddings = vec2(5, 3);
        vec2                m_watermark_margins  = vec2(10, 10);

        /// Default elements stuff.
        size_t            m_outline_size            = 4; /// Main outline size (in pixels).
        size_t            m_line_height            = render::measure_text(font::tahoma_8, "A").y;

        size_t            m_pad_base                = 5;
        size_t            m_pad_header_top        = 6;
        size_t            m_pad_header_sides    = 6;
        size_t            m_pad_header_bottom    = 7;

        color                m_col_base                        = color(0, 0, 0);
        color                m_col_base_outer_outline    = color(0, 0, 0, 220);
        color                m_col_base_inner_outline    = color(255, 255, 255, 4);

        color                m_col_outline            = color(0, 0, 0, 200);
        color                m_col_outer_outline    = color(0, 0, 0, 220);
        color                m_col_inner_outline    = color(255, 255, 255, 8);
    } m_style;

    /// Elements rendering.

    /// <summary> Usage: draw_watermark(USER | OUTGOING | TIME) for user name, outgoing latency and time rendering. </summary>
    void draw_watermark    (uint8_t options = NONE);

    void draw_frame        (const vec2& pos, const wstring& name, const std::vector<wstring>& first_column, const std::vector<wstring>& second_column = {});
    void draw_binds        (const vec2& pos);
    void draw_spectators    (const vec2& pos);

public:
    /// <summary> Entry function. Should be called in d3dx9 or paint hook. </summary>
    void render();
};
Скрытое содержимое

FAQ YOU:

C++:
color == col_t
vec2 == vec2_t
wstring == std::wstring
string == std::string
math:: можно заменить на std::
hue() - https://github.com/DucaRii/csgo_modest/blob/master/shared/color/col_t.hpp#L99
measure_text(font, text) == get_text_size(font, text)
convert::to_unicode - https://github.com/lagcomp/wok-csgo-sdk-v2/blob/master/wok-csgo/utils/utils.h#L54
singleton - можете удалить, и вызывать с помощью c_hud::render()
не найден оператор для vec2 - https://github.com/DucaRii/csgo_modest/blob/master/shared/math/datatypes/vec2_t.hpp c+p
никак

как в lw ватермарку спастить?
 
Начинающий
Статус
Оффлайн
Регистрация
31 Окт 2019
Сообщения
7
Реакции[?]
0
Поинты[?]
0
Hello everyone!
I am trying to paste this in the supremacy source and I am having some problems. Keep in mind I am very new to coding and i only pasted before.
Would anyone be so nice to help me on discord chat? No neen to talk to me, I will send screenshots and explanation.
Thank you all in advance!
 
Забаненный
Статус
Оффлайн
Регистрация
9 Фев 2021
Сообщения
8
Реакции[?]
1
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
paste

const auto incoming_latency = std::max(0, static_cast<int>(std::round(net_channel->get_avg_latency(FLOW_INCOMING) * 1000.f)));
wtf
[ QUOTE="sove, post: 1766504, member: 92037"]

singleton - can be removed and called with c_hud::render()


[/QUOTE]

lmao i laugh at it
 
Начинающий
Статус
Оффлайн
Регистрация
31 Окт 2019
Сообщения
7
Реакции[?]
0
Поинты[?]
0
I am trying to paste this into supremacy, but I am having trouble.
1613383509406.png
Anyone able to help me?
If not or don't want to, feel free to ingore my comment.
Have a great day!
 
Забаненный
Статус
Оффлайн
Регистрация
15 Фев 2021
Сообщения
6
Реакции[?]
0
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
[QUOTE = "sove, post: 1766504, member: 92037"]
Меня зовут slave бумага, okay maggots i wanna see 6 hot loads, и представляете, это мой первый dick, ха-ха погнали!

Код максимально flexible (в плане, что его можно стастить куда угодно, и реализовать с помощью него много всяких вижуальных features).
Комментариев тоже много, так что пожалуйста, читайте комменты, прежде чем писать что-либо в лс..........................................
От идеи до воплощения 1 день, так что код стайл может переходить от уровня линея до уровня дукари..

Color mode static:


Color mode rainbow:


Color mode gradient:


C++:
create_font(font::tahoma_8, XOR("Tahoma"), 12, 100, NONE);
C++:
#include "hud.h"

void c_hud::update_accent_color() {
    const auto freq = 1.f; /// Gradient speed (curr: 100%)

    const auto real_time = interfaces::globals->m_real_time * freq;

    switch (m_style.m_col_mode) {
        case STATIC: {
            m_style.m_col_accent[0] = m_style.m_col_fallback;
            m_style.m_col_accent[1] = m_style.m_col_fallback;

            break;
        }
        case RAINBOW: {
            /// Looks like pasted from fatality lua, but it isn't (no lie)
            const auto r = math::floor(math::sin(real_time + 0.f) * 127.f + 128.f);
            const auto g = math::floor(math::sin(real_time + 2.f) * 127.f + 128.f);
            const auto b = math::floor(math::sin(real_time + 4.f) * 127.f + 128.f);

            m_style.m_col_accent[0] = color(r, g, b, 200);
            m_style.m_col_accent[1] = color(r, g, b, 200);
            break;
        }
        case GRADIENT: {
            /// Looks like pasted from fatality lua, but it isn't (no lie)
            const auto r = math::floor(math::sin(real_time + 0.f) * 127.f + 128.f);
            const auto g = math::floor(math::sin(real_time + 2.f) * 127.f + 128.f);
            const auto b = math::floor(math::sin(real_time + 4.f) * 127.f + 128.f);

            m_style.m_col_accent[0] = color(b, g, r, 200);
            m_style.m_col_accent[1] = color(r, g, b, 200);
            break;
        }
    };
}

void c_hud::draw_watermark(uint8_t options) {
    /// Watermark text string stuff.
    auto text = string("figma.com");

    if (options & USER) {
        text += " | sove";
    }

    const auto net_channel = interfaces::engine->get_net_channel_info();

    /// Are net channel ptr is valid and we in game.
    if (net_channel && interfaces::engine->is_in_game()) {
        if (options & INCOMING) {
            /// Get incoming latency in milliseconds.
            const auto incoming_latency = std::max(0, static_cast<int>(std::round(net_channel->get_avg_latency(FLOW_INCOMING) * 1000.f)));

            text += " | incoming: " + std::to_string(incoming_latency) + "ms";
        }
        if (options & OUTGOING) {
            /// Get outgoing latency in milliseconds.
            const auto outgoing_latency = std::max(0, static_cast<int>(std::round(net_channel->get_avg_latency(FLOW_OUTGOING) * 1000.f)));

            text += " | outgoing: " + std::to_string(outgoing_latency) + "ms";
        }
    }
    if (options & TIME) {
        /// Get time.
        auto time = std::time(nullptr);  
        std::ostringstream time_ss;
        /// Format: 12:59:09.
        time_ss << std::put_time(std::localtime(&time), " | %H:%M:%S");

        text += time_ss.str().data();
    }

    /// Render stuff.

    /// Measures of string, that's will be rendered.
    const auto text_size = render::measure_text(font::tahoma_8, text);

    /// We ain't about this white text on yellow bg life.
    auto text_color = color(255, 255, 255);
    auto text_color_inverted = false; /// Useful for text shadow render.
    {
        const auto hue = m_style.m_col_accent[0].hue();

        if ((hue >= 0.2f) && (hue <= 0.6f)) {
            text_color = color(0, 0, 0);
            text_color_inverted = true;
        }
    }

    /// Background measures.
    const auto pos = vec2(render::m_screen_size.x - m_style.m_watermark_margins.x - (m_style.m_watermark_paddings.x * 2) - text_size.x, m_style.m_watermark_margins.y);
    const auto size = text_size + m_style.m_watermark_paddings * 2;

    const auto text_pos = pos + m_style.m_watermark_paddings;

    render::gradient(pos.x, pos.y, size.x, size.y, m_style.m_col_accent[0], m_style.m_col_accent[1]);

    /// Text shadow (if text isn't black).
    if (!text_color_inverted)
        render::text(text_pos.x + 1, text_pos.y + 1, font::tahoma_8, text, color(0, 0, 0, 200));
        /// 1 - shadow offset.

    render::text(text_pos.x, text_pos.y, font::tahoma_8, text, text_color);
}

void c_hud::draw_frame(const vec2& pos, const wstring& name, const std::vector<wstring>& first_column, const std::vector<wstring>& second_column) {
    /// Header label.
    auto text = name + L" (" + std::to_wstring(first_column.size()) + L")";

    /// Aayyaya initialization of variable, y value will be adjusted to all elements size.
            auto size = vec2(220, 0);

            auto line_pos = vec2(pos.x + m_style.m_pad_header_sides, pos.y + m_style.m_pad_header_top);
    const auto line_size = vec2(size.x - (m_style.m_pad_header_sides * 2), 4);

    const auto text_pos = vec2(line_pos.x + (line_size.x * 0.5f), line_pos.y);
    const auto text_size = render::measure_text(font::tahoma_8, text.c_str());

    const auto pad_text_line = text_size.y + 2;

    /// Adding little bit padding.
    line_pos.y += pad_text_line;

            auto base_pos = vec2(line_pos.x, line_pos.y + line_size.y + m_style.m_pad_header_bottom);
            auto base_size = vec2(line_size.x, (m_style.m_line_height * first_column.size()) + (m_style.m_pad_base * 2));

    /// Adjusted height of our crap.
    size.y += text_size.y + pad_text_line + line_size.y + m_style.m_pad_header_bottom + base_size.y;

    /// Outline measures.
    const auto outline_pos = pos - m_style.m_outline_size;
    const auto outline_size = size + (m_style.m_outline_size * 2);

    /// Outline.
    render::rect(outline_pos.x, outline_pos.y, outline_size.x, outline_size.y, m_style.m_col_outline);

    /// Beside outline.
    {
        /// Outer.
        render::outline(outline_pos.x - 1, outline_pos.y - 1, outline_size.x + 2, outline_size.y + 2, m_style.m_col_outer_outline);

        /// Inner.
        render::outline(outline_pos.x, outline_pos.y, outline_size.x, outline_size.y, m_style.m_col_inner_outline);
    }

    /// Inside outline.
    {
        const auto this_pos = outline_pos + m_style.m_outline_size;
        const auto this_size = outline_size - (m_style.m_outline_size * 2);

        /// Outer (also closet to base background, so render like it is).
        render::rect(this_pos.x, this_pos.y, this_size.x, this_size.y, m_style.m_col_outer_outline);

        /// Inner.
        render::outline(this_pos.x + 1, this_pos.y + 1, this_size.x - 2, this_size.y - 2, m_style.m_col_inner_outline);
    }

    /// Header.
    {
        /// Label shadow.
        render::text(text_pos.x + 1, text_pos.y + 1, font::tahoma_8, text.c_str(), color(0, 0, 0, 200), ALIGN_CENTER_X);

        /// Label.
        render::text(text_pos.x, text_pos.y, font::tahoma_8, text.c_str(), color(255, 255, 255, 200), ALIGN_CENTER_X);

        /// Base accent line.
        render::gradient(line_pos.x, line_pos.y, line_size.x, line_size.y, m_style.m_col_accent[0], m_style.m_col_accent[1]);

        /// Line shade.
        render::rect(line_pos.x, line_pos.y, line_size.x, line_size.y * 0.5f, color(255, 255, 255, 20));
    }

    /// Base.
    {
        /// Background.
        render::rect(base_pos.x, base_pos.y, base_size.x, base_size.y, m_style.m_col_base);

        /// Outer outline.
        render::outline(base_pos.x, base_pos.y, base_size.x, base_size.y, m_style.m_col_base_outer_outline);

        /// Inner outline.
        render::outline(base_pos.x + 1, base_pos.y + 1, base_size.x - 2, base_size.y - 2, m_style.m_col_base_inner_outline);

        /// Left column.
        if (!first_column.empty()) {
            /// C'mon, let's go.
            auto builder_pos = base_pos + m_style.m_pad_base;

            /// Ampersand imeni Platina300.
            for (const auto& item : first_column) {
                render::text(builder_pos.x, builder_pos.y, font::tahoma_8, item.c_str(), color(255, 255, 255, 200));

                builder_pos.y += m_style.m_line_height;
            }
        }

        /// Right column.
        if (!second_column.empty()) {
            /// C'mon, let's go.
            auto builder_pos = base_pos + m_style.m_pad_base;

            /// Right aligning text.
            builder_pos.x += base_size.x - (m_style.m_pad_base * 2);

            /// Ampersand imeni Platina300.
            for (const auto& item : second_column) {
                const auto text_size = render::measure_text(font::tahoma_8, item.c_str());

                /// Right aligning text.
                render::text(builder_pos.x - text_size.x, builder_pos.y, font::tahoma_8, item.c_str(), color(255, 255, 255, 200));

                builder_pos.y += m_style.m_line_height;
            }
        }
    }
}

void c_hud::draw_binds(const vec2& pos) {
    std::vector<wstring> binds_name;
    std::vector<wstring> binds_mode;

    if (true) {
        binds_name.emplace_back(L"а я еду suck");
        binds_mode.emplace_back(L"toggled");
    }
    if (true) {
        binds_name.emplace_back(L"suck some dick");
        binds_mode.emplace_back(L"disabled");
    }
    if (true) {
        binds_name.emplace_back(L"вокруг fucking slaves");
        binds_mode.emplace_back(L"fisting");
    }

    draw_frame(pos, L"binds", binds_name, binds_mode);
}

/// Simple spectators list.
void c_hud::draw_spectators(const vec2& pos) {
    if (!globals::local_player->is_alive())
        return;

    std::vector<wstring> spectators_name;

    for (auto i = 1u; i <= interfaces::globals->m_max_players; i++) {
        auto player = static_cast<c_cs_player*>(interfaces::entity_list->get_client_entity(i));
        if (!player)
            continue;

        if (player->m_spectating_target() != globals::local_player)
            continue;

        const auto info = player->get_info();

        //if (info.m_hltv || info.m_fake_player)
        //    continue;

        auto name = convert::to_unicode(info.m_name);

        std::transform(name.begin(), name.end(), name.begin(), towlower);

        spectators_name.emplace_back(name);
    }

    draw_frame(pos, L"spectators", spectators_name);
}

void c_hud::render() {
    /// Updating our accent color.
    update_accent_color();

    /// Change watermark options here.
    draw_watermark(USER | INCOMING | OUTGOING | TIME);

    draw_binds(vec2(1685, 60));

    draw_spectators(vec2(1685, 180));
}
C++:
#pragma once
#include "../../globals.h"

class c_hud : public singleton<c_hud> {
private:
    /// Elements accent color mode.
    enum e_color_mode {
        STATIC = 1, /// Just accent color
        RAINBOW,        /// Dynamic color
        GRADIENT    /// Gradient dynamic color
    };

    /// Watermark options to draw.
    enum e_watermark_options {
        NONE        = 0, /// Default argument, only logo will be drawn.
        USER        = (1 << 0), /// User name
        INCOMING = (1 << 1), /// Incoming latency (only in-game)
        OUTGOING = (1 << 2), /// Outgoing latency (only in-game)
        TIME        = (1 << 3)  /// Current Windows time
    };

    /// Color stuff.

    /// <summary> Returns color, based on current style. </summary>
    void update_accent_color();

    struct style_t {
        e_color_mode    m_col_mode = RAINBOW; /// Elements accent color mode.
        color                m_col_fallback = color(210, 150, 20, 200); /// Change your accent color here.
        color                m_col_accent[2]; /// Final color, will be used in elements rendering.

        /// Watermark stuff.
        vec2                m_watermark_paddings = vec2(5, 3);
        vec2                m_watermark_margins  = vec2(10, 10);

        /// Default elements stuff.
        size_t            m_outline_size            = 4; /// Main outline size (in pixels).
        size_t            m_line_height            = render::measure_text(font::tahoma_8, "A").y;

        size_t            m_pad_base                = 5;
        size_t            m_pad_header_top        = 6;
        size_t            m_pad_header_sides    = 6;
        size_t            m_pad_header_bottom    = 7;

        color                m_col_base                        = color(0, 0, 0);
        color                m_col_base_outer_outline    = color(0, 0, 0, 220);
        color                m_col_base_inner_outline    = color(255, 255, 255, 4);

        color                m_col_outline            = color(0, 0, 0, 200);
        color                m_col_outer_outline    = color(0, 0, 0, 220);
        color                m_col_inner_outline    = color(255, 255, 255, 8);
    } m_style;

    /// Elements rendering.

    /// <summary> Usage: draw_watermark(USER | OUTGOING | TIME) for user name, outgoing latency and time rendering. </summary>
    void draw_watermark    (uint8_t options = NONE);

    void draw_frame        (const vec2& pos, const wstring& name, const std::vector<wstring>& first_column, const std::vector<wstring>& second_column = {});
    void draw_binds        (const vec2& pos);
    void draw_spectators    (const vec2& pos);

public:
    /// <summary> Entry function. Should be called in d3dx9 or paint hook. </summary>
    void render();
};
Hidden content

FAQ YOU:

C++:
color == col_t
vec2 == vec2_t
wstring == std::wstring
string == std::string
math:: можно заменить на std::
hue() - https://github.com/DucaRii/csgo_modest/blob/master/shared/color/col_t.hpp#L99
measure_text(font, text) == get_text_size(font, text)
convert::to_unicode - https://github.com/lagcomp/wok-csgo-sdk-v2/blob/master/wok-csgo/utils/utils.h#L54
singleton - можете удалить, и вызывать с помощью c_hud::render()
не найден оператор для vec2 - https://github.com/DucaRii/csgo_modest/blob/master/shared/math/datatypes/vec2_t.hpp c+p
никак

[/ QUOTE]

looks great, but if you don't have a singleton, you can create a file and include it in the project.
have a nice day :)

C++:
#pragma once

template<typename T>
class singleton {
protected:
    singleton( ) { }
    ~singleton( ) { }

    singleton( const singleton& ) = delete;
    singleton& operator=( const singleton& ) = delete;

    singleton( singleton&& ) = delete;
    singleton& operator=( singleton&& ) = delete;
public:
    static T& get( ) {
        static T inst {};
        return inst;
    }
};
 
купить дизайн: yougame.biz/threads/155999
Дизайнер
Статус
Оффлайн
Регистрация
19 Сен 2018
Сообщения
793
Реакции[?]
1,380
Поинты[?]
9K
alpine971 ждем новый твой фейк, чтобы ты закончил мысль не только про синглетон, но и про щиткод ? ? ?
 
Сверху Снизу