Пользователь
-
Автор темы
- #1
Onetap v2 menu.
Из элементов есть только чекбоксы.
Из элементов есть только чекбоксы.
C++:
ImColor menu_background_outline_color = ImColor(33, 35, 40, 255);
ImColor menu_background_color = ImColor(45, 48, 55, 255);
ImColor menu_gradient_left_color = ImColor(200, 110, 45, 255);
ImColor menu_gradient_right_color = ImColor(255, 185, 100, 255);
ImColor menu_separator_color = ImColor(62, 68, 78, 255);
ImColor menu_active_tab_color = ImColor(55, 60, 69, 255);
ImColor menu_hovered_tab_color = ImColor(50, 55, 62, 255);
ImColor menu_checkbox_color = ImColor(85, 97, 119, 255);
ImColor menu_checkbox_hovered_color = ImColor(55, 60, 69, 255);
ImColor menu_groupbox_color = ImColor(50, 55, 62, 255);
ImColor menu_first_text_color = ImColor(214, 217, 224, 255);
ImColor menu_second_text_color = ImColor(189, 198, 219, 255);
C++:
const char* menu_title = "onetap.su";
int active_tab = 0;
bool is_dragging = false;
ImVec2 menu_position = ImVec2(200, 50);
ImVec2 menu_size = ImVec2(620, 628);
ImFont* segoe_ui_semibold = nullptr;
ImFont* segoe_ui_bold = nullptr;
std::vector<const char*> menu_tabs =
{
"legitbot",
"ragebot",
"anti-aim",
"players",
"visuals",
"skins",
"misc",
"config"
};
class groupbox
{
public:
groupbox(const char* tit, ImVec2 pos, ImVec2 siz)
{
position = pos;
size = siz;
element_position = ImVec2(pos.x + 9, pos.y + 19);
element_count = 0;
title = tit;
}
void draw(ImVec2 pos)
{
ImDrawList* draw_list = ImGui::GetForegroundDrawList();
position = pos;
ImVec2 groupbox_main_rect_min = position;
ImVec2 groupbox_main_rect_max = ImVec2(position.x + size.x, position.y + size.y);
ImVec2 groupbox_gradient_rect_min = position;
ImVec2 groupbox_gradient_rect_max = ImVec2(position.x + size.x, position.y + 6);
ImVec2 groupbox_text_position = ImVec2(position.x + 3, position.y - 10 - segoe_ui_bold->CalcTextSizeA(16.0f, FLT_MAX, 0.0f, title).y * 0.7f);
// draw title
draw_list->AddText(segoe_ui_bold, 16.0f, groupbox_text_position, menu_gradient_right_color, title);
// draw main rect
draw_list->AddRectFilled(groupbox_main_rect_min, groupbox_main_rect_max, menu_groupbox_color, 3.0f);
// draw gradient rect
draw_list->AddRectFilledMultiColorRounded(groupbox_gradient_rect_min, groupbox_gradient_rect_max, menu_groupbox_color, menu_gradient_left_color, menu_gradient_right_color, menu_gradient_right_color, menu_gradient_left_color, 3.0f);
}
void end()
{
if (element_count > 0)
size = ImVec2(size.x, (element_position.y - position.y - 12) + 14);
element_position = ImVec2(position.x + 9, position.y + 19);
element_count = 0;
}
ImVec2 position;
ImVec2 size;
ImVec2 element_position;
int element_count;
const char* title;
};
C++:
bool draw_checkbox(const char* title, bool* variable, ImVec2 position)
{
ImDrawList* draw_list = ImGui::GetForegroundDrawList();
ImVec2 checkbox_main_rect_min = position;
ImVec2 checkbox_main_rect_max = ImVec2(position.x + 16, position.y + 16);
ImVec2 checkbox_hovered_rect_min = ImVec2(position.x - 3, position.y - 3);
ImVec2 checkbox_hovered_rect_max = ImVec2(checkbox_hovered_rect_min.x + 266, checkbox_main_rect_max.y + 3);
ImVec2 checkbox_full_rect_min = checkbox_main_rect_min;
ImVec2 checkbox_full_rect_max = ImVec2(checkbox_main_rect_max.x + 5 + segoe_ui_semibold->CalcTextSizeA(14.0f, FLT_MAX, 0.0f, title).x, checkbox_main_rect_max.y);
ImVec2 checkbox_text_position = ImVec2(checkbox_main_rect_max.x + 5, position.y + 7 - segoe_ui_semibold->CalcTextSizeA(14.0f, FLT_MAX, 0.0f, title).y * 0.5f);
bool is_hovered = ImGui::IsMouseHoveringRect(checkbox_full_rect_min, checkbox_full_rect_max, false);
bool is_clicked = ImGui::IsMouseClicked(ImGuiMouseButton_Left);
if (is_hovered)
draw_list->AddRectFilled(checkbox_hovered_rect_min, checkbox_hovered_rect_max, menu_checkbox_hovered_color, 3.0f);
// draw main rect
draw_list->AddRect(checkbox_main_rect_min, checkbox_main_rect_max, menu_checkbox_color, 3.0f);
if (*variable)
draw_list->AddRectFilled(checkbox_main_rect_min, checkbox_main_rect_max, menu_checkbox_color, 3.0f);
// draw text
draw_list->AddText(segoe_ui_semibold, 14.0f, checkbox_text_position, menu_second_text_color, title);
if (is_hovered && is_clicked)
{
*variable = !*variable;
return true;
}
return false;
}
bool draw_checkbox(const char* title, bool* variable, groupbox* group)
{
ImDrawList* draw_list = ImGui::GetForegroundDrawList();
ImVec2 position = group->element_position;
ImVec2 checkbox_main_rect_min = position;
ImVec2 checkbox_main_rect_max = ImVec2(position.x + 16, position.y + 16);
ImVec2 checkbox_hovered_rect_min = ImVec2(position.x - 3, position.y - 3);
ImVec2 checkbox_hovered_rect_max = ImVec2(checkbox_hovered_rect_min.x + 266, checkbox_main_rect_max.y + 3);
ImVec2 checkbox_full_rect_min = checkbox_main_rect_min;
ImVec2 checkbox_full_rect_max = ImVec2(checkbox_main_rect_max.x + 5 + segoe_ui_semibold->CalcTextSizeA(14.0f, FLT_MAX, 0.0f, title).x, checkbox_main_rect_max.y);
ImVec2 checkbox_text_position = ImVec2(checkbox_main_rect_max.x + 5, position.y + 7 - segoe_ui_semibold->CalcTextSizeA(14.0f, FLT_MAX, 0.0f, title).y * 0.5f);
group->element_position = ImVec2(position.x, checkbox_main_rect_max.y + 12);
group->element_count++;
bool is_hovered = ImGui::IsMouseHoveringRect(checkbox_full_rect_min, checkbox_full_rect_max, false);
bool is_clicked = ImGui::IsMouseClicked(ImGuiMouseButton_Left);
if (is_hovered)
draw_list->AddRectFilled(checkbox_hovered_rect_min, checkbox_hovered_rect_max, menu_checkbox_hovered_color, 3.0f);
// draw main rect
draw_list->AddRect(checkbox_main_rect_min, checkbox_main_rect_max, menu_checkbox_color, 3.0f);
if (*variable)
draw_list->AddRectFilled(checkbox_main_rect_min, checkbox_main_rect_max, menu_checkbox_color, 3.0f);
// draw text
draw_list->AddText(segoe_ui_semibold, 14.0f, checkbox_text_position, menu_second_text_color, title);
if (is_hovered && is_clicked)
{
*variable = !*variable;
return true;
}
return false;
}
bool draw_tab(const char* title, ImVec2 position, bool active, ImVec2& next_tab_position) // 9, 12
{
ImDrawList* draw_list = ImGui::GetForegroundDrawList();
ImVec2 main_rect_min = position;
ImVec2 main_rect_max = ImVec2(position.x + (9 + segoe_ui_bold->CalcTextSizeA(14.0f, FLT_MAX, 0.0f, title).x + 12), position.y + 25);
next_tab_position = ImVec2(main_rect_max.x, main_rect_min.y);
ImVec2 text_position = ImVec2(position.x + 9, position.y + 11 - segoe_ui_bold->CalcTextSizeA(14.0f, FLT_MAX, 0.0f, title).y * 0.5f);
bool is_hovered = ImGui::IsMouseHoveringRect(main_rect_min, main_rect_max, false);
bool is_clicked = ImGui::IsMouseClicked(ImGuiMouseButton_Left);
if (is_hovered)
draw_list->AddRectFilled(main_rect_min, main_rect_max, menu_hovered_tab_color, 3.0f);
// draw main rect
if (active)
draw_list->AddRectFilled(main_rect_min, main_rect_max, menu_active_tab_color, 3.0f);
// draw text
draw_list->AddText(segoe_ui_bold, 14.0f, text_position, menu_first_text_color, title);
if (is_hovered && is_clicked)
return true;
return false;
}
void draw_tab_bar(std::vector<const char*> tabs, ImVec2 position)
{
ImVec2 next_position = position;
for (int i = 0; i < tabs.size(); i++)
{
if (draw_tab(tabs.at(i), next_position, active_tab == i, next_position))
active_tab = i;
}
}
void draw_elements(ImVec2 main_rect_min, ImVec2 main_rect_max)
{
static bool var = false;
static bool var1 = false;
static bool var2 = false;
static bool var3 = false;
static groupbox weapon_configuration = groupbox("weapon configuration", ImVec2(main_rect_min.x + 15, main_rect_min.y + 75), ImVec2(283, 77));
if (active_tab == 1)
{
draw_checkbox("enable", &var, ImVec2(main_rect_min.x + 15, main_rect_min.y + 19));
weapon_configuration.draw(ImVec2(main_rect_min.x + 15, main_rect_min.y + 75));
draw_checkbox("checkbox test", &var1, &weapon_configuration);
if (var1)
{
draw_checkbox("checkbox test 1", &var2, &weapon_configuration);
draw_checkbox("checkbox test 2", &var3, &weapon_configuration);
}
weapon_configuration.end();
}
}
void draw_gui()
{
ImVec2 menu_fucker_size = ImVec2(menu_size.x, 68);
ImVec2 menu_fucker_padding = ImVec2(0, 10);
ImVec2 menu_fucker_rect_first = menu_position;
ImVec2 menu_fucker_rect_second = ImVec2(menu_position.x + menu_fucker_size.x, menu_position.y + menu_fucker_size.y);
bool is_hovered_fucker = ImGui::IsMouseHoveringRect(menu_fucker_rect_first, menu_fucker_rect_second, false);
bool is_clicked_fucker = ImGui::IsMouseClicked(ImGuiMouseButton_Left);
bool is_holding_fucker = ImGui::IsMouseDown(ImGuiMouseButton_Left);
ImVec2 menu_main_rect_size = ImVec2(menu_size.x - menu_fucker_padding.x, menu_size.y - menu_fucker_size.y - menu_fucker_padding.y);
ImVec2 menu_main_rect_first = ImVec2(menu_position.x + menu_fucker_padding.x, menu_position.y + menu_fucker_size.y + menu_fucker_padding.y);
ImVec2 menu_main_rect_second = ImVec2(menu_position.x + menu_fucker_padding.x + menu_main_rect_size.x, menu_position.y + menu_fucker_size.y + menu_fucker_padding.y + menu_main_rect_size.y);
ImVec2 menu_fucker_gradient_first = ImVec2(menu_fucker_rect_first.x + 1, menu_fucker_rect_first.y + 1);
ImVec2 menu_fucker_gradient_second = ImVec2(menu_fucker_rect_first.x + (menu_fucker_size.x - 1), menu_fucker_rect_first.y + 1 + 6);
ImVec2 menu_title_position = ImVec2(menu_fucker_rect_first.x + 24, (menu_fucker_rect_first.y + 35 - segoe_ui_bold->CalcTextSizeA(22.0f, FLT_MAX, 0.0f, menu_title).y * 0.5f));
ImVec2 menu_separator_position = ImVec2(menu_fucker_rect_first.x + 124, menu_fucker_rect_first.y + 24);
ImVec2 menu_separator_end = ImVec2(menu_fucker_rect_first.x + 124 + 1, menu_fucker_rect_first.y + 24 + 28);
ImVec2 menu_tab_bar_position = ImVec2(menu_separator_end.x + 12, menu_fucker_rect_first.y + 24);
ImDrawList* draw_list = ImGui::GetForegroundDrawList();
// draw fucker rect
draw_list->AddRectFilled(menu_fucker_rect_first, menu_fucker_rect_second, menu_background_outline_color, 3.0f); // outline
draw_list->AddRectFilled(ImVec2(menu_fucker_rect_first.x + 1, menu_fucker_rect_first.y + 1), ImVec2(menu_fucker_rect_second.x - 1, menu_fucker_rect_second.y - 1), menu_background_color, 3.0f); // main
draw_list->AddRectFilledMultiColorRounded(menu_fucker_gradient_first, menu_fucker_gradient_second, menu_background_color, menu_gradient_left_color, menu_gradient_right_color, menu_gradient_right_color, menu_gradient_left_color, 2.0f); // gradient
// draw main rect
draw_list->AddRectFilled(menu_main_rect_first, menu_main_rect_second, menu_background_outline_color, 3.0f); // outline
draw_list->AddRectFilled(ImVec2(menu_main_rect_first.x + 1, menu_main_rect_first.y + 1), ImVec2(menu_main_rect_second.x - 1, menu_main_rect_second.y - 1), menu_background_color, 3.0f); // main
// draw title
draw_list->AddText(segoe_ui_bold, 22.0f, menu_title_position, menu_first_text_color, menu_title);
// draw separator line
draw_list->AddRectFilled(menu_separator_position, menu_separator_end, menu_separator_color);
// draw tabs
draw_tab_bar(menu_tabs, menu_tab_bar_position);
// draw elements
draw_elements(menu_main_rect_first, menu_main_rect_second);
}