Guest User

GUI.cpp

a guest
Feb 25th, 2023
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.94 KB | None | 0 0
  1. void GUI::Keybind(int column, int width, int* value, bool& clicked, const char* name)
  2. {
  3.     itemheight[column] += 16;
  4.  
  5.     int x = column == 0 ? (columns[column] + (tabs[3].w / 2) - 36) : (columns[column] + (tabs[3].w / 2) - 40);
  6.  
  7.     g_Drawing.MenuStringNormal(false, true, columns[column] + (tabs[3].w / 2) + tabs[2].w - 43, itemheight[column] + 7, Color(255, 255, 255, 200), "%s", name);
  8.  
  9.     int col = 80;
  10.     g_Drawing.FilledRect(x, itemheight[column], tabs[2].w - 15, 1, Color(col, col, col, 255));
  11.     g_Drawing.FilledRect(x, itemheight[column] + 1, tabs[2].w - 15, 1, Color(col - 2, col - 2, col - 2, 255));
  12.     g_Drawing.FilledRect(x, itemheight[column] + 2, tabs[2].w - 15, 1, Color(col - 4, col - 4, col - 4, 255));
  13.     g_Drawing.FilledRect(x, itemheight[column] + 3, tabs[2].w - 15, 1, Color(col - 8, col - 8, col - 8, 255));
  14.     g_Drawing.FilledRect(x, itemheight[column] + 4, tabs[2].w - 15, 1, Color(col - 12, col - 12, col - 12, 255));
  15.     g_Drawing.FilledRect(x, itemheight[column] + 5, tabs[2].w - 15, 1, Color(col - 14, col - 14, col - 14, 255));
  16.     g_Drawing.FilledRect(x, itemheight[column] + 6, tabs[2].w - 15, 9, Color(col - 16, col - 16, col - 16, 255));
  17.  
  18.     g_Drawing.OutlinedRect(x, itemheight[column], tabs[2].w - 15, 15, Color(51, 51, 51, 255));
  19.  
  20.     g_Drawing.FilledRect(x, itemheight[column], tabs[2].w - 16, 1, Color(91, 91, 91, 255));
  21.     g_Drawing.FilledRect(x, itemheight[column], 1, 14, Color(91, 91, 91, 255));
  22.  
  23.     char* active_text = nullptr;
  24.  
  25.     if (g_Stuff.Mouse.Click(x, itemheight[column], width, 15)) {
  26.         clicked = true;
  27.     }
  28.     else {
  29.         if (clicked == false) {
  30.             active_text = (char*)GetNameFromCode(*value).c_str();
  31.         }
  32.     }
  33.  
  34.     if (clicked) {
  35.         active_text = "...";
  36.         for (int i = 0; i < 124; i++) {
  37.             if (GetAsyncKeyState(i) & 1) {
  38.                 *value = i;
  39.                 clicked = false;
  40.                 break;
  41.             }
  42.         }
  43.     }
  44.  
  45.     g_Drawing.MenuStringNormal(true, true, x+((tabs[2].w - 15) / 2), itemheight[column] + 7, Color(255, 255, 255, 200), "%s", active_text);
  46.  
  47.     itemscount++;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment