Исходник Pandora.gg gui cursor

Участник
Статус
Оффлайн
Регистрация
6 Апр 2021
Сообщения
343
Реакции[?]
216
Поинты[?]
122K
C++:
void custom_cursor(c_vector_2d position, float rotation_angle_degrees, c_color color) {
    float arrow_base_width = 8;
    float arrow_height = 9;     
    float arrow_middle_width = 7; 
    float outline_thickness = 2.0f;

    ux::imgui::vec2 verts[4];
    verts[0] = ux::imgui::vec2(position.x, position.y);                                 
    verts[1] = ux::imgui::vec2(position.x - arrow_base_width / 2, position.y + arrow_height);
    verts[2] = ux::imgui::vec2(position.x, position.y + arrow_middle_width);             
    verts[3] = ux::imgui::vec2(position.x + arrow_base_width / 2, position.y + arrow_height);

    ux::imgui::vec2 center = ux::imgui::vec2(position.x, position.y + arrow_height / 2);
    float angle_radians = rotation_angle_degrees * (3.14159f / 180.0f);

    auto rotate_vertex = [&](ux::imgui::vec2 point, ux::imgui::vec2 center, float angle) -> ux::imgui::vec2 {
        float translated_x = point.x - center.x;
        float translated_y = point.y - center.y;

        float rotated_x = translated_x * cos(angle) - translated_y * sin(angle);
        float rotated_y = translated_x * sin(angle) + translated_y * cos(angle);

        return ux::imgui::vec2(rotated_x + center.x, rotated_y + center.y);
        };

    verts[0] = rotate_vertex(verts[0], center, angle_radians);
    verts[1] = rotate_vertex(verts[1], center, angle_radians);
    verts[2] = rotate_vertex(verts[2], center, angle_radians);
    verts[3] = rotate_vertex(verts[3], center, angle_radians);

    ux::imgui::draw_list->AddPolyline(verts, 4, color.convert(), true, outline_thickness);
    ux::imgui::draw_list->AddConvexPolyFilled(verts, 4, color.convert());
}
1731842871219.png
 
Начинающий
Статус
Оффлайн
Регистрация
3 Авг 2023
Сообщения
3
Реакции[?]
1
Поинты[?]
1K
clean, nice to see people not making hard coded shit that takes 20mins to change the smallest of details
 
HvH Legend
Пользователь
Статус
Оффлайн
Регистрация
23 Окт 2022
Сообщения
395
Реакции[?]
97
Поинты[?]
27K
C++:
void custom_cursor(c_vector_2d position, float rotation_angle_degrees, c_color color) {
    float arrow_base_width = 8;
    float arrow_height = 9;    
    float arrow_middle_width = 7;
    float outline_thickness = 2.0f;

    ux::imgui::vec2 verts[4];
    verts[0] = ux::imgui::vec2(position.x, position.y);                                
    verts[1] = ux::imgui::vec2(position.x - arrow_base_width / 2, position.y + arrow_height);
    verts[2] = ux::imgui::vec2(position.x, position.y + arrow_middle_width);            
    verts[3] = ux::imgui::vec2(position.x + arrow_base_width / 2, position.y + arrow_height);

    ux::imgui::vec2 center = ux::imgui::vec2(position.x, position.y + arrow_height / 2);
    float angle_radians = rotation_angle_degrees * (3.14159f / 180.0f);

    auto rotate_vertex = [&](ux::imgui::vec2 point, ux::imgui::vec2 center, float angle) -> ux::imgui::vec2 {
        float translated_x = point.x - center.x;
        float translated_y = point.y - center.y;

        float rotated_x = translated_x * cos(angle) - translated_y * sin(angle);
        float rotated_y = translated_x * sin(angle) + translated_y * cos(angle);

        return ux::imgui::vec2(rotated_x + center.x, rotated_y + center.y);
        };

    verts[0] = rotate_vertex(verts[0], center, angle_radians);
    verts[1] = rotate_vertex(verts[1], center, angle_radians);
    verts[2] = rotate_vertex(verts[2], center, angle_radians);
    verts[3] = rotate_vertex(verts[3], center, angle_radians);

    ux::imgui::draw_list->AddPolyline(verts, 4, color.convert(), true, outline_thickness);
    ux::imgui::draw_list->AddConvexPolyFilled(verts, 4, color.convert());
}
Посмотреть вложение 290683
На лв4 встанет или не ?
 
Сверху Снизу