init
This commit is contained in:
82
TempleWare-CS2/source/templeware/menu/hud.cpp
Normal file
82
TempleWare-CS2/source/templeware/menu/hud.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "hud.h"
|
||||
#include "../../../external/imgui/imgui.h"
|
||||
#include "../config/config.h"
|
||||
#include "../hooks/hooks.h"
|
||||
#include <ctime>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <DirectXMath.h>
|
||||
|
||||
std::string g_DebugString;
|
||||
|
||||
Hud::Hud() {
|
||||
|
||||
}
|
||||
|
||||
float CalculateFovRadius(float fovDegrees, float screenWidth, float screenHeight, float gameVerticalFOV) {
|
||||
float aspectRatio = screenWidth / screenHeight;
|
||||
float fovRadians = fovDegrees * (DirectX::XM_PI / 180.0f);
|
||||
|
||||
float screenRadius = std::tan(fovRadians / 2.0f) * (screenHeight / 2.0f) / std::tan(gameVerticalFOV * (DirectX::XM_PI / 180.0f) / 2.0f);
|
||||
|
||||
static float flScalingMultiplier = 2.5f;
|
||||
|
||||
return screenRadius * flScalingMultiplier;
|
||||
}
|
||||
|
||||
void RenderFovCircle(ImDrawList* drawList, float fov, ImVec2 screenCenter, float screenWidth, float screenHeight, float thickness) {
|
||||
float radius = CalculateFovRadius(fov, screenWidth, screenHeight, H::g_flActiveFov);
|
||||
uint32_t color = ImGui::ColorConvertFloat4ToU32(Config::fovCircleColor);
|
||||
drawList->AddCircle(screenCenter, radius, color, 100, thickness);
|
||||
}
|
||||
|
||||
void Hud::render() {
|
||||
|
||||
// Time
|
||||
std::time_t now = std::time(nullptr);
|
||||
std::tm localTime;
|
||||
localtime_s(&localTime, &now);
|
||||
char timeBuffer[9];
|
||||
std::strftime(timeBuffer, sizeof(timeBuffer), "%H:%M:%S", &localTime);
|
||||
|
||||
// FPS
|
||||
float fps = ImGui::GetIO().Framerate;
|
||||
std::ostringstream fpsStream;
|
||||
fpsStream << static_cast<int>(fps) << " FPS";
|
||||
|
||||
// WaterMark
|
||||
std::string watermarkText = "TempleWare | " + fpsStream.str() + " | " + timeBuffer;
|
||||
|
||||
ImVec2 textSize = ImGui::CalcTextSize(watermarkText.c_str());
|
||||
float padding = 5.0f;
|
||||
ImVec2 pos = ImVec2(10, 10);
|
||||
ImVec2 rectSize = ImVec2(textSize.x + padding * 2, textSize.y + padding * 2);
|
||||
|
||||
ImU32 bgColor = IM_COL32(50, 50, 50, 200);
|
||||
ImU32 borderColor = IM_COL32(153, 76, 204, 255);
|
||||
ImU32 textColor = IM_COL32(255, 255, 255, 255);
|
||||
|
||||
ImDrawList* drawList = ImGui::GetBackgroundDrawList();
|
||||
|
||||
drawList->AddRectFilled(pos, ImVec2(pos.x + rectSize.x, pos.y + rectSize.y), bgColor);
|
||||
|
||||
float lineThickness = 2.0f;
|
||||
drawList->AddLine(pos, ImVec2(pos.x, pos.y + rectSize.y), borderColor, lineThickness);
|
||||
drawList->AddLine(ImVec2(pos.x + rectSize.x, pos.y), ImVec2(pos.x + rectSize.x, pos.y + rectSize.y), borderColor, lineThickness);
|
||||
|
||||
ImVec2 textPos = ImVec2(pos.x + padding, pos.y + padding);
|
||||
drawList->AddText(textPos, textColor, watermarkText.c_str());
|
||||
|
||||
if (Config::fov_circle) {
|
||||
ImVec2 Center = ImVec2(ImGui::GetIO().DisplaySize.x / 2.f, ImGui::GetIO().DisplaySize.y / 2.f);
|
||||
|
||||
RenderFovCircle(drawList, Config::aimbot_fov, Center, ImGui::GetIO().DisplaySize.x, ImGui::GetIO().DisplaySize.y, 1.f);
|
||||
}
|
||||
|
||||
// Debug overlay
|
||||
if (!g_DebugString.empty()) {
|
||||
ImVec2 debugPos = ImVec2(10, 40); // чуть ниже watermark
|
||||
ImU32 debugColor = IM_COL32(255, 255, 0, 255); // жёлтый
|
||||
ImGui::GetBackgroundDrawList()->AddText(debugPos, debugColor, g_DebugString.c_str());
|
||||
}
|
||||
}
|
||||
9
TempleWare-CS2/source/templeware/menu/hud.h
Normal file
9
TempleWare-CS2/source/templeware/menu/hud.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
extern std::string g_DebugString;
|
||||
|
||||
class Hud {
|
||||
public:
|
||||
Hud();
|
||||
void render();
|
||||
};
|
||||
315
TempleWare-CS2/source/templeware/menu/menu.cpp
Normal file
315
TempleWare-CS2/source/templeware/menu/menu.cpp
Normal file
@@ -0,0 +1,315 @@
|
||||
#include "menu.h"
|
||||
#include "../config/config.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "../config/configmanager.h"
|
||||
|
||||
#include "../keybinds/keybinds.h"
|
||||
|
||||
#include "../utils/logging/log.h"
|
||||
|
||||
void ApplyImGuiTheme() {
|
||||
ImGui::StyleColorsDark();
|
||||
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImVec4* colors = style.Colors;
|
||||
|
||||
ImVec4 primaryColor = ImVec4(0.44f, 0.23f, 0.78f, 1.0f);
|
||||
ImVec4 outlineColor = ImVec4(0.54f, 0.33f, 0.88f, 0.7f);
|
||||
|
||||
colors[ImGuiCol_WindowBg] = ImVec4(0.11f, 0.11f, 0.13f, 1.0f);
|
||||
colors[ImGuiCol_Border] = ImVec4(0.30f, 0.30f, 0.30f, 1.0f);
|
||||
colors[ImGuiCol_FrameBg] = ImVec4(0.11f, 0.11f, 0.13f, 1.0f);
|
||||
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.15f, 0.15f, 0.18f, 1.0f);
|
||||
colors[ImGuiCol_FrameBgActive] = ImVec4(0.15f, 0.15f, 0.18f, 1.0f);
|
||||
colors[ImGuiCol_TitleBg] = ImVec4(0.11f, 0.11f, 0.13f, 1.0f);
|
||||
colors[ImGuiCol_TitleBgActive] = ImVec4(0.11f, 0.11f, 0.13f, 1.0f);
|
||||
colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.13f, 1.0f);
|
||||
|
||||
colors[ImGuiCol_Button] = primaryColor;
|
||||
colors[ImGuiCol_ButtonHovered] = ImVec4(0.54f, 0.33f, 0.88f, 1.0f);
|
||||
colors[ImGuiCol_ButtonActive] = ImVec4(0.34f, 0.13f, 0.68f, 1.0f);
|
||||
|
||||
colors[ImGuiCol_CheckMark] = ImVec4(0.80f, 0.50f, 1.00f, 1.0f);
|
||||
colors[ImGuiCol_SliderGrab] = primaryColor;
|
||||
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.54f, 0.33f, 0.88f, 1.0f);
|
||||
|
||||
colors[ImGuiCol_Header] = primaryColor;
|
||||
colors[ImGuiCol_HeaderHovered] = ImVec4(0.54f, 0.33f, 0.88f, 1.0f);
|
||||
colors[ImGuiCol_HeaderActive] = ImVec4(0.34f, 0.13f, 0.68f, 1.0f);
|
||||
|
||||
colors[ImGuiCol_Separator] = ImVec4(0.34f, 0.13f, 0.68f, 1.0f);
|
||||
colors[ImGuiCol_SeparatorHovered] = primaryColor;
|
||||
colors[ImGuiCol_SeparatorActive] = ImVec4(0.54f, 0.33f, 0.88f, 1.0f);
|
||||
|
||||
colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
|
||||
colors[ImGuiCol_Tab] = ImVec4(0.17f, 0.17f, 0.21f, 1.0f);
|
||||
colors[ImGuiCol_TabHovered] = ImVec4(0.44f, 0.23f, 0.78f, 0.8f);
|
||||
colors[ImGuiCol_TabActive] = primaryColor;
|
||||
colors[ImGuiCol_TabUnfocused] = ImVec4(0.17f, 0.17f, 0.21f, 1.0f);
|
||||
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.34f, 0.13f, 0.68f, 1.0f);
|
||||
|
||||
colors[ImGuiCol_Border] = outlineColor;
|
||||
colors[ImGuiCol_BorderShadow] = ImVec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
style.WindowRounding = 0.0f;
|
||||
style.FrameRounding = 0.0f;
|
||||
style.ScrollbarRounding = 0.0f;
|
||||
style.GrabRounding = 0.0f;
|
||||
style.TabRounding = 0.0f;
|
||||
style.ChildRounding = 0.0f;
|
||||
style.PopupRounding = 0.0f;
|
||||
|
||||
style.ItemSpacing = ImVec2(8, 4);
|
||||
style.FramePadding = ImVec2(4, 3);
|
||||
style.WindowPadding = ImVec2(8, 8);
|
||||
|
||||
style.FrameBorderSize = 1.0f;
|
||||
style.TabBorderSize = 1.0f;
|
||||
style.WindowBorderSize = 1.0f;
|
||||
style.PopupBorderSize = 1.0f;
|
||||
style.ChildBorderSize = 1.0f;
|
||||
|
||||
style.GrabMinSize = 7.0f;
|
||||
}
|
||||
|
||||
Menu::Menu() {
|
||||
activeTab = 0;
|
||||
showMenu = true;
|
||||
}
|
||||
|
||||
void Menu::init(HWND& window, ID3D11Device* pDevice, ID3D11DeviceContext* pContext, ID3D11RenderTargetView* mainRenderTargetView) {
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.ConfigFlags = ImGuiConfigFlags_NoMouseCursorChange;
|
||||
ImGui_ImplWin32_Init(window);
|
||||
ImGui_ImplDX11_Init(pDevice, pContext);
|
||||
|
||||
ApplyImGuiTheme();
|
||||
|
||||
io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\arial.ttf", 16.0f);
|
||||
|
||||
std::cout << "initialized menu\n";
|
||||
}
|
||||
|
||||
void Menu::render() {
|
||||
keybind.pollInputs();
|
||||
if (showMenu) {
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoTitleBar;
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(600, 400), ImGuiCond_Once);
|
||||
ImGui::SetNextWindowPos(ImVec2(50, 50), ImGuiCond_Once);
|
||||
|
||||
ImGui::Begin("TempleWare | Internal", nullptr, window_flags);
|
||||
|
||||
{
|
||||
float windowWidth = ImGui::GetWindowWidth();
|
||||
float rightTextWidth = ImGui::CalcTextSize("templecheats.xyz").x;
|
||||
|
||||
ImGui::Text("TempleWare - Internal");
|
||||
|
||||
ImGui::SameLine(windowWidth - rightTextWidth - 10);
|
||||
ImGui::Text("templecheats.xyz");
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
const char* tabNames[] = { "Aim", "Visuals", "Misc", "Config" };
|
||||
|
||||
if (ImGui::BeginTabBar("MainTabBar", ImGuiTabBarFlags_NoTooltip)) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (ImGui::BeginTabItem(tabNames[i])) {
|
||||
activeTab = i;
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
|
||||
ImGui::BeginChild("ContentRegion", ImVec2(0, 0), false);
|
||||
|
||||
switch (activeTab) {
|
||||
case 0:
|
||||
{
|
||||
ImGui::BeginChild("AimLeft", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f - 5, 0), true);
|
||||
ImGui::Text("General");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Enable##AimBot", &Config::aimbot);
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("Key:");
|
||||
ImGui::SameLine();
|
||||
keybind.menuButton(Config::aimbot);
|
||||
|
||||
ImGui::Checkbox("Team Check", &Config::team_check);
|
||||
ImGui::SliderFloat("FOV", &Config::aimbot_fov, 0.f, 90.f);
|
||||
ImGui::Checkbox("Draw FOV Circle", &Config::fov_circle);
|
||||
if (Config::fov_circle) {
|
||||
ImGui::ColorEdit4("Circle Color##FovColor", (float*)&Config::fovCircleColor);
|
||||
}
|
||||
ImGui::Checkbox("Recoil Control", &Config::rcs);
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginChild("AimRight", ImVec2(0, 0), true);
|
||||
ImGui::Text("TriggerBot");
|
||||
ImGui::Separator();
|
||||
ImGui::Text("No additional settings");
|
||||
|
||||
ImGui::EndChild();
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
ImGui::BeginChild("VisualsLeft", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f - 5, 0), true);
|
||||
ImGui::Text("Player ESP");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Box", &Config::esp);
|
||||
ImGui::SliderFloat("Thickness", &Config::espThickness, 1.0f, 5.0f);
|
||||
ImGui::Checkbox("Box Fill", &Config::espFill);
|
||||
if (Config::espFill) {
|
||||
ImGui::SliderFloat("Fill Opacity", &Config::espFillOpacity, 0.0f, 1.0f);
|
||||
}
|
||||
ImGui::ColorEdit4("ESP Color##BoxColor", (float*)&Config::espColor);
|
||||
ImGui::Checkbox("Team Check", &Config::teamCheck);
|
||||
ImGui::Checkbox("Health Bar", &Config::showHealth);
|
||||
ImGui::Checkbox("Name Tags", &Config::showNameTags);
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("World");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Night Mode", &Config::Night);
|
||||
if (Config::Night) {
|
||||
ImGui::ColorEdit4("Night Color", (float*)&Config::NightColor);
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Custom FOV", &Config::fovEnabled);
|
||||
if (Config::fovEnabled) {
|
||||
ImGui::SliderFloat("FOV Value##FovSlider", &Config::fov, 20.0f, 160.0f, "%1.0f");
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginChild("VisualsRight", ImVec2(0, 0), true);
|
||||
ImGui::Text("Chams");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Chams##ChamsCheckbox", &Config::enemyChams);
|
||||
const char* chamsMaterials[] = { "Flat", "Illuminate", "Glow" };
|
||||
ImGui::Combo("Material", &Config::chamsMaterial, chamsMaterials, IM_ARRAYSIZE(chamsMaterials));
|
||||
if (Config::enemyChams) {
|
||||
ImGui::ColorEdit4("Chams Color##ChamsColor", (float*)&Config::colVisualChams);
|
||||
}
|
||||
ImGui::Checkbox("Chams-XQZ", &Config::enemyChamsInvisible);
|
||||
if (Config::enemyChamsInvisible) {
|
||||
ImGui::ColorEdit4("XQZ Color##ChamsXQZColor", (float*)&Config::colVisualChamsIgnoreZ);
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("Hand Chams");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Hand Chams", &Config::armChams);
|
||||
if (Config::armChams) {
|
||||
ImGui::ColorEdit4("Hand Color##HandChamsColor", (float*)&Config::colArmChams);
|
||||
}
|
||||
ImGui::Checkbox("Viewmodel Chams", &Config::viewmodelChams);
|
||||
if (Config::viewmodelChams) {
|
||||
ImGui::ColorEdit4("Viewmodel Color##ViewModelChamsColor", (float*)&Config::colViewmodelChams);
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("Removals");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Anti Flash", &Config::antiflash);
|
||||
|
||||
ImGui::EndChild();
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
ImGui::BeginChild("MiscLeft", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f - 5, 0), true);
|
||||
ImGui::Text("Movement");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("No additional settings");
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginChild("MiscRight", ImVec2(0, 0), true);
|
||||
ImGui::Text("Other");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("No additional settings");
|
||||
|
||||
ImGui::EndChild();
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
{
|
||||
ImGui::BeginChild("ConfigLeft", ImVec2(ImGui::GetContentRegionAvail().x * 0.5f - 5, 0), true);
|
||||
ImGui::Text("General");
|
||||
ImGui::Separator();
|
||||
|
||||
static char configName[128] = "";
|
||||
static std::vector<std::string> configList = internal_config::ConfigManager::ListConfigs();
|
||||
static int selectedConfigIndex = -1;
|
||||
|
||||
ImGui::InputText("Config Name", configName, IM_ARRAYSIZE(configName));
|
||||
|
||||
if (ImGui::Button("Refresh")) {
|
||||
configList = internal_config::ConfigManager::ListConfigs();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Load")) {
|
||||
internal_config::ConfigManager::Load(configName);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Save")) {
|
||||
internal_config::ConfigManager::Save(configName);
|
||||
configList = internal_config::ConfigManager::ListConfigs();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Delete")) {
|
||||
internal_config::ConfigManager::Remove(configName);
|
||||
configList = internal_config::ConfigManager::ListConfigs();
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginChild("ConfigRight", ImVec2(0, 0), true);
|
||||
ImGui::Text("Saved Configs");
|
||||
ImGui::Separator();
|
||||
|
||||
for (int i = 0; i < static_cast<int>(configList.size()); i++) {
|
||||
if (ImGui::Selectable(configList[i].c_str(), selectedConfigIndex == i)) {
|
||||
selectedConfigIndex = i;
|
||||
strncpy_s(configName, sizeof(configName), configList[i].c_str(), _TRUNCATE);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::toggleMenu() {
|
||||
showMenu = !showMenu;
|
||||
}
|
||||
20
TempleWare-CS2/source/templeware/menu/menu.h
Normal file
20
TempleWare-CS2/source/templeware/menu/menu.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <Windows.h>
|
||||
#include <d3d11.h>
|
||||
#include "../../../external/imgui/imgui.h"
|
||||
#include "../../../external/imgui/imgui_impl_dx11.h"
|
||||
#include "../../../external/imgui/imgui_impl_win32.h"
|
||||
|
||||
|
||||
class Menu {
|
||||
public:
|
||||
Menu();
|
||||
|
||||
void init(HWND& window, ID3D11Device* pDevice, ID3D11DeviceContext* pContext, ID3D11RenderTargetView* mainRenderTargetView);
|
||||
void render();
|
||||
|
||||
void toggleMenu();
|
||||
private:
|
||||
bool showMenu;
|
||||
int activeTab;
|
||||
};
|
||||
Reference in New Issue
Block a user