меню:
#include "Menu.hpp"
#define NOMINMAX
#include <Windows.h>
#include <chrono>
#include "valve_sdk/csgostructs.hpp"
#include "helpers/input.hpp"
#include "options.hpp"
#include "ui.hpp"
#include "config.hpp"
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui/imgui_internal.h"
#include "imgui/impl/imgui_impl_dx9.h"
#include "imgui/impl/imgui_impl_win32.h"
#include "render.hpp"
#include "maw.h"
#include "icons.h"
IDirect3DTexture9* maw = nullptr;
IDirect3DTexture9* icons[8] = { nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr,nullptr };
float dpi_scale = 1.f;
ImVec2 pos;
ImDrawList* draw;
static int tabs = 0;
static int subtabs = 0;
// =========================================================
//
// These are the tabs on the sidebar
//
// =========================================================
static char* sidebar_tabs[] = {
"ESP",
"AIM",
"MISC",
"CONFIG"
};
constexpr static float get_sidebar_item_width() { return 150.0f; }
constexpr static float get_sidebar_item_height() { return 50.0f; }
enum {
TAB_ESP,
TAB_AIMBOT,
TAB_MISC,
TAB_CONFIG
};
namespace ImGuiEx
{
inline bool ColorEdit4(const char* label, Color* v, bool show_alpha = true)
{
auto clr = ImVec4{
v->r() / 255.0f,
v->g() / 255.0f,
v->b() / 255.0f,
v->a() / 255.0f
};
if(ImGui::ColorEdit4(label, &clr.x, show_alpha)) {
v->SetColor(clr.x, clr.y, clr.z, clr.w);
return true;
}
return false;
}
inline bool ColorEdit3(const char* label, Color* v)
{
return ColorEdit4(label, v, false);
}
}
template<size_t N>
void render_tabs(char* (&names)[N], int& activetab, float w, float h, bool sameline)
{
bool values[N] = { false };
values[activetab] = true;
for(auto i = 0; i < N; ++i) {
if(ImGui::ToggleButton(names[i], &values[i], ImVec2{ w, h })) {
activetab = i;
}
if(sameline && i < N - 1)
ImGui::SameLine();
}
}
ImVec2 get_sidebar_size()
{
constexpr float padding = 10.0f;
constexpr auto size_w = padding * 2.0f + get_sidebar_item_width();
constexpr auto size_h = padding * 2.0f + (sizeof(sidebar_tabs) / sizeof(char*)) * get_sidebar_item_height();
return ImVec2{ size_w, ImMax(577.0f, size_h) };
}
void RenderEspTab()
{
static char* esp_tab_names[] = { "ESP", "GLOW", "CHAMS", "COLOR" };
static int active_esp_tab = 0;
bool placeholder_true = true;
auto& style = ImGui::GetStyle();
float group_w = ImGui::GetCurrentWindow()->Size.x - style.WindowPadding.x * 2;
ImGui::BeginGroupBox("##body_content");
{
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
{
render_tabs(esp_tab_names, active_esp_tab, group_w / _countof(esp_tab_names) - 48.5f, 25.0f, true);
}
ImGui::PopStyleVar();
if (active_esp_tab == 0) {
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
ImGui::Columns(2, nullptr, false);
ImGui::SetColumnOffset(1, group_w / 3.0f);
ImGui::SetColumnOffset(2, 2 * group_w / 3.0f);
ImGui::SetColumnOffset(3, group_w);
ImGui::BeginGroupBox("Players");
{
ImGui::Text("Player");
ImGui::Separator();
ImGui::Checkbox("Enabled", g_Options.esp_enabled);
ImGui::Checkbox("Team check", g_Options.esp_enemies_only);
ImGui::Checkbox("Boxes", g_Options.esp_player_boxes);
ImGui::Checkbox("Names", g_Options.esp_player_names);
ImGui::Checkbox("Health", g_Options.esp_player_health);
ImGui::Checkbox("Armour", g_Options.esp_player_armour);
ImGui::Checkbox("Weapon", g_Options.esp_player_weapons);
ImGui::Checkbox("Snaplines", g_Options.esp_player_snaplines);
}
ImGui::EndGroupBox();
ImGui::NextColumn();
ImGui::BeginGroupBox("Other");
{
ImGui::Text("Other");
ImGui::Separator();
ImGui::Checkbox("Crosshair", g_Options.esp_crosshair);
ImGui::Checkbox("Dropped Weapons", g_Options.esp_dropped_weapons);
ImGui::Checkbox("Defuse Kit", g_Options.esp_defuse_kit);
ImGui::Checkbox("Planted C4", g_Options.esp_planted_c4);
ImGui::Checkbox("Item Esp", g_Options.esp_items);
}
ImGui::EndGroupBox();
ImGui::Columns(1, nullptr, false);
ImGui::PopStyleVar();
}
else if (active_esp_tab == 1) {
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
ImGui::Columns(2, nullptr, false);
ImGui::SetColumnOffset(1, group_w / 3.0f);
ImGui::SetColumnOffset(2, 2 * group_w / 3.0f);
ImGui::SetColumnOffset(3, group_w);
ImGui::BeginGroupBox("Player");
{
ImGui::Text("Player");
ImGui::Separator();
ImGui::Checkbox("Enabled", g_Options.glow_enabled);
ImGui::Checkbox("Team check", g_Options.glow_enemies_only);
ImGui::Checkbox("Players", g_Options.glow_players);
}
ImGui::EndGroupBox();
ImGui::NextColumn();
ImGui::BeginGroupBox("Other");
{
ImGui::Text("Other");
ImGui::Separator();
ImGui::Checkbox("Chickens", g_Options.glow_chickens);
ImGui::Checkbox("C4 Carrier", g_Options.glow_c4_carrier);
ImGui::Checkbox("Planted C4", g_Options.glow_planted_c4);
ImGui::Checkbox("Defuse Kits", g_Options.glow_defuse_kits);
ImGui::Checkbox("Weapons", g_Options.glow_weapons);
}
ImGui::EndGroupBox();
ImGui::Columns(1, nullptr, false);
ImGui::PopStyleVar();
}
else if (active_esp_tab == 2) {
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
ImGui::Columns(3, nullptr, false);
ImGui::SetColumnOffset(1, group_w / 3.0f);
ImGui::SetColumnOffset(2, 2 * group_w / 2.9f);
ImGui::SetColumnOffset(3, group_w);
ImGui::BeginGroupBox("PLAYERS");
{
ImGui::Text("Players");
ImGui::Separator();
ImGui::Checkbox("Enabled", g_Options.chams_player_enabled);
ImGui::Checkbox("Enemy only", g_Options.chams_player_enemies_only);
const char* chams[4] = { "Regular", "Flat", "Glass", "Glow" };
ImGui::Combo("Chams type", g_Options.chams_type_player, chams, IM_ARRAYSIZE(chams));
ImGui::Checkbox("Ignore-Z", g_Options.chams_player_ignorez);
ImGui::Checkbox("Double Material", g_Options.chams_player_double_material);
}
ImGui::EndGroupBox();
ImGui::NextColumn();
ImGui::BeginGroupBox("ARMS");
{
ImGui::Text("Arms");
ImGui::Separator();
ImGui::Checkbox("Enabled", g_Options.chams_arms_enabled);
const char* chams[4] = { "Regular", "Flat", "Glass", "Glow" };
ImGui::Combo("Chams type", g_Options.chams_type_arms, chams, IM_ARRAYSIZE(chams));
ImGui::Checkbox("Ignore-Z", g_Options.chams_arms_ignorez);
ImGui::Checkbox("Double Material", g_Options.chams_arms_double_material);
}
ImGui::EndGroupBox();
ImGui::Columns(1, nullptr, false);
ImGui::PopStyleVar();
}
else if (active_esp_tab == 3) {
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
ImGui::Columns(2, nullptr, false);
ImGui::SetColumnOffset(1, group_w / 3.0f);
ImGui::SetColumnOffset(2, 2 * group_w / 2.9f);
ImGui::SetColumnOffset(3, group_w);
ImGui::BeginGroupBox("Player Color");
{
ImGui::Text("Players Colors");
ImGui::Separator();
ImGui::PushItemWidth(110);
ImGuiEx::ColorEdit3("Allies Vis [ESP]", g_Options.color_esp_ally_visible);
ImGuiEx::ColorEdit3("Enemies Vis [ESP]", g_Options.color_esp_enemy_visible);
ImGuiEx::ColorEdit3("Allies Occ [ESP]", g_Options.color_esp_ally_occluded);
ImGuiEx::ColorEdit3("Enemies Occ [ESP]", g_Options.color_esp_enemy_occluded);
ImGuiEx::ColorEdit3("Ally [Glow]", g_Options.color_glow_ally);
ImGuiEx::ColorEdit3("Enemy [Glow]", g_Options.color_glow_enemy);
ImGuiEx::ColorEdit4("Ally Vis [Chams]", g_Options.color_chams_player_ally_visible);
ImGuiEx::ColorEdit4("Ally Occ [Chams]", g_Options.color_chams_player_ally_occluded);
ImGuiEx::ColorEdit4("Enemy Vis [Chams]", g_Options.color_chams_player_enemy_visible);
ImGuiEx::ColorEdit4("Enemy Occ [Chams]", g_Options.color_chams_player_enemy_occluded);
ImGuiEx::ColorEdit4("DMaterial [Chams]", g_Options.color_chams_double_material);
ImGuiEx::ColorEdit4("Arms Vis [Chams]", g_Options.color_chams_arms_visible);
ImGuiEx::ColorEdit4("Arms Occ [Chams]", g_Options.color_chams_arms_occluded);
ImGui::PopItemWidth();
}
ImGui::EndGroupBox();
ImGui::NextColumn();
ImGui::BeginGroupBox("Other Color");
{
ImGui::Text("Other Colors");
ImGui::Separator();
ImGui::PushItemWidth(100);
ImGuiEx::ColorEdit3("Crosshair [ESP]", g_Options.color_esp_crosshair);
ImGuiEx::ColorEdit3("Dropped Weapons [ESP]", g_Options.color_esp_weapons);
ImGuiEx::ColorEdit3("Defuse Kit [ESP]", g_Options.color_esp_defuse);
ImGuiEx::ColorEdit3("Planted C4 [ESP]", g_Options.color_esp_c4);
ImGuiEx::ColorEdit3("Item Esp [ESP]", g_Options.color_esp_item);
ImGuiEx::ColorEdit3("Chickens [Glow]", g_Options.color_glow_chickens);
ImGuiEx::ColorEdit3("C4 Carrier [Glow]", g_Options.color_glow_c4_carrier);
ImGuiEx::ColorEdit3("Planted C4 [Glow]", g_Options.color_glow_planted_c4);
ImGuiEx::ColorEdit3("Defuse Kits [Glow]", g_Options.color_glow_defuse);
ImGuiEx::ColorEdit3("Weapons [Glow]", g_Options.color_glow_weapons);
ImGui::PopItemWidth();
}
ImGui::EndGroupBox();
ImGui::Columns(1, nullptr, false);
ImGui::PopStyleVar();
}
}
ImGui::EndGroupBox();
}
void RenderMiscTab()
{
bool placeholder_true = true;
auto& style = ImGui::GetStyle();
float group_w = ImGui::GetCurrentWindow()->Size.x - style.WindowPadding.x * 2;
ImGui::BeginGroupBox("##body_content");
{
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
ImGui::Columns(2, nullptr, false);
ImGui::SetColumnOffset(1, group_w / 3.0f);
ImGui::SetColumnOffset(2, 2 * group_w / 3.0f);
ImGui::SetColumnOffset(3, group_w);
ImGui::BeginGroupBox("Other Misc");
{
ImGui::Text("Misc");
ImGui::Separator();
ImGui::Checkbox("Bunny hop", g_Options.misc_bhop);
ImGui::Checkbox("Third Person", g_Options.misc_thirdperson);
if (g_Options.misc_thirdperson)
ImGui::SliderFloat("Distance", g_Options.misc_thirdperson_dist, 0.f, 150.f);
ImGui::Checkbox("No hands", g_Options.misc_no_hands);
ImGui::Checkbox("Rank reveal", g_Options.misc_showranks);
ImGui::Checkbox("Watermark##hc", g_Options.misc_watermark);
}
ImGui::EndGroupBox();
ImGui::NextColumn();
ImGui::BeginGroupBox("Other View");
{
ImGui::Text("View");
ImGui::Separator();
ImGui::Checkbox("Viewmodel fov", g_Options.esp_viewmodel_fov);
if (g_Options.esp_viewmodel_fov)
ImGui::SliderInt("Value ", g_Options.esp_viewmodel_fov_value, 68, 120);
ImGui::Checkbox("Nightmode", g_Options.esp_nightmode);
if (g_Options.esp_nightmode)
ImGui::SliderFloat("Value", g_Options.esp_nightmode_value, 0, 0.5f);
}
ImGui::EndGroupBox();
ImGui::Columns(1, nullptr, false);
ImGui::PopStyleVar();
}
ImGui::EndGroupBox();
}
void RenderEmptyTab()
{
auto& style = ImGui::GetStyle();
float group_w = ImGui::GetCurrentWindow()->Size.x - style.WindowPadding.x * 2;
bool placeholder_true = true;
ImGui::BeginGroupBox("##body_content");
{
auto message = "Ogo ebat', u want create the megapaste?";
auto pos = ImGui::GetCurrentWindow()->Pos;
auto wsize = ImGui::GetCurrentWindow()->Size;
pos = pos + wsize / 2.0f;
ImGui::RenderText(pos - ImGui::CalcTextSize(message) / 2.0f, message);
}
ImGui::EndGroupBox();
}
void RenderConfigTab()
{
auto& style = ImGui::GetStyle();
float group_w = ImGui::GetCurrentWindow()->Size.x - style.WindowPadding.x * 2;
bool placeholder_true = true;
ImGui::BeginGroupBox("##body_content");
{
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ style.WindowPadding.x, style.ItemSpacing.y });
ImGui::Columns(2, nullptr, false);
ImGui::SetColumnOffset(1, group_w / 3.0f);
ImGui::SetColumnOffset(2, 2 * group_w / 3.0f);
ImGui::SetColumnOffset(3, group_w);
ImGui::BeginGroupBox("Configs");
{
ImGui::Text("Config");
ImGui::Separator();
ImGui::PushItemWidth(100);
if (ImGui::Button("Save cfg")) {
Config::Get().Save();
}
if (ImGui::Button("Load cfg")) {
Config::Get().Load();
}
}
ImGui::EndGroupBox();
ImGui::Columns(1, nullptr, false);
ImGui::PopStyleVar();
}
ImGui::EndGroupBox();
}
void RageTab()
{
ImGui::SetCursorPos(ImVec2(140, 40));
ImGui::BeginChild("general", ImVec2(150, 200));
{
ImGui::BeginGroup();
ImGui::Button("Button", ImVec2(97, 20));
ImGui::EndGroup();
}
ImGui::EndChild();
}
void Menu::Initialize()
{
CreateStyle();
_visible = true;
}
void Menu::Shutdown()
{
ImGui_ImplDX9_Shutdown();
ImGui_ImplWin32_Shutdown();
ImGui::DestroyContext();
}
void Menu::OnDeviceLost()
{
ImGui_ImplDX9_InvalidateDeviceObjects();
}
void Menu::OnDeviceReset()
{
ImGui_ImplDX9_CreateDeviceObjects();
}
bool ImGui::tab(const char* label, int number, const bool active, const ImVec2& size_arg)
{
return TabEx(label, number, active, size_arg, 0);
}
bool ImGui::TabEx(const char* label, int number, const bool active, const ImVec2& size_arg, ImGuiButtonFlags flags)
{
ImGuiWindow* window = GetCurrentWindow();
if (window->SkipItems)
return false;
ImGuiContext& g = *GImGui;
const ImGuiStyle& style = g.Style;
const ImGuiID id = window->GetID(label);
const ImVec2 label_size = ImVec2(48, 12);
const ImVec2 second_label_size = ImVec2(112, 6);
ImVec2 pos = window->DC.CursorPos;
if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset) // Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag)
pos.y += window->DC.CurrentLineTextBaseOffset - style.FramePadding.y;
ImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);
const ImRect bb(pos, pos + size);
ItemSize(size, style.FramePadding.y);
if (!ItemAdd(bb, id))
return false;
if (window->DC.ItemFlags & ImGuiItemFlags_ButtonRepeat)
flags |= ImGuiButtonFlags_Repeat;
bool hovered, held;
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
if (pressed)
MarkItemEdited(id);
// Render
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
RenderNavHighlight(bb, id);
if (active || hovered)
{
//ImGui::PushStyleVar(ImGuiStyleVar)
PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f));
RenderTextClipped(ImVec2(bb.Min.x + 5, bb.Min.y - 6), ImVec2(bb.Max.x + 5, bb.Max.y - 6), label, NULL, &label_size, style.ButtonTextAlign, &bb);
PopStyleColor();
GetWindowDrawList()->AddImage(icons[number], ImVec2(bb.Min.x + 11, bb.Min.y + 24), ImVec2(bb.Max.x - 123, bb.Max.y - 24), ImVec2(0, 0), ImVec2(1, 1), GetColorU32(ImGuiCol_ScrollbarGrab));
window->DrawList->AddImage(maw, ImVec2(bb.Min.x - 10, bb.Max.y - 21), ImVec2(bb.Max.x, bb.Min.y + 62));
//ImGui::PushFont(second);
//RenderTextClipped(ImVec2(bb.Min.x + 27, bb.Min.y), ImVec2(bb.Max.x + 27, bb.Max.y + 14), second_label, NULL, &second_label_size, style.ButtonTextAlign, &bb);
ImGui::PopFont();
}
else
{
PushStyleColor(ImGuiCol_Text, ImVec4(0.59f, 0.59f, 0.59f, 1.f));
RenderTextClipped(ImVec2(bb.Min.x + 5, bb.Min.y - 6), ImVec2(bb.Max.x + 5, bb.Max.y - 6), label, NULL, &label_size, style.ButtonTextAlign, &bb);
PopStyleColor();
//ImGui::PushFont(second);
GetWindowDrawList()->AddImage(icons[number], ImVec2(bb.Min.x + 11, bb.Min.y + 24), ImVec2(bb.Max.x - 123, bb.Max.y - 24));
//RenderTextClipped(ImVec2(bb.Min.x + 27, bb.Min.y), ImVec2(bb.Max.x + 27, bb.Max.y + 14), second_label, NULL, &second_label_size, style.ButtonTextAlign, &bb);
ImGui::PopFont();
}
// Automatically close popups
//if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))
// CloseCurrentPopup();
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags);
return pressed;
}
void Menu::Render()
{
ImGui::GetIO().MouseDrawCursor = _visible;
if(!_visible)
return;
const auto sidebar_size = get_sidebar_size();
static int active_sidebar_tab = 0;
ImGui::Begin("Menu", nullptr, ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_HorizontalScrollbar);
{
static int x = 545 * dpi_scale, y = 355 * dpi_scale;
pos = ImGui::GetWindowPos();
draw = ImGui::GetWindowDrawList();
ImGui::SetWindowSize(ImVec2(ImFloor(x * dpi_scale), ImFloor(y * dpi_scale)));
draw->AddRectFilled(pos, ImVec2(pos.x + 545, pos.y + 355), ImColor(38, 38, 42), 9);
draw->AddRectFilled(pos, ImVec2(pos.x + 545, pos.y + 355), ImGui::GetColorU32(ImGuiCol_WindowBg), 9);
draw->AddLine(ImVec2(pos.x, pos.y + 30), ImVec2(pos.x + 545, pos.y + 30), ImColor(38, 38, 42));
draw->AddRectFilledMultiColor(ImVec2(pos.x, pos.y + 29), ImVec2(pos.x + 545, pos.y + 30), ImColor(67, 58, 190), ImColor(67, 58, 190, 0), ImColor(67, 58, 190, 0), ImColor(67, 58, 190));
//if (logggo == nullptr)
//D3DXCreateTextureFromFileInMemoryEx(g_pd3dDevice, &logo, sizeof(logo), 500, 500, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &logggo);
ImGui::SetCursorPos(ImVec2(10, 25));
/*ImGui::Image(logggo, ImVec2(100, 100));*/
ImGui::SetCursorPos(ImVec2(10, 35));
ImGui::BeginGroup();
{
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10, 4));
if (ImGui::tab("Visuals", 1, tabs == 0, ImVec2(150, 63)))
tabs = 0;
ImGui::PopStyleVar();
}
ImGui::EndGroup();
switch (tabs)
{
case 0: RageTab(); break;
case 1: RageTab(); break;
case 2: RageTab(); break;
case 3: RageTab(); break;
case 4: RageTab(); break;
case 5: RageTab(); break;
case 6: RageTab(); break;
case 7: RageTab(); break;
}
}
ImGui::End();
}
void Menu::Toggle()
{
_visible = !_visible;
}
void Menu::CreateStyle()
{
ImGui::StyleColorsDark();
ImGui::SetColorEditOptions(ImGuiColorEditFlags_HEX);
_style.FrameRounding = 0.f;
_style.WindowRounding = 0.f;
_style.ChildRounding = 0.f;
_style.Colors[ImGuiCol_Button] = ImVec4(0.260f, 0.590f, 0.980f, 0.670f);
_style.Colors[ImGuiCol_Header] = ImVec4(0.260f, 0.590f, 0.980f, 0.670f);
_style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.260f, 0.590f, 0.980f, 1.000f);
_style.Colors[ImGuiCol_FrameBg] = ImVec4(0.20f, 0.25f, 0.30f, 1.0f);
_style.Colors[ImGuiCol_WindowBg] = ImVec4(0.000f, 0.005f, 0.100f, 0.900f);
_style.Colors[ImGuiCol_PopupBg] = ImVec4(0.076f, 0.143f, 0.209f, 1.000f);
ImGui::GetStyle() = _style;
}