Skeet gui (For ayyware, indigo, stackhack WITH IMGUI)

Забаненный
Статус
Оффлайн
Регистрация
26 Июн 2018
Сообщения
8
Реакции[?]
2
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
guys i dont know if the site broken or what but i cant use the spoiler and the
</> code thing
so u have to add those into : CONTROLS.H CONTROLS.CPP GUI.CPP

GUI.CPP
Код:
 Render :: Clear (window-> m_x + 8 - 90, window-> m_y + 1 + 28 * 2, window-> m_iWidth - 4 - 12 + 90, window-> m_iHeight - 28 - 26, Color ( 28, 28, 28, 255));

Render :: Clear (window-> m_x + 8 - 90, window-> m_y + 1 + 28 * 2 - 6, window-> m_iWidth - 4 - 12 + 90, 6, Color (40, 40, 40, 255) );
Render :: Clear (window-> m_x + 8 - 90, window-> m_y + 1 + 28 * 2 + window-> m_iHeight - 28 - 26, window-> m_iWidth - 4 - 12 + 90, 6, Color (40 , 40, 40, 255));
Render :: Clear (window-> m_x + 8 - 90 - 6, window-> m_y + 1 + 28 * 26, 6, window-> m_iHeight - 28 - 26 + 12, Color (40, 40, 40, 255) );
Render :: Clear (window-> m_x + 8 + window-> m_iWidth - 4 - 12, window-> m_y + 1 + 28 * 26, 6, window-> m_iHeight - 28 - 26 + 12, Color (40, 40 , 40, 255));
// Tab
Render :: Clear (window-> m_x + 8 - 90, window-> m_y + 1 + 28 * 2, 90, window-> m_iHeight - 28 - 26, Color (21, 21, 19, 255));
Render :: Outline (window-> m_x + 8 - 90, window-> m_y + 1 + 28 * 2, window-> m_iWidth - 4 - 12 + 90, window-> m_iHeight - 28 - 26, Color (48, 48 , 48, 255));
Render :: Outline (window-> m_x + 8 - 6 - 90, window-> m_y + 1 + 28 * 26, window-> m_iWidth - 4 - 12 + 90 + 12, window-> m_iHeight - 28 - 26 + 12 , Color (48, 48, 48, 255));
Render :: Outline (window-> m_x + 8 - 90, window-> m_y + 1 + 28 * 2, 90, window-> m_iHeight - 28 - 26, Color (48, 48, 48, 255));
// Skeet Bar
Render :: GradientSideways (window-> m_x - 81, window-> m_y + 58, window-> m_iWidth / 2 + 71, 1, Color (0, 160, 255, 255), Color (160, 0, 255, 255 ), 1);
Render :: GradientSideways ((window-> m_x + window-> m_iWidth / 2) - 81, window-> m_y + 58, window-> m_iWidth / 2 + 71, 1, Color (160, 0, 255, 255), Color (255, 255, 0, 255), 1);


if (window-> SelectedTab == tab) {
xAxis = window-> m_x + 8 - (45 + TextSize.right / 2);
Render :: Clear (TabDrawArea.left, TabDrawArea.top, TabDrawArea.right, TabDrawArea.bottom, Color (28, 28, 28, 255));
Render :: Line (TabDrawArea.left, TabDrawArea.top, TabDrawArea.left + TabDrawArea.right, TabDrawArea.top, Color (48, 48, 48, 255));
Render :: Line (TabDrawArea.left, TabDrawArea.top + TabDrawArea.bottom, TabDrawArea.left + TabDrawArea.right, TabDrawArea.top + TabDrawArea.bottom, Color (48, 48, 48, 255));
Render :: Text (TabDrawArea.left + (TabDrawArea.right / 2) - (TextSize.right / 2), TabDrawArea.top + (TabDrawArea.bottom / 2) - (TextSize.bottom / 2), Color (245, 245 , 245, 255), Render :: Fonts :: Tabs, tab-> Title.c_str ());
}
else {
xAxis = window-> m_x + 8 - (45 + TextSize.right / 2);
Render :: Text (TabDrawArea.left + (TabDrawArea.right / 2) - (TextSize.right / 2), TabDrawArea.top + (TabDrawArea.bottom / 2) - (TextSize.bottom / 2), Color (130, 130 , 130, 255), Render :: Fonts :: Tabs, tab-> Title.c_str ());
}






CONTROLS.CPP



#pragma region CheckBox
CCheckBox :: CCheckBox ()
{
Checked = false;
m_Flags = UIFlags :: UI_Clickable | UIFlags :: UI_Drawable | UIFlags :: UI_SaveFile;
m_iWidth = 9;
m_iHeight = 9;
FileControlType = UIControlTypes :: UIC_CheckBox;
}
void CCheckBox :: SetState (bool s)
{
Checked = s;
}
bool CCheckBox :: GetState ()
{
return Checked;
}
void CCheckBox :: Draw (bool hover)
{
int red = Menu :: Window.ColorTab.MenuR.GetValue ();
int green = Menu :: Window.ColorTab.MenuG.GetValue ();
int blue = Menu :: Window.ColorTab.MenuB.GetValue ();
POINT a = GetAbsolutePos ();
Render :: GradientV (ax, ay, 9, 9, Color (55, 55, 55, 255), Color (40, 40, 40, 245));
Render :: Outline (ax, ay, 9, 9, Color (2, 2, 2, 255));
if (Checked)
{
Render :: GradientV (ax, ay, 9, 9, Color (red, green, blue, 255), Color (red, green, blue, 255));
Render :: Outline (ax, ay, 9, 9, Color (2, 2, 2, 255));
}
}
void CCheckBox :: OnUpdate () {m_iWidth = 9; m_iHeight = 9; }
void CCheckBox :: OnClick ()
{
Checked = Checked !;
}
#pragma endregion Implementations of the Check Box functions
#pragma region Label
CLabel :: CLabel ()
{
m_Flags = UIFlags :: UI_Drawable;
Text = "Default";
FileIdentifier = "Default";
}
void CLabel :: Draw (bool hover)
{
POINT a = GetAbsolutePos ();
Render :: Text (ax, ay, Color (245, 245, 245, 255), Render :: Fonts :: MenuBold, Text.c_str ());
}
void CLabel :: SetText (std :: string text)
{
Text = text;
}
void CLabel :: OnUpdate () {}
void CLabel :: OnClick () {}
#pragma endregion Implementations of the Label functions
#pragma region GroupBox
CGroupBox :: CGroupBox ()
{
Items = 1;
m_Flags = UIFlags :: UI_Drawable | UIFlags :: UI_RenderFirst;
Text = "Default";
FileIdentifier = "Default";
}
void CGroupBox :: Draw (bool hover)
{
POINT a = GetAbsolutePos ();
RECT txtSize = Render :: GetTextSize (Render :: Fonts :: MenuBold, Text.c_str ());
Render :: Clear (ax + 2, ay + 2, m_iWidth - 4, m_iHeight - 4, Color (40, 40, 40, 0));
Render :: Text (ax + 15, ay - (txtSize.bottom / 2), Color (255, 255, 255, 255), Render :: Fonts :: MenuBold, Text.c_str ());
Render :: Line (ax, ay, ax + 12, ay, Color (66, 66, 66, 255));
Render :: Line (ax + 15 + txtSize.right + 5, ay, ax + m_iWidth, ay, Color (66, 66, 66, 255));
Render :: Line (ax, ay, ax, ay + m_iHeight, Color (66, 66, 66, 255));
Render :: Line (ax, ay + m_iHeight, ax + m_iWidth, ay + m_iHeight, Color (66, 66, 66, 255));
Render :: Line (ax + m_iWidth, ay, ax + m_iWidth, ay + m_iHeight, Color (66, 66, 66, 255));
}
void CGroupBox :: SetText (std :: string text)
{
Text = text;
}
void CGroupBox :: PlaceCheckBox (std :: string Label, CTab * Tab, CControl * control)
{
int x = m_x + 29;
int y = m_y + Items * 24;
int cw, ch;
control-> SetPosition (x, y);
control-> GetSize (cw, ch);
control-> SetSize ((m_iWidth / 2) - 32, ch);
Tab-> RegisterControl (control);
x + = 20;
CLabel * label = new CLabel;
label-> SetPosition (x, y);
label-> SetText (Label);
Tab-> RegisterControl (label);
Items ++;
}
void CGroupBox :: PlaceOtherControl (std :: string Label, CTab * Tab, CControl * control)
{
int x = m_x + 29;
int y = m_y + Items * 24;
int cw, ch;
control-> SetPosition (x, y);
control-> GetSize (cw, ch);
control-> SetSize ((m_iWidth / 2) - 32, ch);
Tab-> RegisterControl (control);
x + = m_iWidth / 2 - 25;
CLabel * label = new CLabel;
label-> SetPosition (x, y);
label-> SetText (Label);
Tab-> RegisterControl (label);
Items ++;
}
void CGroupBox :: OnUpdate () {}
void CGroupBox :: OnClick () {}
#pragma endregion Implementations of the Group Box functions
#pragma region Sliders
CSlider :: CSlider ()
{
m_Flags = UIFlags :: UI_Drawable | UIFlags :: UI_Clickable | UIFlags :: UI_SaveFile;
FileControlType = UIControlTypes :: UIC_Slider;
}
void CSlider :: Draw (bool hover)
{
int red = Menu :: Window.ColorTab.MenuR.GetValue ();
int green = Menu :: Window.ColorTab.MenuG.GetValue ();
int blue = Menu :: Window.ColorTab.MenuB.GetValue ();
POINT a = GetAbsolutePos ();
Render :: Clear (ax, ay + 5, m_iWidth, 5, Color (40, 40, 40, 255));
Render :: Outline (ax - 1, ay + 4, m_iWidth + 2, 7, UI_COL_SHADOW);
Render :: GradientV (ax, ay + 5, m_iWidth, 3, Color (68, 68, 68, 255), Color (58, 58, 58, 255));
float Ratio = Value / (Max-Min);
float Location = Ratio * m_iWidth;
// Render :: Clear (ax, ay + 5, Location, 5, Color (151, 225, 3, 255)); / * Slider Color * /
Render :: GradientV (ax, ay + 5, Location, 5, Color (red, green, blue, 255), Color (red, green, blue, 255));
Render :: Clear (ax, ay + 9, Location, 1, Color (50, 50, 50, 50));
char buffer [24];
sprintf_s (buffer, "% .2f", Value);
RECT txtSize = Render :: GetTextSize (Render :: Fonts :: MenuText, buffer);
Render :: Text (ax + (Ratio / m_iWidth + Location) - txtSize.right / 2, ay + 6.5, Color (255, 255, 255, 255), Render :: Fonts :: MenuText, buffer);
}
void CSlider :: OnUpdate () {
POINT a = GetAbsolutePos ();
m_iHeight = 11;
if (DoDrag)
{
if (GUI.GetKeyState (VK_LBUTTON))
{
POINT m = GUI.GetMouse ();
float NewX;
float Ratio;
NewX = mx - ax - 1;
if (NewX <0) NewX = 0;
if (NewX> m_iWidth) NewX = m_iWidth;
Ratio = NewX / float (m_iWidth);
Value = Min + (Max-Min) * Ratio;
}
else
{
DoDrag = false;
}
}
}
void CSlider :: OnClick () {
POINT a = GetAbsolutePos ();
RECT SliderRegion = {ax, ay, m_iWidth, 11};
if (GUI.IsMouseInRegion (SliderRegion))
{
DoDrag = true;
}
}
float CSlider :: GetValue ()
{
return Value;
}
void CSlider :: SetValue (float v)
{
Value = v;
}
void CSlider :: SetBoundaries (float min, float max)
{
Min = min; Max = max;
}
#pragma endregion Implementations of the Slider functions
#pragma region KeyBinders
char * KeyStrings [254] = {nullptr, "Left Mouse", "Right Mouse", "Control + Break", "Middle Mouse", "Mouse 4" Mouse 5 "
nullptr," Backspace "," TAB ", nullptr, nullptr, nullptr," ENTER ", nullptr, nullptr," SHIFT "," CTRL ","
"CAPS LOCK", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, "ESC", nullptr, nullptr, nullptr, nullptr, "SPACEBAR",
PG UP, PG DOWN, END, HOME, Left, Up, Right, Down , nullptr, Print, nullptr, Print Screen, Insert,.
Delete, nullptr, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
null, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X,
"Y", "Z", "Left Windows", " Right Windows ", nullptr, nullptr, nullptr," NUM 0 "," NUM 1 "," NUM 2 "," NUM 3 "," NUM 4 "NUM 5", "6 NUM"
"NUM 7", "NUM 8 "," NUM 9 "," * "," + "," _ "," - ","
F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, "NUM LOCK", "SCROLL LOCK", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, "LSHIFT", "RSHIFT", "LCONTROL", "RCONTROL", "LMENU", "RMENU" ", nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr," Next Track "," Previous Track "," Stop "," Play / Pause ", nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, ";", "+", ",", "-", "/?", "~", nullptr, nullptr, nullptr, nullptr, "."
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, "[{", "\\ |", "}]", "'\" ", nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
CKeyBind :: CKeyBind ()
{
m_Flags = UIFlags :: UI_Drawable | UIFlags :: UI_Clickable | UIFlags :: UI_SaveFile;
FileControlType = UIControlTypes :: UIC_KeyBind;
}
void CKeyBind :: Draw (bool hover)
{
POINT a = GetAbsolutePos ();
Render :: Outline (ax, ay, m_iWidth, m_iHeight, Color (red, green,blue, 255));
if (hover)
Render :: Clear (ax + 2, 2 + ay, m_iWidth - 4, m_iHeight - 4, Color (161, 161, 161, 255));
bool GoodKeyName = false;
char NameBuffer [128];
char * KeyName = "Not Bound";
if (IsGettingKey)
{
KeyName = "<Press A Key>";
}
else
{
if (Key> = 0)
{
KeyName = KeyStrings [Key];
if (KeyName)
{
GoodKeyName = true;
}
else
{
if (GetKeyNameText (Key << 16, NameBuffer, 127))
{
KeyName = NameBuffer;
GoodKeyName = true;
}
}
}
if (! GoodKeyName)
{
KeyName = "No Key";
}
}
Render :: Text (ax + 2, ay + 2, Color (255, 255, 255, 255), Render :: Fonts :: MenuBold, KeyName);
}
void CKeyBind :: OnUpdate () {
m_iHeight = 16;
POINT a = GetAbsolutePos ();
if (iGettingKey)
{
for (int i = 0; i <255; i ++)
{
if (i.GetKeyPress (i))
{
if (i == VK_ESCAPE)
{
IsGettingKey = false;
Key = -1;
return;
}
Key = i;
IsGettingKey = false;
return;
}
}
}
}
void CKeyBind :: OnClick () {
POINT a = GetAbsolutePos ();
if (! IsGettingKey)
{
IsGettingKey = true;
}
}
int CKeyBind :: GetKey ()
{
return Key;
}
void CKeyBind :: SetKey (int key)
{
Key = key;
}
#pragma endregion Implementations of the KeyBind Control functions
#pragma region Button
CButton :: CButton ()
{
m_iWidth = 177;
m_Flags = UIFlags :: UI_Drawable | UIFlags :: UI_Clickable;
Text = "Default";
CallBack = nullptr;
FileIdentifier = "Default";
}
void CButton :: Draw (bool hover)
{
POINT a = GetAbsolutePos ();
Render :: Outline (ax, ay, m_iWidth, m_iHeight, Color (red, green, blue, 255));
if (hover)
Render :: GradientV (ax + 2, ay + 2, m_iWidth - 4, m_iHeight - 4, Color (192, 192, 192, 255), Color (234, 234, 234, 255));
else
Render :: GradientV (ax + 2, ay + 2, m_iWidth - 4, m_iHeight - 4, Color (234, 234, 234, 255), Color (192, 192, 192, 255));
RECT TextSize = Render :: GetTextSize (Render :: Fonts :: MenuBold, Text.c_str ());
int TextX = ax + (m_iWidth / 2) - (TextSize.left / 2);
int TextY = ay + (m_iHeight / 2) - (TextSize.bottom / 2);
Render :: Text (TextX, TextY, Color (0, 0, 0, 255), Render :: Fonts :: MenuBold, Text.c_str ());
}
void CButton :: SetText (std :: string text)
{
Text = text;
}
void CButton :: SetCallback (CButton :: ButtonCallback_t callback)
{
CallBack = callback;
}
void CButton :: OnUpdate ()
{
m_iHeight = 26;
}
void CButton :: OnClick ()
{
if (CallBack)
CallBack ();
}
#pragma endregion Implementations of the Button functions
#pragma region ComboBox
CComboBox :: CComboBox ()
{
m_Flags = UIFlags :: UI_Drawable | UIFlags :: UI_Clickable | UIFlags :: UI_Focusable | UIFlags :: UI_SaveFile;
FileControlType = UIControlTypes :: UIC_ComboBox;
}
void CComboBox :: Draw (bool hover)
{
POINT a = GetAbsolutePos ();
RECT Region = {ax, ay, m_iWidth, 16};
Render :: Clear (ax, ay, m_iWidth, 16, Color (35, 35, 35, 255));
// Hover for the Top Box
if (GUI.IsMouseInRegion (Region))
Render :: GradientV (ax + 2, ay + 2, m_iWidth - 4, 12, Color (50, 50, 50, 255), Color (60, 60, 60, 255));
// Render :: Clear (ax + 2, ay + 2, m_iWidth - 4, 12, Color (60, 60, 60, 255));
// If we have some items
if (Items.size ()> 0)
{
// The current item
Render :: Text (ax + 2, ay + 2, Color (100, 100, 100, 255), Render :: Fonts :: MenuBold, GetItem () c_str ().);
// If the drop down part is open
if (IsOpen)
{
// Render :: Clear (ax, ay + 17, m_iWidth, Items.size () * 16, Color (60, 60, 60, 255));
Render :: GradientV (ax, ay + 17, m_iWidth, Items.size () * 16, Color (50, 50, 50, 255), Color (60, 60, 60, 255));
// Draw the items
for (int i = 0; i <Items.size (); i ++)
{
RECT ItemRegion = {ax, ay + 17 + i * 16, m_iWidth, 16};
// Hover
if (GUI.IsMouseInRegion (ItemRegion))
{
Render :: GradientV (ax, ay + 17 + i * 16, m_iWidth, 16, Color (50, 50, 50, 255), Color (60, 60, 60 , 255));
// Render :: Clear (ax, ay + 17 + i * 16, m_iWidth, 16, Color (60, 60, 60, 255));
}
Render :: Text (ax + 2, ay + 19 + i * 16, color (100, 100, 100, 255), :: Render Fonts :: MenuBold, Items .c_str ());
}
}
Vertex_t Verts2 [3];
Verts2 [0] .m_Position.x = ax + m_iWidth - 10;
Verts2 [0] .m_Position.y = ay + 8;
Verts2 [1] .m_Position.x = ax + m_iWidth - 5;
Verts2 [1] .m_Position.y = ay + 8;
Verts2 [2] .m_Position.x = ax + m_iWidth - 7.5;
Verts2 [2] .m_Position.y = ay + 11;
Render :: Polygon (3, Verts2, Color (200, 200, 200, 255));
}
}
void CComboBox :: AddItem (std :: string text)
{
Items.push_back (text);
SelectedIndex = 0;
}
void CComboBox :: OnUpdate ()
{
if (IsOpen)
{
m_iHeight = 16 + 16 * Items.size ();
if (parent-> GetFocus ()! = this)
IsOpen = false;
}
else
{
m_iHeight = 16;
}
}
void CComboBox :: OnClick ()
{
POINT a = GetAbsolutePos ();
RECT Region = {ax, ay, m_iWidth, 16};
if (IsOpen)
{
// If we clicked one of the items (
if not in the top bar) if (! GUI.IsMouseInRegion (Region))
{
// Draw the items
for (int i = 0; i <Items.size ( ); i ++)
{
RECT ItemRegion = {ax, ay + 16 + i * 16, m_iWidth, 16};
// Hover
if (GUI.IsMouseInRegion (ItemRegion))
{
SelectedIndex = i;
}
}
}
// Close the drop down
IsOpen = false;
}
else
{
IsOpen = true;
}
}
int CComboBox :: GetIndex ()
{
return SelectedIndex;
}
std :: string CComboBox :: GetItem ()
{
if (SelectedIndex> = 0 && SelectedIndex <Items.size ())
{
return Items [SelectedIndex];
}
return "Error";
}
void CComboBox :: SelectIndex (int idx)
{
if (idx> = 0 && idx <Items.size ())
{
SelectedIndex = idx;
}
}
#pragma endregion Implementations of the ComboBox functions
char * KeyDigits [254] = {nullptr, "Left Mouse", "Right Mouse", "Control + Break", "Middle Mouse", "Mouse 4", "Mouse 5"
nullptr, "Backspace", "TAB", nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, "ESC", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, "SHIFT", "CTRL", "ALT", "PAUSE", "CAPS LOCK" , nullptr, nullptr, nullptr, nullptr, "SPACEBAR",
PG UP, PG DOWN, END, HOME, Left, Up, Right, Down, nullptr, Print, nullptr, Print Screen, Insert,.
Delete, nullptr, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
null, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X,
"7", "8", "9", "*", "+", "_", "-" ,, "/", "F1", "F2", "F3", "F4". "", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
F13, F14, F15, F16, F17, F18, F19, F20 , F21, F22, F23, F24, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, "nulllock", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr , nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, "LSHIFT", "RSHIFT", "LCONTROL", "RCONTROL", "LMENU", "RMENU", nullptr, nullptr, nullptr,
nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, \ n "", "nullptr", nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
CTextField :: CTextField ()
{
m_Flags = UIFlags :: UI_Drawable | UIFlags :: UI_Clickable | UIFlags :: UI_SaveFile ;
FileControlType = UIControlTypes :: UIC_KeyBind;
}
std ::string CTextField :: getText ()
{
return text;
}
void CTextField :: SetText (std :: string stext)
{
text = stext;
}
void CTextField :: Draw (bool hover)
{
POINT a = GetAbsolutePos ();
Render :: Outline (ax, ay, m_iWidth, m_iHeight, Color (red, green, blue, 255));
if (hover || IsGettingKey)
Render :: Clear (ax + 2, 2 + ay, m_iWidth - 4, m_iHeight - 4, Color (161, 161, 161, 255));
const char * cstr = text.c_str ();
Render :: Text (ax + 2, ay + 2, Color (255, 255, 255, 255), Render :: Fonts :: MenuBold, cstr);
}
void CTextField :: OnUpdate ()
{
m_iHeight = 16;
POINT a = GetAbsolutePos ();
POINT b;
const char * strg = text.c_str ();
if (IsGettingKey)
{
b = GetAbsolutePos ();
for (int i = 0; i <255; i ++)
{
if (i.G.KetPress (i))
{
if (i == VK_ESCAPE || i == VK_RETURN || i == VK_INSERT || i == VK_END )
{
IsGettingKey = false;
return;
}
if (i == VK_BACK && strlen (strg)! = 0)
{
text = text.substr (0, strlen (strg) - 1);
}
if (strlen (strg) <6 && (i == 0x30 || i == 0x31 || i == 0x32 || i == 0x33 || i == 0x34 || i == 0x35 || i == 0x36 || i == 0x37 || i == 0x38 || i == 0x39 || i == VK_NUMPAD0 || i == VK_NUMPAD1 || i == VK_NUMPAD2 || i == VK_NUMPAD3 || i == VK_NUMPAD4 || i == VK_NUMPAD5 || i == VK_NUMPAD6 || i == VK_NUMPAD7 || i == VK_NUMPAD8 || i == VK_NUMPAD9))
{
= + text text KeyDigits;
return;
}
}
}
}
}
void CTextField :: OnClick ()
{
POINT a = GetAbsolutePos ();
if (! IsGettingKey)
{
IsGettingKey = true;
}
}
#pragma endregion Implementation of the Textfield



CONTROLS.H
class CCheckBox: public CControl
{
public:
CCheckBox ();
void SetState (bool s);
bool GetState ();
protected:
bool Checked;
void Draw (bool hover);
void OnUpdate ();
void OnClick ();
};};
class CLabel: public CControl
{
public:
CLabel ();
void SetText (std :: string text);
protected:
std :: string Text;
void Draw (bool hover);
void OnUpdate ();
void OnClick ();
};};
class CGroupBox: public CControl
{
public:
CGroupBox ();
void SetText (std :: string text);
void PlaceCheckBox (std :: string Label, CTab * Tab, CControl * control);
void PlaceOtherControl (std :: string Label, CTab * Tab, CControl * control);
// void PlaceCheckBox (std :: string Label, CTab * Tab, CControl * control);
inline void SetColumns (int c) {Columns = c; }
protected:
int Columns;
int Items;
std :: string Text;
void Draw (bool hover);
void OnUpdate ();
void OnClick ();
};};
class CSlider: public CControl
{
public:
CSlider ();
float GetValue ();
void SetValue (float v);
void SetBoundaries (float min, float max);
protected:
float Value;
float Min;
float Max;
bool DoDrag;
void Draw (bool hover);
void OnUpdate ();
void OnClick ();
};};
class CKeyBind: public CControl
{
public:
CKeyBind ();
int GetKey ();
void SetKey (int key);
protected:
int Key;
bool IsGettingKey;
void Draw (bool hover);
void OnUpdate ();
void OnClick ();
};};
class CButton: public CControl
{
public:
typedef void (* ButtonCallback_t) (void);
CButton ();
void SetCallback (ButtonCallback_t callback);
void SetText (std :: string text);
protected:
ButtonCallback_t CallBack;
std :: string Text;
void Draw (bool hover);
void OnUpdate ();
void OnClick ();
};};
class CComboBox: public CControl
{
public:
CComboBox ();
void AddItem (std :: string text);
void SelectIndex (int idx);
int GetIndex ();
std :: string GetItem ();
protected:
std :: vector <std :: string> Items;
int SelectedIndex;
bool IsOpen;
void Draw (bool hover);
void OnUpdate ();
void OnClick ();
};};
class CTextField: public CControl
{
public:
CTextField ();
std :: string getText ();
void SetText (std :: string);
private:
std :: string text;
bool IsGettingKey;
void Draw (bool hover);
void OnUpdate ();
void OnClick ();
};}; [/ CODE]
 
Последнее редактирование:
Забаненный
Статус
Оффлайн
Регистрация
19 Июн 2017
Сообщения
31
Реакции[?]
0
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
ss?
 
Забаненный
Статус
Оффлайн
Регистрация
27 Сен 2018
Сообщения
45
Реакции[?]
0
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
No, just no, pasters
 
Забаненный
Статус
Оффлайн
Регистрация
20 Окт 2018
Сообщения
8
Реакции[?]
2
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
plz ss
 
Сверху Снизу