-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
#include "Renderer.hpp"
namespace yougame::ui
{
static int tab_index = 0;
static float border_bang = 1.0f;
static int old_tab_index = 0;
float menu_alpha;
bool main_menu_open = false;
namespace Main::Menu
{
static bool sex{ false };
Vector2 window_pos{ 50, 50 }, mouse_pos, next_item_pos;
Vector2 window_sizemain;
Vector2 old_mouse_pos;
bool mouse_state, insert_state;
rust::classes::EventType menu_event;
bool old_mouse_state, old_insert_state;
bool is_menu_open{ true };
bool interacting;
bool is_mouse_in_box(const Vector2& pos1, const Vector2& pos2) {
if (old_mouse_pos.x < pos1.x || old_mouse_pos.y < pos1.y)
return false;
if (old_mouse_pos.x > pos2.x || old_mouse_pos.y > pos2.y)
return false;
return true;
}
bool windowNew(wchar_t* title, const Vector2& pos, const Vector2& window_size, bool always_open)
{
if (!sex) {
window_pos = pos;
sex = true;
}
auto mouse = get_mousePosition();
auto width = unity::get_width();
auto height = unity::get_height();
window_sizemain = window_size;
menu_event = Unity::methods::get_type(Unity::methods::get_current());
const auto key_code = unity::get_keyCode(Unity::methods::get_current());
insert_state = menu_event == rust::classes::EventType::KeyDown && key_code == rust::classes::KeyCode::Insert;
mouse_pos.x = get_mousePosition().x;
mouse_pos.y = unity::get_height() - get_mousePosition().y;
mouse_state = GetMouseButton(0);
if (insert_state && !old_insert_state && !always_open)
is_menu_open = !is_menu_open;
if (is_menu_open)
{
menu_alpha = min(menu_alpha + 7, 255);
}
if (!is_menu_open) {
menu_alpha = max(menu_alpha - 7, 0);
if (menu_alpha == 0)
return false;
}
if (is_mouse_in_box({ window_pos.x, window_pos.y }, { window_pos.x + window_size.x, window_pos.y + 20 }) && mouse_state && main_menu_open) {
window_pos.x += mouse_pos.x - old_mouse_pos.x;
window_pos.y += mouse_pos.y - old_mouse_pos.y;
}
if (menu_event == rust::classes::EventType::Repaint)
{
if (is_menu_open)
{
Unity::FullRect({ window_pos.x, window_pos.y, window_size.x, window_size.y }, { 18,16,19, 255 });
Unity::Text(window_pos.x + 5.f - 105.f, window_pos.y + 5.f, 300, 70, (title), CColor::Color(100, 102, 189, 255), true, true, 18.f);
}
}
return true;
}
int table = 0;
void TabNew2(const wchar_t* name, int id, Vector2 tab_size = Vector2(100.f, 50.f)) {
if (menu_event == rust::classes::EventType::MouseDown)
if (is_mouse_in_box({ window_pos.x - (id * 166.6f) + 390, window_pos.y + 18 }, { window_pos.x + tab_size.x - (id * 166.6f) + 390, window_pos.y + tab_size.y + 18 }) && mouse_state)
Vars::User::activetab = id;
if (menu_event == rust::classes::EventType::Repaint) {
Unity::FullRect({ window_pos.x - (id * 166.6f) + 342, window_pos.y + 18, 150.f, 50.f }, id == Vars::User::activetab ? CColor::Color(21, 21, 21, 255) : CColor::Color(0, 0, 0, 0));
Unity::Text(window_pos.x - (id * 166.6f) + 390, window_pos.y + 28, 300, 70, (name), CColor::Color(255, 255, 255, 255), false, false, 18.f);
}
}
void CheckBox(const wchar_t* title, bool& value, CColor::Color clr = CColor::Color(255, 255, 255, 255)) {
if (is_mouse_in_box({ next_item_pos.x - 6, next_item_pos.y }, { next_item_pos.x - 6 + 10, next_item_pos.y + 10 }) && mouse_state && !old_mouse_state && !interacting)
value = !value;
Unity::FullRect({ next_item_pos.x - 6, next_item_pos.y , 10, 10 }, value ? CColor::Color(112, 149, 46, 255) : CColor::Color(65, 65, 65, 255));
Unity::Text(next_item_pos.x + 10, next_item_pos.y - 4.f, 300, 20, title, CColor::Color(255, 255, 255, 255), false, true, 14);
next_item_pos.y += 22;
}
void Slider(const wchar_t* title, float& value, int min, int max)
{
next_item_pos.x -= 6;
if (is_mouse_in_box({ next_item_pos.x, next_item_pos.y }, { next_item_pos.x + 145, next_item_pos.y + 25 }) && mouse_state && !interacting) {
value = float((old_mouse_pos.x - (next_item_pos.x)) * (max - min) / 140);
}
if (menu_event == rust::classes::EventType::Repaint)
{
char m_szValue[10];
wchar_t m_wszValue[10];
Unity::itoa(static_cast<float>(value), m_szValue, 10);
Unity::AnsiToUnicode(m_szValue, m_wszValue);
Unity::Rect({ next_item_pos.x, next_item_pos.y + 16 }, { 141, 3 }, { 0,0,0, 255 });
Unity::FullRect({ next_item_pos.x, next_item_pos.y + 16, 140, 2 }, { 42, 40, 43, 255 });
Unity::FullRect({ next_item_pos.x, next_item_pos.y + 16, static_cast<float>((value * 140) / max), 2 }, { 50, 255, 50, 255 });
Unity::Text(next_item_pos.x + static_cast<float>((value * 140) / max) - 1.f, next_item_pos.y + 9, 300, 20, m_wszValue, { 252,239,240, 255 }, false, true, 10.f);
Unity::Text(next_item_pos.x, next_item_pos.y, 300, 20, title, { 255,255,255, 255 }, false, true);
}
next_item_pos.x += 6;
next_item_pos.y += 35;
}
void TabChild(const wchar_t* title, const Vector2& pos, const Vector2& size)
{
Unity::Text(window_pos.x + pos.x + 6.f + 1, window_pos.y + pos.y - 10.f + 2, 300, 20, title, { 62,60,63, 0 }, false, false);
next_item_pos = { window_pos.x + pos.x + 15, window_pos.y + pos.y + 17 };
}
void end_window() {
old_insert_state = insert_state;
old_mouse_pos = mouse_pos;
old_mouse_state = mouse_state;
}
}
void RenderMenu()
{
Unity::init();
main_menu_open = Main::Menu::windowNew(_(L""), { 50,50 }, { 500,480 }, false);
if (main_menu_open)
{
if (Main::Menu::is_menu_open)
{
Main::Menu::TabNew2(_(L"Aimbot"), 2);
Main::Menu::TabNew2(_(L"ESP"), 1);
Main::Menu::TabNew2(_(L"Misc"), 0);
switch (Vars::User::activetab)
{
case 0:
Main::Menu::TabChild(_(L"Misc"), { 60, 60 }, { 200, 355 });
{
}
Main::Menu::TabChild(_(L"LocalPlayer"), { 240, 60 }, { 200, 355 });
{
}
break;
case 1:
Main::Menu::TabChild(_(L"Player"), { 60, 60 }, { 200, 355 });
{
}
Main::Menu::TabChild(_(L"World"), { 240, 60 }, { 200, 355 });
{
}
break;
case 2:
Main::Menu::TabChild(_(L"Aimbot"), { 60, 60 }, { 125, 355 });
{
}
Main::Menu::TabChild(_(L"Other"), { 240, 60 }, { 200, 355 });
{
}
break;
}
}
}
Main::Menu::end_window();
return;
}
}