-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Сделал KeyBinds для CSGOSimple (спастил)
menu.cpp
Хочу сделать бинд на thirdperson (menu.cpp)
options.hpp
При компиле пишет ошибку: error C2664: "bool KeyBind(const char *,int &)": невозможно преобразовать аргумент 2 из "Var<int>" в "int &"
menu.cpp
C++:
using KeyBindPair_t = std::pair< int, const char* >;
std::vector< KeyBindPair_t > ButtonNames{
{ 0, ("None") },
{ 1, ("Left Mouse") },
{ 2, ("Right Mouse") },
{ 3, ("Scroll Lock") },
{ 4, ("Middle Mouse") },
{ 5, ("X1 Mouse") },
{ 6, ("X2 Mouse") },
{ 8, ("Backspace") },
{ 9, ("Tab") },
{ 12, ("Num 5") },
{ 13, ("Enter") },
{ 16, ("Shift") },
{ 17, ("Ctrl") },
{ 18, ("Alt") },
{ 20, ("Caps Lock") },
{ 27, ("Esc") },
{ 32, ("Space") },
{ 33, ("Num 9") },
{ 34, ("Num 3") },
{ 35, ("Num 1") },
{ 36, ("Num 7") },
{ 37, ("Num 4") },
{ 38, ("Num 8") },
{ 39, ("Num 6") },
{ 40, ("Num 2") },
{ 44, ("Sys Req") },
{ 45, ("Num 0") },
{ 46, ("Num Del") },
{ 48, ("0") },
{ 49, ("1") },
{ 50, ("2") },
{ 51, ("3") },
{ 52, ("4") },
{ 53, ("5") },
{ 54, ("6") },
{ 55, ("7") },
{ 56, ("8") },
{ 57, ("9") },
{ 65, ("A") },
{ 66, ("B") },
{ 67, ("C") },
{ 68, ("D") },
{ 69, ("E") },
{ 70, ("F") },
{ 71, ("G") },
{ 72, ("H") },
{ 73, ("I") },
{ 74, ("J") },
{ 75, ("K") },
{ 76, ("L") },
{ 77, ("M") },
{ 78, ("N") },
{ 79, ("O") },
{ 80, ("P") },
{ 81, ("Q") },
{ 82, ("R") },
{ 83, ("S") },
{ 84, ("T") },
{ 85, ("U") },
{ 86, ("V") },
{ 87, ("W") },
{ 88, ("X") },
{ 89, ("Y") },
{ 90, ("Z") },
{ 96, ("Num 0") },
{ 97, ("Num 1") },
{ 98, ("Num 2") },
{ 99, ("Num 3") },
{ 100, ("Num 4") },
{ 101, ("Num 5") },
{ 102, ("Num 6") },
{ 103, ("Num 7") },
{ 104, ("Num 8") },
{ 105, ("Num 9") },
{ 106, ("Num *") },
{ 107, ("Num +") },
{ 109, ("Num -") },
{ 110, ("Num Del") },
{ 111, ("/") },
{ 112, ("F1") },
{ 113, ("F2") },
{ 114, ("F3") },
{ 115, ("F4") },
{ 116, ("F5") },
{ 117, ("F6") },
{ 118, ("F7") },
{ 119, ("F8") },
{ 120, ("F9") },
{ 121, ("F10") },
{ 122, ("F11") },
{ 123, ("F12") },
{ 144, ("Pause") },
{ 145, ("Scroll Lock") },
{ 161, ("Right Shift") },
{ 186, (";") },
{ 187, ("=") },
{ 188, (",") },
{ 189, ("-") },
{ 190, (".") },
{ 191, ("/") },
{ 192, ("`") },
{ 219, ("[") },
{ 220, ("\\") },
{ 221, ("]") },
{ 222, ("'") },
{ 226, ("\\") },
};
bool KeyBind(const char* name, int& keyBind) {
auto result = std::find_if(ButtonNames.begin(), ButtonNames.end(), [&](const KeyBindPair_t& a) { return a.first == keyBind; });
if (result == ButtonNames.end()) {
result = ButtonNames.begin();
keyBind = 0;
}
int key = result - ButtonNames.begin();
auto comboRes = ImGui::Combo(
name, &key, [](void* data, int32_t idx, const char** out_text) {
*out_text = ButtonNames[idx].second;
return true;
},
nullptr, ButtonNames.size());
keyBind = ButtonNames[key].first;
return comboRes;
}
C++:
ImGui::Checkbox("Third Person", g_Options.misc_thirdperson);
if (g_Options.misc_thirdperson)
{
ImGui::SliderFloat("Third Person Dist", g_Options.misc_thirdperson_dist, 25.f, 250.f);
KeyBind("Third Person Bind", g_Options.misc_thirdperson_bind);
}
C++:
OPTION(bool, misc_thirdperson, false);
OPTION(float, misc_thirdperson_dist, 50.f);
OPTION(int, misc_thirdperson_bind, 4);