SHARE
TWEET

Untitled

a guest Jan 22nd, 2020 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "../menu.h"
  2.  
  3. void c_menu::checkbox(std::string name, bool* item)
  4. {
  5.     if (groupbox_bottom <= y_offset + 16)
  6.         return;
  7.  
  8.     static bool pressed = false;
  9.  
  10.     auto text_size = render::get().GetTextSize2(render::get().menu_font, name.c_str());
  11.  
  12.     if (!GetAsyncKeyState(VK_LBUTTON) && mouse_in_params(x_offset + 7, y_offset, 9 + text_size.right, 9))
  13.     {
  14.         if (pressed)
  15.             *item = !*item;
  16.         pressed = false;
  17.     }
  18.  
  19.     if (GetAsyncKeyState(VK_LBUTTON) && mouse_in_params(x_offset + 7, y_offset, 9 + text_size.right, 9) && !pressed)
  20.         pressed = true;
  21.  
  22.     if (*item == true)
  23.         render::get().draw_filled_rect(x_offset + 8, y_offset, 9, 9, color(85, 224, 111, 255));
  24.     else
  25.         render::get().draw_filled_rect(x_offset + 8, y_offset, 9, 9, color(95, 95, 95, 255));
  26.  
  27.     render::get().draw_outline(x_offset + 8, y_offset, 9, 9, color(0, 0, 0, 255));
  28.  
  29.     render::get().draw_text(x_offset + 25, y_offset - 3, render::get().menu_font, name.c_str(), false, color(255, 255, 255, 255));
  30.  
  31.     y_offset += 16;
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top