feat(GUI): Don't use natives for resolution

This commit is contained in:
Yimura 2022-03-31 00:06:20 +02:00
parent 05c117f58b
commit d6ccfd242f
10 changed files with 17 additions and 35 deletions

View File

@ -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

View File

@ -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();

View File

@ -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);
}
}

View File

@ -219,9 +219,6 @@ namespace big
ImFont* font_small = nullptr;
bool switched_view = true;
int x;
int y;
};
struct esp

View File

@ -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);

View File

@ -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);

View File

@ -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))
{

View File

@ -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<player>& plyr = item.second;

View File

@ -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<notification> notifications = g_notification_service->get();

View File

@ -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)