Исходник Esp preview / drag and drop

Участник
Статус
Оффлайн
Регистрация
6 Апр 2021
Сообщения
343
Реакции[?]
216
Поинты[?]
122K
so many guys were hardworking on getting this to work, before all the comments about code appear yes i know the code is shit and hardcoded as hell, but it works decently , this was used in my old external cheat, known bugs: esp-preview alignment

video:
Пожалуйста, авторизуйтесь для просмотра ссылки.


esp-preview:
#include "../_control_inc.hpp"

evo::esp_builder_t::esp_builder_t( ) {
    /* constructor, initialize smth */
}

struct box_t {
    int x, y, w, h;
};

static bool item_is_getting_dragged[ 1000 ]{ false }, update_item{ false }, is_bar[ 6 ][ 64 ]{ false };
static int top_items{}, bottom_items{};
static std::vector<std::string> t_items, b_items, r_items, l_items;
static std::vector<std::string> bt_items, bb_items, br_items, bl_items;
static int elements_top, elements_bot, elements_rig, elements_lef;
static int belements_top, belements_bot, belements_rig, belements_lef;
static evo::vec2_t basic_size[ 64 ]{};

/* this is pretty much gheto */

void evo::esp_builder_t::paint() {
    // image scale.
    auto scale = 2.3f;

    // calculate sizes.
    auto image_size = ImVec2( 397 / scale, 700 / scale );

    // scale for original.
    int original_ = ( theme::rx - theme::orx ) / 4;
    int original_y = ( theme::ry - theme::ory ) / 2;

    std::vector<bool> esp_elements = {
        _cfg->name,
        _cfg->weapon,  
        _cfg->healthbar,
        _cfg->ammobar,
    };

    // player origin.
    box_t box;
    box.x = this->base_window.x + 25 + original_;
    box.y = this->base_window.y + 17 + original_y;
    box.w=397/scale;
    box.h = 700 / scale;

    // 0 - top
    // 1 - bottom

    std::vector<move_databse> area = {
        move_databse{evo::rect_t( this->base_window.x + 25 + original_, this->base_window.y - 8 + original_y, 397 / scale, 25 ), draggable_cond::c_top}, // up
        move_databse{evo::rect_t( this->base_window.x + 25 + original_, this->base_window.y + 17 + original_y + 700 / scale, 397 / scale, 25 ), draggable_cond::c_bottom}, // down
        move_databse{evo::rect_t( this->base_window.x + original_, this->base_window.y + 17 + original_y, 25, 700 / scale), draggable_cond::c_left}, // down
        move_databse{evo::rect_t( this->base_window.x + 25 + original_ + 397 / scale, this->base_window.y + 17 + original_y, 25, 700 / scale ), draggable_cond::c_right}, // down
    };

    static bool initiated[ 64 ]{ false };
    static vec2_t posx[ 64 ]{};

    {
        auto t_width = _render->text_size( "dutu1337", this->items.size( ) > 0 ? this->items[ 0 ].font : evo::fonts_t::_default2 );

        if ( !inited[ 0 ] ) {
            posx[ 0 ] = vec2_t( box.x + box.w * 0.5 - t_width.x * 0.5, box.y - 10 - ( t_width.y / 2 ) );
            inited[ 0 ] = true;
        }

        if ( theme::resizing || theme::dragging ) {
            posx[ 0 ] = vec2_t( box.x + box.w * 0.5 - t_width.x * 0.5, box.y - 10 - ( t_width.y / 2 ) );
        }

        auto name_esp = movable_item( "name_esp", posx[ 0 ],
                                      posx[ 0 ], 0, 0, 0 );

        this->items.push_back( name_esp );
    }

    {
        auto t_width = _render->text_size( "scar20", this->items.size() > 0 ? this->items[ 0 ].font : evo::fonts_t::_default2 );

        if ( !inited[ 1 ] ) {
            posx[ 1 ] = vec2_t( box.x + box.w * 0.5 - t_width.x * 0.5, box.y - 10 + box.h + ( t_width.y / 2 ) );
            inited[ 1 ] = true;
        }

        if ( theme::resizing || theme::dragging ) {
            posx[ 1 ] = vec2_t( box.x + box.w * 0.5 - t_width.x * 0.5, box.y - 10 + box.h + ( t_width.y / 2 ) );
        }

        auto weapon_esp = movable_item( "weapon_esp", posx[ 1 ],
                                        posx[ 1 ], 1, 0, 0 );

        this->items.push_back( weapon_esp );
    }

    {
        if ( !inited[ 2 ] ) {
            posx[ 2 ] = vec2_t( box.x - 8, box.y + 1 );
            basic_size[ 0 ] = { ( float )4, ( float )box.h - 1 };
            inited[ 2 ] = true;
        }

        if ( theme::resizing || theme::dragging ) {
            posx[ 2 ] = vec2_t( box.x - 8, box.y + 1 );
            basic_size[ 0 ] = { ( float )4, ( float )box.h - 1 };
        }

        auto healthbar = movable_item( "healthbar", posx[ 2 ],
                                       posx[ 2 ], 2, 0, 0 );

        this->items.push_back( healthbar );
    }

    {
        if ( !inited[ 3 ] ) {
            posx[ 3 ] = vec2_t( box.x + 1, box.y + box.h + 1 );
            basic_size[ 1 ] = { ( float )box.w - 1, ( float )4 };
            inited[ 3 ] = true;
        }

        if ( theme::resizing || theme::dragging ) {
            posx[ 3 ] = vec2_t( box.x + 1, box.y + box.h + 1 );
            basic_size[ 1 ] = { ( float )box.w - 1, ( float )4 };
        }

        auto ammobar = movable_item( "ammobar", posx[ 3 ],
                                     posx[ 3 ], 3, 0, 0 );

        this->items.push_back( ammobar );
    }

    {
        auto hk = movable_item( "hk", posx[ 4 ],
                                     posx[ 4 ], 4, 0, 0 );

        this->items.push_back( hk );

    }

    {
        auto hk = movable_item( "hk2", posx[ 4 ],
                                posx[ 4 ], 4, 0, 0 );

        this->items.push_back( hk );

    }

    {
        auto hk = movable_item( "hk3", posx[ 4 ],
                                posx[ 4 ], 4, 0, 0 );

        this->items.push_back( hk );

    }

    {
        auto hk = movable_item( "hk34", posx[ 4 ],
                                posx[ 4 ], 4, 0, 0 );

        this->items.push_back( hk );

    }

    {
        auto hk = movable_item( "hk343", posx[ 4 ],
                                posx[ 4 ], 4, 0, 0 );

        this->items.push_back( hk );

    }

#if 0
    // name font
    switch ( _cfg->name_font ) {
        case 0:
        {
            this->items[ 0 ].font = evo::fonts_t::_default2;
        } break;
        case 1:
        {
            this->items[ 0 ].font = evo::fonts_t::_default;
        } break;
        case 2:
        {
            this->items[ 0 ].font = evo::fonts_t::_fsmallest_pixel;
        } break;
    }

    switch ( _cfg->name_font ) {
        case 0:
        {
            this->items[ 1 ].font = evo::fonts_t::_default2;
        } break;
        case 1:
        {
            this->items[ 1 ].font = evo::fonts_t::_default;
        } break;
        case 2:
        {
            this->items[ 1 ].font = evo::fonts_t::_fsmallest_pixel;
        } break;
    }

    int tbr, tbt, tbl, tbb;
    tbr = ( is_bar[ draggable_cond::c_right ][ 0 ] ? 8 : 0 ) + ( is_bar[ draggable_cond::c_right ][ 1 ] ? 8 : 0 );
    tbt = ( is_bar[ draggable_cond::c_top ][ 0 ] ? 8 : 0 ) + ( is_bar[ draggable_cond::c_top ][ 1 ] ? 8 : 0 );
    tbl = ( is_bar[ draggable_cond::c_left ][ 0 ] ? 8 : 0 ) + ( is_bar[ draggable_cond::c_left ][ 1 ] ? 8 : 0 );
    tbb = ( is_bar[ draggable_cond::c_bottom ][ 0 ] ? 8 : 0 ) + ( is_bar[ draggable_cond::c_bottom ][ 1 ] ? 8 : 0 );

    if ( esp_elements[ 0 ] ) {
        auto t_width = _render->text_size( "dutu1337", this->items[ 0 ].font );

        /* input */
        if ( _input->mouse_in_box( vec2_t( this->items[ 0 ].temp_pos.x, this->items[ 0 ].temp_pos.y ), vec2_t( t_width.x, t_width.y ) ) ) {
            if ( GetAsyncKeyState( VK_LBUTTON ) ) {
                item_is_getting_dragged[ 0 ] = true;
            }
        }

        /* reupdate */
        static int updated = ( theme::rx - theme::orx );

        if ( item_is_getting_dragged[ 0 ] ) {
            this->items[ 0 ].temp_pos.x = _input->get_mouse_position( ).x;
            this->items[ 0 ].temp_pos.y = _input->get_mouse_position( ).y;

            this->items[ 0 ].basic_pos.x = this->items[ 0 ].temp_pos.x;
            this->items[ 0 ].basic_pos.y = this->items[ 0 ].temp_pos.y;

            for ( int _area = 0; _area < area.size( ); _area++ ) {
                if ( _input->mouse_in_box( vec2_t( area[ _area ].rect.x, area[ _area ].rect.y ), vec2_t( area[ _area ].rect.w, area[ _area ].rect.h ) ) && !GetAsyncKeyState( VK_LBUTTON ) ) {
                    printf( "in area\n" );
                    t_items.clear( );
                    b_items.clear( );
                    l_items.clear( );
                    r_items.clear( );

                    this->items[ 0 ].drag_cond = ( int )area[ _area ].condition;

                    box.x = this->base_window.x + 25 + original_;
                    box.y = this->base_window.y + 17 + original_y;

                    if ( this->items[ 0 ].drag_cond == draggable_cond::c_top ) {
                        this->items[ 0 ].temp_pos = { ( float )( box.x + box.w * 0.5 - t_width.x * 0.5 ), ( float )( box.y - 10 - tbt - ( t_width.y / 2 ) ) };
                        t_items.push_back( "name" );

                        theme::cond_id[0] = draggable_cond::c_top;
                    } else if ( this->items[ 0 ].drag_cond == draggable_cond::c_bottom ) {
                        this->items[ 0 ].temp_pos = { ( float )( box.x + box.w * 0.5 - t_width.x * 0.5 ), ( float )( box.y - 10 + box.h + tbb + ( t_width.y / 2 ) ) };
                        b_items.push_back( "name" );

                        theme::cond_id[ 0 ] = draggable_cond::c_bottom;
                    } else if ( this->items[ 0 ].drag_cond == draggable_cond::c_left ) {
                        this->items[ 0 ].temp_pos = { ( float )( box.x - t_width.x - 2 - tbl ), ( float )( box.y - 10 + ( t_width.y / 2 ) + 2 ) };
                        l_items.push_back( "name" );

                        theme::cond_id[ 0 ] = draggable_cond::c_left;
                    } else if ( this->items[ 0 ].drag_cond == draggable_cond::c_right ) {
                        this->items[ 0 ].temp_pos = { ( float )( box.x + box.w + 2 + tbr ), ( float )( box.y - 10 + ( t_width.y / 2 ) + 2 ) };
                        r_items.push_back( "name" );

                        theme::cond_id[ 0 ] = draggable_cond::c_right;
                    }

                    this->items[ 0 ].basic_pos.x = this->items[ 0 ].temp_pos.x;
                    this->items[ 0 ].basic_pos.y = this->items[ 0 ].temp_pos.y;

                    posx[ 0 ] = this->items[ 0 ].temp_pos;

                    item_is_getting_dragged[ 0 ] = false;
                    update_item = true;
                }
            }
        }

        _render->add_text( this->items[ 0 ].basic_pos.x, this->items[ 0 ].basic_pos.y, col_t( ), this->items[ 0 ].font, "dutu1337" );
        /* main system
            it starts now */
    }

    auto ww = _render->text_size( "scar20", this->items[ 0 ].font );

    //std::cout << std::to_string( t_items.size( ) ) << std::endl;
    elements_top = ( t_items.size( ) * ww.y ) + tbt;
    elements_bot = ( b_items.size( ) * ww.y ) + tbb;
    elements_rig = ( r_items.size( ) * ww.y );
    elements_lef = ( l_items.size( ) * ww.y );

    if ( esp_elements[ 1 ] ) {
        auto t_width = _render->text_size( "scar20", this->items[ 0 ].font );

        /* input */
        if ( _input->mouse_in_box( vec2_t( this->items[ 1 ].temp_pos.x, this->items[ 1 ].temp_pos.y ), vec2_t( t_width.x, t_width.y ) ) ) {
            if ( GetAsyncKeyState( VK_LBUTTON ) ) {
                item_is_getting_dragged[ 1 ] = true;
            }
        }

        /* reupdate */
        static int updated = ( theme::rx - theme::orx );

        int id = 1;

        if ( item_is_getting_dragged[ 1 ] ) {
            this->items[ id ].temp_pos.x = _input->get_mouse_position( ).x;
            this->items[ id ].temp_pos.y = _input->get_mouse_position( ).y;

            this->items[ id ].basic_pos.x = this->items[ id ].temp_pos.x;
            this->items[ id ].basic_pos.y = this->items[ id ].temp_pos.y;

            for ( int _area = 0; _area < area.size( ); _area++ ) {
                if ( _input->mouse_in_box( vec2_t( area[ _area ].rect.x, area[ _area ].rect.y ), vec2_t( area[ _area ].rect.w, area[ _area ].rect.h ) ) && !GetAsyncKeyState( VK_LBUTTON ) ) {
                    printf( "in area\n" );

                    this->items[ id ].drag_cond = ( int )area[ _area ].condition;

                    box.x = this->base_window.x + 25 + original_;
                    box.y = this->base_window.y + 17 + original_y;

                    if ( this->items[ id ].drag_cond == draggable_cond::c_top ) {
                        this->items[ id ].temp_pos = { ( float )( box.x + box.w * 0.5 - t_width.x * 0.5 ), ( float )( box.y - 10 - elements_top - ( t_width.y / 2 ) ) };
                        theme::cond_id[ 1 ] = draggable_cond::c_top;
                    } else if ( this->items[ id ].drag_cond == draggable_cond::c_bottom ) {
                        this->items[ id ].temp_pos = { ( float )( box.x + box.w * 0.5 - t_width.x * 0.5 ), ( float )( box.y - 10 + box.h + elements_bot + ( t_width.y / 2 ) ) };
                        theme::cond_id[ 1 ] = draggable_cond::c_bottom;
                    } else if ( this->items[ id ].drag_cond == draggable_cond::c_left ) {
                        this->items[ id ].temp_pos = { ( float )( box.x - t_width.x - 2 - tbl ), ( float )( box.y - 10 + elements_lef + ( t_width.y / 2 ) + 2 ) };
                        theme::cond_id[ 1 ] = draggable_cond::c_left;
                    } else if ( this->items[ id ].drag_cond == draggable_cond::c_right ) {
                        this->items[ id ].temp_pos = { ( float )( box.x + box.w + 2 + tbr ), ( float )( box.y - 10 + elements_rig + ( t_width.y / 2 ) + 2 ) };
                        theme::cond_id[ 1 ] = draggable_cond::c_right;
                    }

                    this->items[ id ].basic_pos.x = this->items[ id ].temp_pos.x;
                    this->items[ id ].basic_pos.y = this->items[ id ].temp_pos.y;

                    posx[ 1 ] = this->items[ id ].temp_pos;

                    item_is_getting_dragged[ 1 ] = false;
                    update_item = true;
                }
            }
        }

        _render->add_text( this->items[ id ].basic_pos.x, this->items[ id ].basic_pos.y, col_t( ), this->items[ 0 ].font, "scar20" );
        /* main system
            it starts now */
    }

    if ( esp_elements[ 2 ] ) {
        auto t_width = _render->text_size( "scar20", this->items[ 0 ].font );

        /* input */
        if ( _input->mouse_in_box( vec2_t( this->items[ 2 ].temp_pos.x, this->items[ 2 ].temp_pos.y ), vec2_t( basic_size[ 0 ].x, basic_size[ 0 ].y ) ) ) {
            if ( GetAsyncKeyState( VK_LBUTTON ) ) {
                item_is_getting_dragged[ 2 ] = true;
            }
        }

        /* reupdate */
        static int updated = ( theme::rx - theme::orx );

        int id = 2;

        if ( item_is_getting_dragged[ 2 ] ) {
            this->items[ id ].temp_pos.x = _input->get_mouse_position( ).x;
            this->items[ id ].temp_pos.y = _input->get_mouse_position( ).y;

            this->items[ id ].basic_pos.x = this->items[ id ].temp_pos.x;
            this->items[ id ].basic_pos.y = this->items[ id ].temp_pos.y;

            for ( int _area = 0; _area < area.size( ); _area++ ) {
                if ( _input->mouse_in_box( vec2_t( area[ _area ].rect.x, area[ _area ].rect.y ), vec2_t( area[ _area ].rect.w, area[ _area ].rect.h ) ) && !GetAsyncKeyState( VK_LBUTTON ) ) {
                    printf( "in area\n" );

                    bt_items.clear( );
                    bb_items.clear( );
                    bl_items.clear( );
                    br_items.clear( );

                    this->items[ id ].drag_cond = ( int )area[ _area ].condition;

                    box.x = this->base_window.x + 25 + original_;
                    box.y = this->base_window.y + 17 + original_y;

                    if ( this->items[ id ].drag_cond == draggable_cond::c_top ) {
                        this->items[ id ].temp_pos = vec2_t( box.x + 1, box.y - 8 );
                        basic_size[ 0 ] = { ( float )box.w - 1, ( float )4 };
                        is_bar[ draggable_cond::c_top ][ 0 ] = true;
                        is_bar[ draggable_cond::c_bottom ][ 0 ] = false;
                        is_bar[ draggable_cond::c_left ][ 0 ] = false;
                        is_bar[ draggable_cond::c_right ][ 0 ] = false;

                        theme::cond_id[ 2 ] = draggable_cond::c_top;

                        bt_items.push_back( "healthbar" );
                    } else if ( this->items[ id ].drag_cond == draggable_cond::c_bottom ) {
                        this->items[ id ].temp_pos = vec2_t( box.x + 1, box.y + box.h + 3 );
                        basic_size[ 0 ] = { ( float )box.w - 1, ( float )4 };
                        is_bar[ draggable_cond::c_top ][ 0 ] = false;
                        is_bar[ draggable_cond::c_bottom ][ 0 ] = true;
                        is_bar[ draggable_cond::c_left ][ 0 ] = false;
                        is_bar[ draggable_cond::c_right ][ 0 ] = false;

                        theme::cond_id[ 2 ] = draggable_cond::c_bottom;

                        bb_items.push_back( "healthbar" );
                    } else if ( this->items[ id ].drag_cond == draggable_cond::c_left ) {
                        this->items[ id ].temp_pos = vec2_t( box.x - 8, box.y + 1 );
                        basic_size[ 0 ] = { ( float )4, ( float )box.h - 1 };
                        is_bar[ draggable_cond::c_top ][ 0 ] = false;
                        is_bar[ draggable_cond::c_bottom ][ 0 ] = false;
                        is_bar[ draggable_cond::c_left ][ 0 ] = true;
                        is_bar[ draggable_cond::c_right ][ 0 ] = false;

                        theme::cond_id[ 2 ] = draggable_cond::c_left;

                        bl_items.push_back( "healthbar" );
                    } else if ( this->items[ id ].drag_cond == draggable_cond::c_right ) {
                        this->items[ id ].temp_pos = { ( float )( box.x + box.w + 2 ), ( float )( box.y - 10 + ( t_width.y / 2 ) + 2 ) };
                        basic_size[ 0 ] = { ( float )4, ( float )box.h - 1 };
                        is_bar[ draggable_cond::c_top ][ 0 ] = false;
                        is_bar[ draggable_cond::c_bottom ][ 0 ] = false;
                        is_bar[ draggable_cond::c_left ][ 0 ] = false;
                        is_bar[ draggable_cond::c_right ][ 0 ] = true;

                        theme::cond_id[ 2 ] = draggable_cond::c_right;

                        br_items.push_back( "healthbar" );
                    }


                    this->items[ id ].basic_pos.x = this->items[ id ].temp_pos.x;
                    this->items[ id ].basic_pos.y = this->items[ id ].temp_pos.y;

                    posx[ 2 ] = this->items[ id ].temp_pos;

                    item_is_getting_dragged[ 2 ] = false;
                    update_item = true;
                }
            }
        }

        _render->add_rect_filled( this->items[ 2 ].basic_pos.x, this->items[ 2 ].basic_pos.y, basic_size[ 0 ].x, basic_size[ 0 ].y, col_t( 0, 0, 0, 150 ), 0 );
        _render->add_rect_filled( this->items[ 2 ].basic_pos.x + 1, this->items[ 2 ].basic_pos.y + 1, basic_size[ 0 ].x - 2, basic_size[ 0 ].y - 2, col_t( 0, 255, 0, 255 ), 0 );
        //_render->add_text( this->items[ id ].basic_pos.x, this->items[ id ].basic_pos.y, col_t( ), this->items[ 0 ].font, "scar20" );
        /* main system
            it starts now */
    }

    belements_top = ( bt_items.size( ) * 6 );
    belements_bot = ( bb_items.size( ) * 6 );
    belements_rig = ( br_items.size( ) * 6 );
    belements_lef = ( bl_items.size( ) * 6 );

    if ( esp_elements[ 3 ] ) {
        auto t_width = _render->text_size( "scar20", this->items[ 0 ].font );

        /* input */
        if ( _input->mouse_in_box( vec2_t( this->items[ 3 ].temp_pos.x, this->items[ 3 ].temp_pos.y ), vec2_t( basic_size[ 1 ].x, basic_size[ 1 ].y ) ) ) {
            if ( GetAsyncKeyState( VK_LBUTTON ) ) {
                item_is_getting_dragged[ 3 ] = true;
            }
        }

        /* reupdate */
        static int updated = ( theme::rx - theme::orx );

        int id = 3;

        if ( item_is_getting_dragged[ id ] ) {
            this->items[ id ].temp_pos.x = _input->get_mouse_position( ).x;
            this->items[ id ].temp_pos.y = _input->get_mouse_position( ).y;

            this->items[ id ].basic_pos.x = this->items[ id ].temp_pos.x;
            this->items[ id ].basic_pos.y = this->items[ id ].temp_pos.y;

            for ( int _area = 0; _area < area.size( ); _area++ ) {
                if ( _input->mouse_in_box( vec2_t( area[ _area ].rect.x, area[ _area ].rect.y ), vec2_t( area[ _area ].rect.w, area[ _area ].rect.h ) ) && !GetAsyncKeyState( VK_LBUTTON ) ) {
                    printf( "in area\n" );

                    this->items[ id ].drag_cond = ( int )area[ _area ].condition;

                    box.x = this->base_window.x + 25 + original_;
                    box.y = this->base_window.y + 17 + original_y;

                    if ( this->items[ id ].drag_cond == draggable_cond::c_top ) {
                        this->items[ id ].temp_pos = vec2_t( box.x + 1, box.y - 8 - belements_top );
                        basic_size[ 1 ] = { ( float )box.w - 1, ( float )4 };
                        is_bar[ draggable_cond::c_top ][ 1 ] = true;
                        is_bar[ draggable_cond::c_bottom ][ 1 ] = false;
                        is_bar[ draggable_cond::c_left ][ 1 ] = false;
                        is_bar[ draggable_cond::c_right ][ 1 ] = false;

                        theme::cond_id[ 3 ] = draggable_cond::c_top;
                    } else if ( this->items[ id ].drag_cond == draggable_cond::c_bottom ) {
                        this->items[ id ].temp_pos = vec2_t( box.x + 1, box.y + box.h + 3 + belements_bot );
                        basic_size[ 1 ] = { ( float )box.w - 1, ( float )4 };
                        is_bar[ draggable_cond::c_top ][ 1 ] = false;
                        is_bar[ draggable_cond::c_bottom ][ 1 ] = true;
                        is_bar[ draggable_cond::c_left ][ 1 ] = false;
                        is_bar[ draggable_cond::c_right ][ 1 ] = false;

                        theme::cond_id[ 3 ] = draggable_cond::c_bottom;
                    } else if ( this->items[ id ].drag_cond == draggable_cond::c_left ) {
                        this->items[ id ].temp_pos = vec2_t( box.x - 8 - belements_lef, box.y + 1 );
                        basic_size[ 1 ] = { ( float )4, ( float )box.h - 1 };
                        is_bar[ draggable_cond::c_top ][ 1 ] = false;
                        is_bar[ draggable_cond::c_bottom ][ 1 ] = false;
                        is_bar[ draggable_cond::c_left ][ 1 ] = true;
                        is_bar[ draggable_cond::c_right ][ 1 ] = false;

                        theme::cond_id[ 3 ] = draggable_cond::c_left;
                    } else if ( this->items[ id ].drag_cond == draggable_cond::c_right ) {
                        this->items[ id ].temp_pos = { ( float )( box.x + box.w + 2 + belements_rig ), ( float )( box.y - 10 + ( t_width.y / 2 ) + 2 ) };
                        basic_size[ 1 ] = { ( float )4, ( float )box.h - 1 };
                        is_bar[ draggable_cond::c_top ][ 1 ] = false;
                        is_bar[ draggable_cond::c_bottom ][ 1 ] = false;
                        is_bar[ draggable_cond::c_left ][ 1 ] = false;
                        is_bar[ draggable_cond::c_right ][ 1 ] = true;

                        theme::cond_id[ 3 ] = draggable_cond::c_right;
                    }


                    this->items[ id ].basic_pos.x = this->items[ id ].temp_pos.x;
                    this->items[ id ].basic_pos.y = this->items[ id ].temp_pos.y;

                    posx[ id ] = this->items[ id ].temp_pos;

                    item_is_getting_dragged[ id ] = false;
                    update_item = true;
                }
            }
        }

        _render->add_rect_filled( this->items[ id ].basic_pos.x, this->items[ id ].basic_pos.y, basic_size[ 1 ].x, basic_size[ 1 ].y, col_t( 0, 0, 0, 150 ), 0 );
        _render->add_rect_filled( this->items[ id ].basic_pos.x + 1, this->items[ id ].basic_pos.y + 1, basic_size[ 1 ].x - 2, basic_size[ 1 ].y - 2, col_t( 120, 167, 255, 255 ), 0 );
        //_render->add_text( this->items[ id ].basic_pos.x, this->items[ id ].basic_pos.y, col_t( ), this->items[ 0 ].font, "scar20" );
        /* main system
            it starts now */
    }


    if ( item_is_getting_dragged[ 0 ] || item_is_getting_dragged[ 1 ] || item_is_getting_dragged[ 2 ] || item_is_getting_dragged[ 3 ] ) {
        if ( area[ 0 ].condition == draggable_cond::c_top ) {
            _render->add_gradient_horizontal( area[ 0 ].rect.x, area[ 0 ].rect.y,
                                              area[ 0 ].rect.w, area[ 0 ].rect.h, _container->window_accent.modify_alpha( 0 ), _container->window_accent.modify_alpha( 100 ), 0 );

        }

        if ( area[ 1 ].condition == draggable_cond::c_bottom ) {
            _render->add_gradient_horizontal( area[ 1 ].rect.x, area[ 1 ].rect.y,
                                              area[ 1 ].rect.w, area[ 1 ].rect.h, _container->window_accent.modify_alpha( 100 ), _container->window_accent.modify_alpha( 0 ), 0 );

        }

        if ( area[ 2 ].condition == draggable_cond::c_left ) {
            _render->add_gradient_vertical( area[ 2 ].rect.x, area[ 2 ].rect.y,
                                            area[ 2 ].rect.w, area[ 2 ].rect.h, _container->window_accent.modify_alpha( 0 ), _container->window_accent.modify_alpha( 100 ), 0 );

        }

        if ( area[ 3 ].condition == draggable_cond::c_right ) {
            _render->add_gradient_vertical( area[ 3 ].rect.x, area[ 3 ].rect.y,
                                            area[ 3 ].rect.w, area[ 3 ].rect.h, _container->window_accent.modify_alpha( 100 ), _container->window_accent.modify_alpha( 0 ), 0 );

        }
    }
#endif

    theme::item_data = this->items;
}

void evo::esp_builder_t::input( ) {

}

void evo::esp_builder_t::set_font( int element_id, int font ) {
    this->items[ element_id ].font = font;
}

void evo::esp_builder_t::reset_position( ) {

}
esp-preview.hpp:
#pragma once

namespace evo {
    enum draggable_cond : int {
        c_left = 0,
        c_right = 1,
        c_top = 2,
        c_bottom = 3,
        c_center = 4,
        c_pool = 5,
        c_in_move = 6
    };

    enum items_esp {
        name_esp
    };

    enum item_type {
        text,
        bar
    };

    struct move_databse {
        evo::rect_t rect;
        draggable_cond condition;
    };

    struct movable_item {
        std::string item_name{};
        vec2_t temp_pos{}, basic_pos{};

        int item_id{}, drag_cond{ 4 }, item_type{ }, font{ 1 };

        movable_item( std::string item_name, vec2_t& temp_pos, vec2_t& basic_pos, int item_id, int drag_cond, int item_type ) {
            this->item_name = item_name;
            this->temp_pos = temp_pos;
            this->basic_pos = basic_pos;
            this->item_id = item_id;
            this->drag_cond = drag_cond;
            this->item_type = item_type;
        }
    };

    class esp_builder_t {
    public:
        esp_builder_t( );
    public:
        void paint( );
        void input( );
        void set_font( int element_id, int font );
        void reset_position( );
    public:
        evo::vec2_t base_window{};
        std::vector<movable_item> items{};
    private:

    };
}

container:
/* theme and shit */
    namespace theme {
        /* ints */
        inline int selected_tab{}, selected_subtab{ }, orx{ 570 }, ory{ 530 }, rx{ 570 }, ry{ 530 };

        inline bool dragging{}, resizing{};
        inline bool colorpicker_is_opened{};
        inline IDirect3DDevice9* blur_device{};

        inline int cond_id[ 64 ]{};

        inline std::vector< movable_item > item_data{};

        inline col_t copied_color{};

        /* vec2 */
        inline vec2_t menu_spawn{ 100, 100 }, menu_size{ 570, 530 };
    }

usage/implementation:
int get_info_t( int index, int bar_size ) {
    return ( is_bt[ index ] ? bar_size : 0 );
}

int get_info_r( int index, int bar_size ) {
    return ( is_br[ index ] ? bar_size : 0 );
}

int get_info_b( int index, int bar_size ) {
    return ( is_bb[ index ] ? bar_size : 0 );
}

int get_info_l( int index, int bar_size ) {
    return ( is_bl[ index ] ? bar_size : 0 );
}

int evo::esp_t::get_text_info_t( bool value, int index ) {
    int text_height = evo::_esp->font_height[index];
    return ( is_tt[ index ] && value ? text_height : 0 );
}

int evo::esp_t::get_text_info_r( bool value, int index ) {
    int text_height = evo::_esp->font_height[ index ];
    return ( is_tr[ index ] ? text_height : 0 );
}

int evo::esp_t::get_text_info_b( bool value, int index ) {
    int text_height = evo::_esp->font_height[ index ];
    return ( is_tb[ index ] ? text_height : 0 );
}

int evo::esp_t::get_text_info_l( bool value, int index ) {
    int text_height = evo::_esp->font_height[ index ];
    return ( is_tl[ index ] ? text_height : 0 );
}

void evo::esp_t::iterate_esp( ) {
    static int cursor = _render->text_size( "smth", evo::fonts_t::_default ).y + 5;

    this->elm_top = get_info_t( 0, 6 ) + get_info_t( 1, 6 );
    this->elm_bottom = get_info_b( 0, 6 ) + get_info_b( 1, 6 );
    this->elm_right = get_info_r( 0, 6 ) + get_info_r( 1, 6 );
    this->elm_left = get_info_l( 0, 6 ) + get_info_l( 1, 6 );

    this->elm_top2 = get_text_info_t( _cfg->name, 0 ) + get_text_info_t( _cfg->weapon, 1 ) + get_text_info_t( _cfg->pl_flag[ 0 ],2 );
    this->elm_bottom2 = get_text_info_b( _cfg->name, 0 ) + get_text_info_b( _cfg->weapon, 1 ) + get_text_info_b( _cfg->pl_flag[ 0 ],2 );
    this->elm_right2 = get_text_info_r( _cfg->name, 0 ) + get_text_info_r( _cfg->weapon, 1 ) + get_text_info_r( _cfg->pl_flag[ 0 ],2 );
    this->elm_left2 = get_text_info_l( _cfg->name, 0 ) + get_text_info_l( _cfg->weapon, 1 ) + get_text_info_l( _cfg->pl_flag[ 0 ],2 );

    for ( int i = 0; i < _ent_cache->cached_entity.size( ); i++ ) {
        this->box = this->grab_bounding_data( _ent_cache->cached_entity[ i ] );

        this->get_animation_data( _ent_cache->cached_entity[ i ] );

        if ( _cfg->box ) {
            this->draw_box( _ent_cache->cached_entity[ i ] );
        }

        if ( _cfg->name ) {
            this->draw_name( _ent_cache->cached_entity[ i ] );
        }

        if ( _cfg->healthbar ) {
            this->draw_healthbar( _ent_cache->cached_entity[ i ] );
        }

        if ( _cfg->skeleton ) {
            this->draw_skeleton( _ent_cache->cached_entity[ i ] );
        }

        if ( _cfg->ammobar ) {
            this->draw_ammo( _ent_cache->cached_entity[ i ] );
        }

        if ( _cfg->weapon ) {
            this->draw_weapon_name( _ent_cache->cached_entity[ i ] );
        }

        if ( _cfg->pl_flag[ 0 ] ) {
            this->draw_armor_flag( _ent_cache->cached_entity[ i ] );
        }

        if ( _cfg->pl_flag[ 1 ] ) {
            this->draw_defuser_flag( _ent_cache->cached_entity[ i ] );
        }

        if ( _cfg->pl_flag[ 2 ] ) {
            this->draw_money_flag( _ent_cache->cached_entity[ i ] );
        }

        if ( _cfg->pl_flag[ 3 ] ) {
            this->draw_scoped_flag( _ent_cache->cached_entity[ i ] );
        }

        if ( _cfg->pl_flag[ 4 ] ) {
            this->draw_lethal_flag( _ent_cache->cached_entity[ i ] );
        }

        /* store
            -> the point is to avoid reading memory unecesarry, you could've used ent_idx : 0x1544, but a read more */
        this->ent_idx = i;
    }
}

__forceinline void evo::esp_t::draw_name( const c_entity& entity ) {
    /* player name */
    std::string player_name = entity.controler.player_name;

    static bool a{ false }, b{ false }, c{ false }, d{ false };
    static bool init{ false };

    if ( !init ) {
        a = true;
        b = false;
        c = false;
        d = false;

        theme::cond_id[ 0 ] = 2;

        init = true;
    }

    if ( theme::cond_id[ 0 ] == draggable_cond::c_top ) {
        a = true;
        b = false;
        c = false;
        d = false;

        is_tt[ 0 ] = true;
        is_tb[ 0 ] = false;
        is_tl[ 0 ] = false;
        is_tr[ 0 ] = false;
    } else if ( theme::cond_id[ 0 ] == draggable_cond::c_bottom ) {
        a = false;
        b = true;
        c = false;
        d = false;

        is_tt[ 0 ] = false;
        is_tb[ 0 ] = true;
        is_tl[ 0 ] = false;
        is_tr[ 0 ] = false;
    } else if ( theme::cond_id[ 0 ] == draggable_cond::c_left ) {
        a = false;
        b = false;
        c = true;
        d = false;

        is_tt[ 0 ] = false;
        is_tb[ 0 ] = false;
        is_tl[ 0 ] = true;
        is_tr[ 0 ] = false;
    } else if ( theme::cond_id[ 0 ] == draggable_cond::c_right ) {
        a = false;
        b = false;
        c = false;
        d = true;

        is_tt[ 0 ] = false;
        is_tb[ 0 ] = false;
        is_tl[ 0 ] = false;
        is_tr[ 0 ] = true;
    }

    switch ( _cfg->name_font ) {
        case 0:
        {
            theme::item_data[ 0 ].font = evo::fonts_t::_default2;
        } break;
        case 1:
        {
            theme::item_data[ 0 ].font = evo::fonts_t::_default;
        } break;
        case 2:
        {
            theme::item_data[ 0 ].font = evo::fonts_t::_fsmallest_pixel;
        } break;
    }

    /* text sizes */
    int text_width = evo::_render->text_size( player_name.c_str( ), theme::item_data[ 0 ].font ).x;
    int text_height = evo::_render->text_size( player_name.c_str( ), theme::item_data[ 0 ].font ).y;

    /* set this */
    this->font_height[ 0 ] = text_height;

    auto m_col = _cfg->name_color.modify_alpha( 255 * this->pl_anim );

    auto flags = ( _cfg->name_flags[ 0 ] ?
                   ( _cfg->dropshadow_type_name == 0 ? evo::font_flags_t::dropshadow : evo::font_flags_t::dropshadow_low ) : 0 ) | ( _cfg->name_flags[ 1 ] ? evo::font_flags_t::outline : 0 );

    /* retaded ik */
    if ( a ) {
        evo::_render->add_text(
            this->box.x + ( this->box.w * 0.5 ) - ( text_width * 0.5 ), this->box.y - this->elm_top - text_height - ( _cfg->name_font == 2 ? 3 : 5 ), m_col, theme::item_data[ 0 ].font,
            player_name.c_str( ), flags
        );
    } else if ( b ) {
        evo::_render->add_text(
            this->box.x + this->box.w * 0.5 - text_width * 0.5, this->box.y + this->box.h + this->elm_bottom + ( text_height * 0.5 ) - 3, m_col, theme::item_data[ 0 ].font,
            player_name.c_str( ), flags
        );
    } else if ( c ) {
        evo::_render->add_text(
            this->box.x - this->elm_left - text_width - 3, this->box.y - 1, m_col, theme::item_data[ 0 ].font,
            player_name.c_str( ), flags
        );
    } else if ( d ) {
        evo::_render->add_text(
            this->box.x + this->elm_right + this->box.w + 3, this->box.y - 1, m_col, theme::item_data[ 0 ].font,
            player_name.c_str( ), flags
        );
    }
}
 
Сверху Снизу