2022-02-28 23:04:56 +01:00
|
|
|
#pragma once
|
2022-12-22 21:23:32 +00:00
|
|
|
#include "backend/command.hpp"
|
2023-06-06 07:40:40 +00:00
|
|
|
#include "backend/int_command.hpp"
|
2022-12-22 21:23:32 +00:00
|
|
|
#include "backend/looped_command.hpp"
|
|
|
|
#include "backend/player_command.hpp"
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
#include "fiber_pool.hpp"
|
2022-02-28 23:04:56 +01:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
struct navigation_struct;
|
|
|
|
enum class tabs;
|
|
|
|
|
2022-02-28 23:04:56 +01:00
|
|
|
class components
|
|
|
|
{
|
|
|
|
static void custom_text(const std::string_view, ImFont*);
|
2023-03-01 21:27:15 +00:00
|
|
|
|
2022-02-28 23:04:56 +01:00
|
|
|
public:
|
|
|
|
static bool nav_button(const std::string_view);
|
2022-08-10 08:42:34 +08:00
|
|
|
static void icon(const std::string_view);
|
2022-02-28 23:04:56 +01:00
|
|
|
static void small_text(const std::string_view);
|
|
|
|
static void sub_title(const std::string_view);
|
|
|
|
static void title(const std::string_view);
|
2022-05-04 19:16:40 +02:00
|
|
|
static void nav_item(std::pair<tabs, navigation_struct>&, int);
|
2022-03-14 23:31:30 +01:00
|
|
|
|
|
|
|
static void input_text_with_hint(const std::string_view label, const std::string_view hint, char* buf, size_t buf_size, ImGuiInputTextFlags_ flag = ImGuiInputTextFlags_None, std::function<void()> cb = nullptr);
|
2023-04-23 17:23:00 +02:00
|
|
|
static void input_text_with_hint(const std::string_view label, const std::string_view hint, std::string* buf, ImGuiInputTextFlags_ flag = ImGuiInputTextFlags_None, std::function<void()> cb = nullptr);
|
2023-04-27 04:11:05 -04:00
|
|
|
|
2023-01-16 15:58:57 -05:00
|
|
|
static void input_text(const std::string_view label, char* buf, size_t buf_size, ImGuiInputTextFlags_ flag = ImGuiInputTextFlags_None, std::function<void()> cb = nullptr);
|
2022-03-14 23:31:30 +01:00
|
|
|
|
|
|
|
static bool selectable(const std::string_view, bool);
|
|
|
|
static bool selectable(const std::string_view, bool, ImGuiSelectableFlags);
|
|
|
|
static void selectable(const std::string_view, bool, std::function<void()>);
|
|
|
|
static void selectable(const std::string_view, bool, ImGuiSelectableFlags, std::function<void()>);
|
2022-11-12 18:35:28 +00:00
|
|
|
|
|
|
|
static bool script_patch_checkbox(const std::string_view text, bool* option, const std::string_view tooltip = "");
|
2022-12-22 21:23:32 +00:00
|
|
|
|
2023-05-19 10:30:25 +02:00
|
|
|
static void options_modal(std::string element_name, std::function<void()> render_elements, bool sameline = true, std::string custom_button_name = "Options");
|
|
|
|
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
template<template_str cmd_str, ImVec2 size = ImVec2(0, 0), ImVec4 color = ImVec4(0.24f, 0.23f, 0.29f, 1.00f)>
|
2022-12-22 21:23:32 +00:00
|
|
|
static void command_button(const std::vector<std::uint64_t> args = {}, std::optional<const std::string_view> label_override = std::nullopt)
|
|
|
|
{
|
|
|
|
static command* command = command::get(rage::consteval_joaat(cmd_str.value));
|
2023-03-13 09:26:04 +01:00
|
|
|
if (command == nullptr)
|
|
|
|
return ImGui::Text("INVALID COMMAND");
|
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
if (ImGui::Button(label_override.value_or(command->get_label()).data()))
|
|
|
|
command->call(args);
|
2022-12-29 20:43:31 -05:00
|
|
|
if (ImGui::IsItemHovered())
|
|
|
|
ImGui::SetTooltip(command->get_description().c_str());
|
2022-12-22 21:23:32 +00:00
|
|
|
}
|
|
|
|
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
template<template_str cmd_str, ImVec2 size = ImVec2(0, 0), ImVec4 color = ImVec4(0.24f, 0.23f, 0.29f, 1.00f)>
|
2022-12-22 21:23:32 +00:00
|
|
|
static void player_command_button(player_ptr player = g_player_service->get_selected(), const std::vector<std::uint64_t> args = {}, std::optional<const std::string_view> label_override = std::nullopt)
|
|
|
|
{
|
2023-04-27 04:11:05 -04:00
|
|
|
static player_command* command = dynamic_cast<player_command*>(command::get(rage::consteval_joaat(cmd_str.value)));
|
2023-03-13 09:26:04 +01:00
|
|
|
if (command == nullptr)
|
|
|
|
return ImGui::Text("INVALID COMMAND");
|
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
if (ImGui::Button(label_override.value_or(command->get_label()).data()))
|
|
|
|
command->call(player, args);
|
2022-12-29 20:43:31 -05:00
|
|
|
if (ImGui::IsItemHovered())
|
|
|
|
ImGui::SetTooltip(command->get_description().c_str());
|
2022-12-22 21:23:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<template_str cmd_str>
|
2023-05-01 23:23:07 +02:00
|
|
|
static bool command_checkbox(std::optional<const std::string_view> label_override = std::nullopt)
|
2022-12-22 21:23:32 +00:00
|
|
|
{
|
2023-04-27 04:11:05 -04:00
|
|
|
static bool_command* command = dynamic_cast<bool_command*>(command::get(rage::consteval_joaat(cmd_str.value)));
|
2023-03-13 09:26:04 +01:00
|
|
|
if (command == nullptr)
|
2023-05-01 23:23:07 +02:00
|
|
|
{
|
|
|
|
ImGui::Text("INVALID COMMAND");
|
|
|
|
return false;
|
|
|
|
}
|
2023-03-13 09:26:04 +01:00
|
|
|
|
2023-05-01 23:23:07 +02:00
|
|
|
bool updated;
|
|
|
|
if (updated = ImGui::Checkbox(label_override.value_or(command->get_label()).data(), &command->is_enabled()))
|
2022-12-22 21:23:32 +00:00
|
|
|
command->refresh();
|
2022-12-29 20:43:31 -05:00
|
|
|
if (ImGui::IsItemHovered())
|
|
|
|
ImGui::SetTooltip(command->get_description().c_str());
|
2023-05-01 23:23:07 +02:00
|
|
|
|
|
|
|
return updated;
|
2022-12-29 20:43:31 -05:00
|
|
|
}
|
|
|
|
|
2023-06-06 07:40:40 +00:00
|
|
|
template<template_str cmd_str>
|
|
|
|
static void command_int_slider(std::optional<const std::string_view> label_override = std::nullopt)
|
|
|
|
{
|
|
|
|
static int_command* command = (int_command*)command::get(rage::consteval_joaat(cmd_str.value));
|
|
|
|
if (command == nullptr)
|
|
|
|
return ImGui::Text("INVALID COMMAND");
|
|
|
|
|
|
|
|
ImGui::SliderInt(label_override.value_or(command->get_label()).data(),
|
|
|
|
&command->get_value(),
|
|
|
|
command->get_lower_bound(),
|
|
|
|
command->get_upper_bound());
|
|
|
|
|
|
|
|
if (ImGui::IsItemHovered())
|
|
|
|
ImGui::SetTooltip(command->get_description().c_str());
|
|
|
|
}
|
|
|
|
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
template<ImVec2 size = ImVec2(0, 0), ImVec4 color = ImVec4(0.24f, 0.23f, 0.29f, 1.00f)>
|
2023-03-01 21:27:15 +00:00
|
|
|
static bool button(const std::string_view text)
|
|
|
|
{
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
bool status = false;
|
2023-06-23 06:43:44 +00:00
|
|
|
|
|
|
|
if constexpr (color.x != 0.24f || color.y != 0.23f || color.z != 0.29f || color.w != 1.0f)
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_Button, color);
|
|
|
|
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
status = ImGui::Button(text.data(), size);
|
2023-06-23 06:43:44 +00:00
|
|
|
|
|
|
|
if constexpr (color.x != 0.24f || color.y != 0.23f || color.z != 0.29f || color.w != 1.0f)
|
|
|
|
ImGui::PopStyleColor(1);
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2023-07-03 14:20:27 +02:00
|
|
|
template<ImVec4 green = ImVec4(0.0f, 1.0f, 0.0f, 1.0f), ImVec4 red = ImVec4(1.0f, 0.0f, 0.0f, 1.0f)>
|
|
|
|
static void overlay_indicator(const std::string_view text, bool value)
|
|
|
|
{
|
|
|
|
ImGui::Text(std::format("{}: ", text).data());
|
2023-07-04 11:08:58 +02:00
|
|
|
ImGui::SameLine(180);
|
2023-07-03 14:20:27 +02:00
|
|
|
ImGui::TextColored(value ? green : red, value ? "Enabled" : "Disabled");
|
|
|
|
}
|
|
|
|
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
template<ImVec2 size = ImVec2(0, 0), ImVec4 color = ImVec4(0.24f, 0.23f, 0.29f, 1.00f)>
|
2023-03-01 21:27:15 +00:00
|
|
|
static void button(const std::string_view text, std::function<void()> cb)
|
|
|
|
{
|
|
|
|
if (button<size, color>(text))
|
|
|
|
{
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
g_fiber_pool->queue_job(cb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-29 20:43:31 -05:00
|
|
|
template<typename PredicateFn, typename ComponentsFn>
|
2023-03-01 21:27:15 +00:00
|
|
|
static void disable_unless(PredicateFn predicate_fn, ComponentsFn components_fn)
|
|
|
|
{
|
2022-12-29 20:43:31 -05:00
|
|
|
auto const result = predicate_fn();
|
|
|
|
if (!result)
|
|
|
|
ImGui::BeginDisabled(true);
|
|
|
|
components_fn();
|
|
|
|
if (!result)
|
|
|
|
ImGui::EndDisabled();
|
2022-12-22 21:23:32 +00:00
|
|
|
}
|
2022-02-28 23:04:56 +01:00
|
|
|
};
|
2022-05-04 19:16:40 +02:00
|
|
|
}
|