Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Largura e altura do mod
- float ModLargura = 320;
- float ModAltura = 500;
- float tamanhoFonte = 0.8f;
- float transparenciaMod = 0.8f;
- int menuAtual = 0; //Index do menu atual
- int menuAnterior = 0; //Index do menu atual
- int contadorOpcoes = 0; //Armazena quantas opcoes tem o menu atual
- int opcaoSelecionada = 0; //Armazena a opcao que ta selecionada no momento, no menu
- float varTestes = 0.8f;
- int timer = 0;
- float bordaRedonda = 0.0;
- float ajustefino2 = 0.0;
- static ImVec4 CorTopo = ImVec4(0.2f, 1.0f, 0.2f, 0.8f);
- float testes[100];
- namespace BRESO
- {
- #define IsKeyPressed(key) GetAsyncKeyState(key) & 0x8000
- enum Menus
- {
- fechado,
- Principal,
- Config,
- Config2,
- };
- void Vazio() {}
- bool Timer(int tempo = 50)
- {
- if (timer >= tempo)
- {
- timer = 0;
- return true;
- }
- timer++;
- return false;
- }
- void Controles()
- {
- if (IsKeyPressed(VK_INSERT))
- {
- //Abrir o menu
- if (Timer())
- {
- if (menuAtual == 0)
- menuAtual = 1;
- else
- menuAtual = 0;
- }
- }
- //if (IsKeyPressed(VK_UP))
- //{
- // if (Timer(30))
- // {
- // if (opcaoSelecionada == 1)
- // opcaoSelecionada = contadorOpcoes;
- // else
- // opcaoSelecionada--;
- // }
- //}
- //if (IsKeyPressed(VK_DOWN))
- //{
- // if (Timer(30))
- // {
- // if (opcaoSelecionada == contadorOpcoes)
- // opcaoSelecionada = 1;
- // else
- // opcaoSelecionada++;
- // }
- //}
- }
- template<typename Func>
- void addOption(const char* Texto, Func function, int indexOpcao = 0)
- {
- contadorOpcoes++;
- ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.06f, 0.06f, 0.06f, 0.0));
- ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0, 0.0)); // alinhar texto do botão à esquerda
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0, 2.0));
- if (ImGui::Button(Texto, ImVec2(ImGui::GetWindowContentRegionWidth(), 25))) {
- function();
- }
- ImGui::PopStyleVar(2);
- ImGui::PopStyleColor(3);
- }
- template<typename Func>
- void addBool(const char* Texto, bool* boleta, Func function, int indexOpcao = 0)
- {
- contadorOpcoes++;
- if (*boleta)
- {
- ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.0, 1.0, 0.0, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.0, 1.0, 0.0, CorTopo.w));
- }
- else
- {
- ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(1.2, 0.2, 0.2, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(1.0, 0.0, 0.0, CorTopo.w));
- }
- char buffer[5000];
- snprintf(buffer, 5000, " %s", Texto);
- ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0, 0.0)); // alinhar texto do botão à esquerda
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0,2.0));
- ImGui::Text(buffer);
- ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetFontSize() - ImGui::GetStyle().FramePadding.x - 17.000);
- char buffer2[5000];
- snprintf(buffer2, 5000, "##%s", Texto);
- ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 12.0f);
- if (boleta)
- {
- if (ImGui::Checkbox(buffer2, boleta)) {
- function();
- }
- }
- else
- {
- if (ImGui::Checkbox(buffer2, boleta)) {
- function();
- }
- }
- ImGui::PopStyleVar(3);
- ImGui::PopStyleColor(3);
- //-----------------------------------------------------------
- // ..
- }
- void addBreak()
- {
- contadorOpcoes++;
- ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.06f, 0.06f, 0.06f, 0.0));
- ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- //ImGui::PushStyleVar(ImGuiStyleVar_FrameBgTextAlign, ImVec2(0.0, 0.5)); // alinhar texto do botão à esquerda
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0,2.0));
- ImGui::Separator();
- ImGui::PopStyleVar(1);
- ImGui::PopStyleColor(3);
- }
- template<typename Func>
- void addFloat_Drag(const char* Texto, float* variavel, float min, float max, float velocidade, Func function, int indexOpcao = 0)
- {
- ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.06f, 0.06f, 0.06f, 0.0));
- ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- //ImGui::PushStyleVar(ImGuiStyleVar_FrameBgTextAlign, ImVec2(0.0, 0.5)); // alinhar texto do botão à esquerda
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0, 2.0));
- if (ImGui::DragFloat(Texto, variavel, velocidade, min, max)) {
- function();
- }
- ImGui::PopStyleVar(1);
- ImGui::PopStyleColor(3);
- }
- template<typename Func>
- void addFloat_Input(const char* Texto, float* variavel, float min, float max, float velocidade, Func function, int indexOpcao = 0)
- {
- contadorOpcoes++;
- ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.06f, 0.06f, 0.06f, 0.0));
- ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.06f, 0.06f, 0.06f, 0.0f));
- ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- //ImGui::PushStyleVar(ImGuiStyleVar_FrameBgTextAlign, ImVec2(0.0, 0.5)); // alinhar texto do botão à esquerda
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0, 2.0));
- if (ImGui::InputFloat(Texto, variavel, velocidade)) {
- function();
- }
- float a = *variavel;
- if (*variavel > max)
- *variavel = max;
- else if (*variavel <= min)
- *variavel = min;
- ImGui::PopStyleVar(1);
- ImGui::PopStyleColor(7);
- }
- template<typename Func>
- void addSubMenu(const char* Texto, int MenuAtual, int MenuIndex, Func function = Vazio())
- {
- contadorOpcoes++;
- ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.06f, 0.06f, 0.06f, 0.0));
- ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0, 0.0)); // alinhar texto do botão à esquerda
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0, 2.0));
- if (ImGui::Button(Texto, ImVec2(ImGui::GetWindowContentRegionWidth(), 25))) {
- function();
- menuAnterior = MenuAtual;
- menuAtual = MenuIndex;
- }
- ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetFontSize() - ImGui::GetStyle().FramePadding.x - 8.0);
- ImGui::Text(">>");
- ImGui::PopStyleVar(2);
- ImGui::PopStyleColor(3);
- }
- template<typename Func>
- void Menu(const char* Titulo, Func function)
- {
- ImGui::SetNextWindowBgAlpha(transparenciaMod);
- ImGuiStyle& style = ImGui::GetStyle();
- //style.WindowPadding.x = -4.0;
- //style.WindowPadding.y = 23.0;
- style.WindowRounding = bordaRedonda;
- ImGui::SetNextWindowSize(ImVec2(ModLargura, ModAltura)); // definir tamanho da janela
- ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(-4.0, 1.0));
- ImGui::Begin(Titulo, nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar);
- {
- ImGui::SetWindowFontScale(tamanhoFonte);
- ImGui::SetCursorPos(ImVec2((ImGui::GetWindowWidth() - ImGui::GetWindowContentRegionWidth()) / 2, 0)); // centralizar botão no topo
- ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.5, 0.5)); // alinhar texto do botão à esquerda
- ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.06f, 0.06f, 0.06f, 1.0));
- if (ImGui::Button(Titulo, ImVec2(ImGui::GetWindowContentRegionWidth(), 50))) {
- }
- ImGui::PopStyleColor(4);
- ImGui::PopStyleVar();
- ImGui::BeginChild("##");
- {
- function();
- }
- ImGui::EndChild();
- }
- ImGui::PopStyleVar();
- ImGui::End();
- contadorOpcoes = 0;
- }
- template<typename Func>
- void addColor(const char* Texto, ImVec4* corVariavel, Func function, int indexOpcao = 0)
- {
- contadorOpcoes++;
- ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.0, 0.0, 0.0, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.0, 1.0, 0.0, CorTopo.w));
- ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0, 0.0)); // alinhar texto do botão à esquerda
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0, 2.0));
- char buffer[5000];
- snprintf(buffer, 5000, " %s", Texto);
- ImGui::Text(buffer);
- ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetFontSize() - ImGui::GetStyle().FramePadding.x - 15.000);
- char buffer2[5000];
- snprintf(buffer2, 5000, "##%s", Texto);
- if (ImGui::ColorEdit4(buffer2, (float*)corVariavel, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel))
- {
- function();
- }
- ImGui::PopStyleVar(2);
- ImGui::PopStyleColor(3);
- //-----------------------------------------------------------
- // ..
- }
- template<typename Func>
- void addArray(const char* TextoBotao, const char* descricaoCombo, int* itemAtual, const char* const Array[], Func function, int indexOpcao = 0)
- {
- contadorOpcoes++;
- ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.06f, 0.06f, 0.06f, 0.0));
- ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(CorTopo.x, CorTopo.y, CorTopo.z, CorTopo.w));
- ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(-1.400, 34.000)); // alinhar texto do botão à esquerda
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(6.000, 5.000));
- ImGui::Text(descricaoCombo);
- ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetFontSize() - ImGui::GetStyle().FramePadding.x - 70.000);
- ImGui::SameLine();
- ImGui::SetNextItemWidth(180.000);
- ImGui::Combo(" ", itemAtual, Array, sizeof(Array));
- ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetFontSize() - ImGui::GetStyle().FramePadding.x - 70.000);
- ImGui::SetNextItemWidth(5.000);
- if (ImGui::Button(TextoBotao))
- {
- function();
- }
- ImGui::PopStyleVar(2);
- ImGui::PopStyleColor(8);
- }
- }
Add Comment
Please, Sign In to add comment