Исходник Way to equal the space between tabs

Участник
Статус
Оффлайн
Регистрация
6 Апр 2021
Сообщения
338
Реакции[?]
207
Поинты[?]
113K
Код:
i saw so many guys that dont know how do equalize the spacing between each tab
Код:
        sdk::c_function c_object_form::init_dep_tabs( ) {
            auto form_id{ 0 };
            float tab_specific_size{};
            int tab_spacing = 10; /* set the spacing between tabs*/

            /* calculate the total width of all tabs */
            int total_tabs_width = 0;
            for ( auto& form_tabs : tabs ) {
                auto tab_size = sdk::drawing::get_text_size( form_tabs.title.c_str( ), sdk::drawing::c_fonts::verdana );

                /* tab specific size */
                if ( form_tabs.title == "rage" ) {
                    tab_specific_size = sdk::drawing::get_text_size( "rage", sdk::drawing::c_fonts::verdana ).x;
                } else if ( form_tabs.title == "visuals" ) {
                    tab_specific_size = sdk::drawing::get_text_size( "visuals", sdk::drawing::c_fonts::verdana ).x;
                } else if ( form_tabs.title == "misc" ) {
                    tab_specific_size = sdk::drawing::get_text_size( "misc", sdk::drawing::c_fonts::verdana ).x;
                } else if ( form_tabs.title == "skins" ) {
                    tab_specific_size = sdk::drawing::get_text_size( "skins", sdk::drawing::c_fonts::verdana ).x;
                } else if ( form_tabs.title == "profile" ) {
                    tab_specific_size = sdk::drawing::get_text_size( "profile", sdk::drawing::c_fonts::verdana ).x;
                }

                total_tabs_width += tab_size.x;
            }

            /* calculate the total width of all spaces between tabs */
            int total_spacing_width = ( tabs.size( ) - 1 ) * tab_spacing;

            /* calculate the initial starting position for the tabs */
            int start_x = this->pos.x + ( this->size.x - total_tabs_width + total_spacing_width ) - total_spacing_width - 50;

            for ( auto& form_tabs : tabs ) {   
                auto tab_size = sdk::drawing::get_text_size( form_tabs.title.c_str( ), sdk::drawing::c_fonts::verdana );

                sdk::color::col_t col = this->selected_tab == form_id ? this->dependency( ).panel_colors[ color_palete::accent ].modify_alpha( 225 * open_menu_a ) : this->dependency( ).panel_colors[ color_palete::text ].modify_alpha( 150 * open_menu_a );
                sdk::drawing::text(
                    start_x, this->pos.y + 4,
                    col, sdk::drawing::c_fonts::verdana, form_tabs.title.c_str( ), true
                );

                if ( sdk::c_input->is_in_box( { ( float )start_x, this->pos.y + 4 }, { tab_specific_size, ( float )15 } ) && sdk::c_input->was_key_pressed( 0x01 ) )
                    this->selected_tab = form_id;

                /* increase the startX for the next tab */
                start_x += tab_size.x + tab_spacing;

                /* increase the form_id */
                form_id++;
            }
        }
1691919433089.png
 
Ревёрсер среднего звена
Пользователь
Статус
Оффлайн
Регистрация
24 Ноя 2022
Сообщения
303
Реакции[?]
107
Поинты[?]
56K
c_ignoring c_your c_mental c_illness,
if ( form_tabs.title == "rage" ) { tab_specific_size = sdk::drawing::get_text_size( "rage", sdk::drawing::c_fonts::verdana ).x; } else if ( form_tabs.title == "visuals" ) { tab_specific_size = sdk::drawing::get_text_size( "visuals", sdk::drawing::c_fonts::verdana ).x; } else if ( form_tabs.title == "misc" ) { tab_specific_size = sdk::drawing::get_text_size( "misc", sdk::drawing::c_fonts::verdana ).x; } else if ( form_tabs.title == "skins" ) { tab_specific_size = sdk::drawing::get_text_size( "skins", sdk::drawing::c_fonts::verdana ).x; } else if ( form_tabs.title == "profile" ) { tab_specific_size = sdk::drawing::get_text_size( "profile", sdk::drawing::c_fonts::verdana ).x; }
What the fuck is this XD
 
Пользователь
Статус
Оффлайн
Регистрация
29 Дек 2020
Сообщения
62
Реакции[?]
31
Поинты[?]
2K
Let me fix your retarded code:

C++:
            /* calculate the total width of all tabs */
            int total_tabs_width = 0;
            for ( auto& form_tabs : tabs ) {
                auto tab_size = sdk::drawing::get_text_size( form_tabs.title.c_str( ), sdk::drawing::c_fonts::verdana );

                tab_specific_size = tab_size.x;

                total_tabs_width += tab_size.x;
            }
Stop posting useless shit that no one cares about
 
Начинающий
Статус
Оффлайн
Регистрация
15 Янв 2022
Сообщения
170
Реакции[?]
26
Поинты[?]
10K
Let me fix your retarded code:

C++:
            /* calculate the total width of all tabs */
            int total_tabs_width = 0;
            for ( auto& form_tabs : tabs ) {
                auto tab_size = sdk::drawing::get_text_size( form_tabs.title.c_str( ), sdk::drawing::c_fonts::verdana );

                tab_specific_size = tab_size.x;

                total_tabs_width += tab_size.x;
            }
Stop posting useless shit that no one cares about
exactly, sweetheart
 
c:\buildworker\csgo_rel_win64
Участник
Статус
Оффлайн
Регистрация
18 Окт 2022
Сообщения
598
Реакции[?]
212
Поинты[?]
140K
dont listen to nobody, one day u will become superior in gui
 
Сверху Снизу