From d6ccfd242fd7a22b51ac331c401f67c87633415b Mon Sep 17 00:00:00 2001 From: Yimura Date: Thu, 31 Mar 2022 00:06:20 +0200 Subject: [PATCH] feat(GUI): Don't use natives for resolution --- BigBaseV2/src/backend/backend.cpp | 2 -- BigBaseV2/src/backend/looped/looped.hpp | 4 +--- BigBaseV2/src/backend/looped/system/screen_size.cpp | 12 ------------ BigBaseV2/src/core/globals.hpp | 3 --- BigBaseV2/src/gui/components/nav_button.cpp | 3 ++- BigBaseV2/src/views/esp/view_esp.cpp | 8 ++++---- BigBaseV2/src/views/view_active_view.cpp | 10 +++++----- BigBaseV2/src/views/view_navigation.cpp | 4 ++-- BigBaseV2/src/views/view_notifications.cpp | 4 ++-- BigBaseV2/src/views/view_vehicle.cpp | 2 +- 10 files changed, 17 insertions(+), 35 deletions(-) delete mode 100644 BigBaseV2/src/backend/looped/system/screen_size.cpp diff --git a/BigBaseV2/src/backend/backend.cpp b/BigBaseV2/src/backend/backend.cpp index 63789663..9bdf2af2 100644 --- a/BigBaseV2/src/backend/backend.cpp +++ b/BigBaseV2/src/backend/backend.cpp @@ -12,8 +12,6 @@ namespace big g->attempt_save(); QUEUE_JOB_BEGIN_CLAUSE() { - looped::system_screen_size(); - looped::system_update_pointers(); }QUEUE_JOB_END_CLAUSE diff --git a/BigBaseV2/src/backend/looped/looped.hpp b/BigBaseV2/src/backend/looped/looped.hpp index c68e9e63..4fd287ce 100644 --- a/BigBaseV2/src/backend/looped/looped.hpp +++ b/BigBaseV2/src/backend/looped/looped.hpp @@ -28,10 +28,8 @@ namespace big static void self_super_run(); static void session_local_time(); - - static void system_update_players(); + static void system_update_pointers(); - static void system_screen_size(); static void vehicle_despawn_bypass(); static void vehicle_god_mode(); diff --git a/BigBaseV2/src/backend/looped/system/screen_size.cpp b/BigBaseV2/src/backend/looped/system/screen_size.cpp deleted file mode 100644 index 21d49796..00000000 --- a/BigBaseV2/src/backend/looped/system/screen_size.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "backend/looped/looped.hpp" -#include "fiber_pool.hpp" -#include "natives.hpp" -#include "script.hpp" - -namespace big -{ - void looped::system_screen_size() - { - GRAPHICS::GET_ACTIVE_SCREEN_RESOLUTION_(&g->window.x, &g->window.y); - } -} \ No newline at end of file diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index 99dc13b3..55477d9d 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -219,9 +219,6 @@ namespace big ImFont* font_small = nullptr; bool switched_view = true; - - int x; - int y; }; struct esp diff --git a/BigBaseV2/src/gui/components/nav_button.cpp b/BigBaseV2/src/gui/components/nav_button.cpp index 7aab9738..6c63f465 100644 --- a/BigBaseV2/src/gui/components/nav_button.cpp +++ b/BigBaseV2/src/gui/components/nav_button.cpp @@ -1,4 +1,5 @@ #include "gui/components/components.hpp" +#include "pointers.hpp" namespace big { @@ -8,7 +9,7 @@ namespace big ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.f, 0.f, 0.f, 0.f)); ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, { 0.f, 0.5f }); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 0, 5 }); - bool result = ImGui::Button(text.data(), {((float)g->window.x * 0.15f) - 30, 0}); + bool result = ImGui::Button(text.data(), {((float)*g_pointers->m_resolution_x * 0.15f) - 30, 0}); ImGui::PopStyleVar(2); ImGui::PopStyleColor(2); diff --git a/BigBaseV2/src/views/esp/view_esp.cpp b/BigBaseV2/src/views/esp/view_esp.cpp index b8aa672e..83b1f98d 100644 --- a/BigBaseV2/src/views/esp/view_esp.cpp +++ b/BigBaseV2/src/views/esp/view_esp.cpp @@ -26,7 +26,7 @@ namespace big static ImColor health_red_bg = ImColor(0.69f, 0.29f, 0.29f, 0.5f); static ImColor health_red = ImColor(0.69f, 0.29f, 0.29f, 1.f); - ImGui::SetNextWindowSize({ (float)g->window.x, (float)g->window.y }); + ImGui::SetNextWindowSize({ (float)*g_pointers->m_resolution_x, (float)*g_pointers->m_resolution_y }); if (ImGui::Begin("draw_window", nullptr, ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoFocusOnAppearing)) { ImDrawList* draw_list = ImGui::GetWindowDrawList(); @@ -53,8 +53,8 @@ namespace big if (g_pointers->m_get_screen_coords_for_world_coords(player_pos.data, &screen_x, &screen_y)) { - const float esp_x = (float)g->window.x * screen_x; - const float esp_y = (float)g->window.y * screen_y; + const float esp_x = (float)*g_pointers->m_resolution_x * screen_x; + const float esp_y = (float)*g_pointers->m_resolution_y * screen_y; const float esp_side_x = esp_x + (67.5f * multplr); @@ -72,7 +72,7 @@ namespace big health_perc = health_perc < 0.f ? 0.f : health_perc; if (distance < g->esp.tracer_render_distance[1] && distance > g->esp.tracer_render_distance[0] && g->esp.tracer) - draw_list->AddLine({ (float)g->window.x * 0.5f, (float)g->window.y }, { esp_x, esp_y }, esp_color); + draw_list->AddLine({ (float)*g_pointers->m_resolution_x * 0.5f, (float)*g_pointers->m_resolution_y }, { esp_x, esp_y }, esp_color); if (distance < g->esp.box_render_distance[1] && distance > g->esp.box_render_distance[0] && g->esp.box) draw_list->AddRect({ esp_x - (62.5f * multplr), esp_y - (175.f * multplr) }, { esp_x - (62.5f * multplr) + (125.f * multplr), esp_y - (175.f * multplr) + (350.f * multplr) }, esp_color); diff --git a/BigBaseV2/src/views/view_active_view.cpp b/BigBaseV2/src/views/view_active_view.cpp index 463c1682..124a3c34 100644 --- a/BigBaseV2/src/views/view_active_view.cpp +++ b/BigBaseV2/src/views/view_active_view.cpp @@ -3,10 +3,10 @@ namespace big { void view::active_view() { - static float tabs_open_animation = -(float)g->window.x * 0.15f; + static float tabs_open_animation = -(float)*g_pointers->m_resolution_x * 0.15f; static float alpha = 0.f; - const float max_position = (float)g->window.x * 0.15f; + const float max_position = (float)*g_pointers->m_resolution_x * 0.15f; if (g->window.switched_view) { g->window.switched_view = false; @@ -18,17 +18,17 @@ namespace big switch (current_tab->tab) { case tabs::NONE: - tabs_open_animation = tabs_open_animation <= -max_position ? -max_position : max_position - (((float)g->window.x * 0.30f) * progress); + tabs_open_animation = tabs_open_animation <= -max_position ? -max_position : max_position - (((float)*g_pointers->m_resolution_x * 0.30f) * progress); break; default: - tabs_open_animation = tabs_open_animation >= max_position ? max_position : (((float)g->window.x * 0.30f) * progress) - max_position; + tabs_open_animation = tabs_open_animation >= max_position ? max_position : (((float)*g_pointers->m_resolution_x * 0.30f) * progress) - max_position; break; } }); ImGui::SetNextWindowPos({ tabs_open_animation, 0.f }, ImGuiCond_Always); - ImGui::SetNextWindowSize({ (float)g->window.x * 0.3f, (float)g->window.y }, ImGuiCond_Always); + ImGui::SetNextWindowSize({ (float)*g_pointers->m_resolution_x * 0.3f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always); ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.10f, 0.09f, 0.12f, 1.00f)); if (ImGui::Begin("main", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav)) { diff --git a/BigBaseV2/src/views/view_navigation.cpp b/BigBaseV2/src/views/view_navigation.cpp index 099a2310..237f9a44 100644 --- a/BigBaseV2/src/views/view_navigation.cpp +++ b/BigBaseV2/src/views/view_navigation.cpp @@ -5,7 +5,7 @@ namespace big { void view::navigation() { ImGui::SetNextWindowPos({ 0.f, 0.f }, ImGuiCond_Always); - ImGui::SetNextWindowSize({ (float)g->window.x * 0.15f, (float)g->window.y }, ImGuiCond_Always); + ImGui::SetNextWindowSize({ (float)*g_pointers->m_resolution_x * 0.15f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always); if (ImGui::Begin("navigation", 0, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav)) { @@ -33,7 +33,7 @@ namespace big static navigation_struct playerPage = { tabs::PLAYER, "Player", view::view_player }; - if (ImGui::BeginListBox("players", {(float)g->window.x * 0.15f - 30, (float)g->window.y * 0.3f})) { + if (ImGui::BeginListBox("players", {(float)*g_pointers->m_resolution_x * 0.15f - 30, (float)*g_pointers->m_resolution_y * 0.3f})) { for (auto& item : g_player_service->m_players) { std::unique_ptr& plyr = item.second; diff --git a/BigBaseV2/src/views/view_notifications.cpp b/BigBaseV2/src/views/view_notifications.cpp index ce1703cc..7a4f6828 100644 --- a/BigBaseV2/src/views/view_notifications.cpp +++ b/BigBaseV2/src/views/view_notifications.cpp @@ -5,8 +5,8 @@ namespace big { void view::notifications() { - ImGui::SetNextWindowSize({ (float)g->window.x * 0.2f, (float)g->window.y }); - ImGui::SetNextWindowPos({ (float)g->window.x - (float)g->window.x * 0.2f, 0 }); + ImGui::SetNextWindowSize({ (float)*g_pointers->m_resolution_x * 0.2f, (float)*g_pointers->m_resolution_y }); + ImGui::SetNextWindowPos({ (float)*g_pointers->m_resolution_x - (float)*g_pointers->m_resolution_x * 0.2f, 0 }); if (ImGui::Begin("notifications", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBringToFrontOnFocus)) { std::vector notifications = g_notification_service->get(); diff --git a/BigBaseV2/src/views/view_vehicle.cpp b/BigBaseV2/src/views/view_vehicle.cpp index 777b15af..0d81996e 100644 --- a/BigBaseV2/src/views/view_vehicle.cpp +++ b/BigBaseV2/src/views/view_vehicle.cpp @@ -30,7 +30,7 @@ namespace big bool enabled = true; - ImGui::SetNextWindowSize({ (float)g->window.x * 0.5f, (float)g->window.y * 0.5f }, ImGuiCond_FirstUseEver); + ImGui::SetNextWindowSize({ (float)*g_pointers->m_resolution_x * 0.5f, (float)*g_pointers->m_resolution_y * 0.5f }, ImGuiCond_FirstUseEver); if (ImGui::BeginPopupModal("Handling Popup", &enabled, ImGuiWindowFlags_MenuBar)) { if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT)