├── README.md ├── screenshots ├── .gitkeep ├── canvas1.jpg ├── canvas2.jpg ├── canvas3.jpg └── canvas4.jpg └── source ├── ZeroGUI.h └── ZeroInput.h /README.md: -------------------------------------------------------------------------------- 1 | # ue4-canvas-gui 2 | 3 | ## It's a simple Canvas GUI for Unreal Engine 4 with mouse operation. 4 | 5 | Included elements:
6 | Rendering Text (left/center);
7 | Rendering Rects;
8 | Rendering Circles (filled and not);
9 | Button, Slider, Checkbox, Combobox, Hotkeys and ColorPicker.
10 |
11 | Implemented a simple post-render system to draw on top of menu and all.
12 |
13 | ## Screenshots with default style:
14 | ![EU4 GUI](screenshots/canvas1.jpg "") 15 | 16 | ![EU4 GUI](screenshots/canvas2.jpg "") 17 | 18 | ![EU4 GUI](screenshots/canvas3.jpg "") 19 | 20 | Ingame render 21 | ![EU4 GUI](screenshots/canvas4.jpg "") 22 | 23 | ## Small "How to use" guide:
24 | First you need get **UCanvas** from game.
25 | After it you can draw like this:
26 | 27 | ```cpp 28 | //I'll show you with an example Post Render Hook 29 | void PostRenderHook(UGameViewportClient* viewport, UCanvas* canvas) 30 | { 31 | ZeroGUI::SetupCanvas(canvas); 32 | Menu::Tick(); 33 | } 34 | 35 | //Menu.h 36 | void Tick() 37 | { 38 | ZeroGUI::Input::Handle(); 39 | 40 | static bool menu_opened = false; 41 | if (GetAsyncKeyState(VK_F2) & 1) menu_opened = !menu_opened; //Our menu key 42 | 43 | if (ZeroGUI::Window("Superior UE4 GUI", &pos, FVector2D{ 500.0f, 400.0f }, menu_opened)) 44 | { 45 | //Simple Tabs 46 | static int tab = 0; 47 | if (ZeroGUI::ButtonTab("Tab 1", FVector2D{ 110, 25 }, tab == 0)) tab = 0; 48 | if (ZeroGUI::ButtonTab("Tab 2", FVector2D{ 110, 25 }, tab == 1)) tab = 1; 49 | if (ZeroGUI::ButtonTab("Tab 3", FVector2D{ 110, 25 }, tab == 2)) tab = 2; 50 | if (ZeroGUI::ButtonTab("Tab 4", FVector2D{ 110, 25 }, tab == 3)) tab = 3; 51 | ZeroGUI::NextColumn(130.0f); 52 | // 53 | 54 | //Some Elements 55 | static bool text_check = false; 56 | static float text_slider = 15.0f; 57 | static int test_hotkey = 0x2; 58 | static FLinearColor test_color{ 0.0f, 0.0f, 1.0f, 1.0f }; 59 | 60 | ZeroGUI::Checkbox("Test Checkbox", &text_check); 61 | ZeroGUI::SliderFloat("Test Slider", &text_slider, 0.0f, 180.0f); 62 | ZeroGUI::Hotkey("Test Hotkey", FVector2D{ 80, 25 }, &test_hotkey); 63 | 64 | ZeroGUI::Text("Left aligned text!"); 65 | ZeroGUI::Text("Outline and Center aligned text!", true, true); 66 | 67 | //Element with padding 68 | ZeroGUI::PushNextElementY(50.0f); 69 | ZeroGUI::Combobox("Combobox", FVector2D{ 100, 25 }, &test_number, "None", "First", "Second", "Third", NULL); //NULL at end is required! 70 | ZeroGUI::SameLine();//inline items 71 | if (ZeroGUI::Button("It's a Button!", FVector2D{ 100, 25 })) { /*clicked!*/ } 72 | 73 | //Color Picker 74 | ZeroGUI::ColorPicker("Color Picker", &test_color); 75 | } 76 | ZeroGUI::Render();//Custom Render. I use it for drawing Combobox and ColorPicker over the menu 77 | ZeroGUI::Draw_Cursor(menu_opened); 78 | } 79 | ``` 80 | -------------------------------------------------------------------------------- /screenshots/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /screenshots/canvas1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaddyOff/ue4-canvas-gui/f832dc1c31795ed630a8d0631e595ccaf8bafed5/screenshots/canvas1.jpg -------------------------------------------------------------------------------- /screenshots/canvas2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaddyOff/ue4-canvas-gui/f832dc1c31795ed630a8d0631e595ccaf8bafed5/screenshots/canvas2.jpg -------------------------------------------------------------------------------- /screenshots/canvas3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaddyOff/ue4-canvas-gui/f832dc1c31795ed630a8d0631e595ccaf8bafed5/screenshots/canvas3.jpg -------------------------------------------------------------------------------- /screenshots/canvas4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaddyOff/ue4-canvas-gui/f832dc1c31795ed630a8d0631e595ccaf8bafed5/screenshots/canvas4.jpg -------------------------------------------------------------------------------- /source/ZeroGUI.h: -------------------------------------------------------------------------------- 1 | 2 | wchar_t* s2wc(const char* c) 3 | { 4 | const size_t cSize = strlen(c) + 1; 5 | wchar_t* wc = new wchar_t[cSize]; 6 | mbstowcs(wc, c, cSize); 7 | 8 | return wc; 9 | } 10 | 11 | namespace ZeroGUI 12 | { 13 | namespace Colors 14 | { 15 | FLinearColor Text{ 1.0f, 1.0f, 1.0f, 1.0f }; 16 | FLinearColor Text_Shadow{ 0.0f, 0.0f, 0.0f, 0.0f }; 17 | FLinearColor Text_Outline{ 0.0f, 0.0f, 0.0f, 0.30f }; 18 | 19 | FLinearColor Window_Background{ 0.009f, 0.009f, 0.009f, 1.0f }; 20 | FLinearColor Window_Header{ 0.10f, 0.15f, 0.84f, 1.0f }; 21 | 22 | FLinearColor Button_Idle{ 0.10f, 0.15f, 0.84f, 1.0f }; 23 | FLinearColor Button_Hovered{ 0.15f, 0.20f, 0.89f, 1.0f }; 24 | FLinearColor Button_Active{ 0.20f, 0.25f, 0.94f, 1.0f }; 25 | 26 | FLinearColor Checkbox_Idle{ 0.17f, 0.16f, 0.23f, 1.0f }; 27 | FLinearColor Checkbox_Hovered{ 0.22f, 0.30f, 0.72f, 1.0f }; 28 | FLinearColor Checkbox_Enabled{ 0.20f, 0.25f, 0.94f, 1.0f }; 29 | 30 | FLinearColor Combobox_Idle{ 0.17f, 0.16f, 0.23f, 1.0f }; 31 | FLinearColor Combobox_Hovered{ 0.17f, 0.16f, 0.23f, 1.0f }; 32 | FLinearColor Combobox_Elements{ 0.239f, 0.42f, 0.82f, 1.0f }; 33 | 34 | FLinearColor Slider_Idle{ 0.17f, 0.16f, 0.23f, 1.0f }; 35 | FLinearColor Slider_Hovered{ 0.17f, 0.16f, 0.23f, 1.0f }; 36 | FLinearColor Slider_Progress{ 0.22f, 0.30f, 0.72f, 1.0f }; 37 | FLinearColor Slider_Button{ 0.10f, 0.15f, 0.84f, 1.0f }; 38 | 39 | FLinearColor ColorPicker_Background{ 0.006f, 0.006f, 0.006f, 1.0f }; 40 | } 41 | 42 | namespace PostRenderer 43 | { 44 | struct DrawList 45 | { 46 | int type = -1; //1 = FilledRect, 2 = TextLeft, 3 = TextCenter, 4 = Draw_Line 47 | FVector2D pos; 48 | FVector2D size; 49 | FLinearColor color; 50 | char* name; 51 | bool outline; 52 | 53 | FVector2D from; 54 | FVector2D to; 55 | int thickness; 56 | }; 57 | DrawList drawlist[128]; 58 | 59 | void drawFilledRect(FVector2D pos, float w, float h, FLinearColor color) 60 | { 61 | for (int i = 0; i < 128; i++) 62 | { 63 | if (drawlist[i].type == -1) 64 | { 65 | drawlist[i].type = 1; 66 | drawlist[i].pos = pos; 67 | drawlist[i].size = FVector2D{ w, h }; 68 | drawlist[i].color = color; 69 | return; 70 | } 71 | } 72 | } 73 | void TextLeft(char* name, FVector2D pos, FLinearColor color, bool outline) 74 | { 75 | for (int i = 0; i < 128; i++) 76 | { 77 | if (drawlist[i].type == -1) 78 | { 79 | drawlist[i].type = 2; 80 | drawlist[i].name = name; 81 | drawlist[i].pos = pos; 82 | drawlist[i].outline = outline; 83 | drawlist[i].color = color; 84 | return; 85 | } 86 | } 87 | } 88 | void TextCenter(char* name, FVector2D pos, FLinearColor color, bool outline) 89 | { 90 | for (int i = 0; i < 128; i++) 91 | { 92 | if (drawlist[i].type == -1) 93 | { 94 | drawlist[i].type = 3; 95 | drawlist[i].name = name; 96 | drawlist[i].pos = pos; 97 | drawlist[i].outline = outline; 98 | drawlist[i].color = color; 99 | return; 100 | } 101 | } 102 | } 103 | void Draw_Line(FVector2D from, FVector2D to, int thickness, FLinearColor color) 104 | { 105 | for (int i = 0; i < 128; i++) 106 | { 107 | if (drawlist[i].type == -1) 108 | { 109 | drawlist[i].type = 4; 110 | drawlist[i].from = from; 111 | drawlist[i].to = to; 112 | drawlist[i].thickness = thickness; 113 | drawlist[i].color = color; 114 | return; 115 | } 116 | } 117 | } 118 | } 119 | 120 | UCanvas* canvas; 121 | 122 | 123 | bool hover_element = false; 124 | FVector2D menu_pos = FVector2D{ 0, 0 }; 125 | float offset_x = 0.0f; 126 | float offset_y = 0.0f; 127 | 128 | FVector2D first_element_pos = FVector2D{ 0, 0 }; 129 | 130 | FVector2D last_element_pos = FVector2D{ 0, 0 }; 131 | FVector2D last_element_size = FVector2D{ 0, 0 }; 132 | 133 | int current_element = -1; 134 | FVector2D current_element_pos = FVector2D{ 0, 0 }; 135 | FVector2D current_element_size = FVector2D{ 0, 0 }; 136 | int elements_count = 0; 137 | 138 | bool sameLine = false; 139 | 140 | bool pushY = false; 141 | float pushYvalue = 0.0f; 142 | 143 | void SetupCanvas(UCanvas* _canvas) 144 | { 145 | canvas = _canvas; 146 | } 147 | 148 | FVector2D CursorPos() 149 | { 150 | POINT cursorPos; 151 | GetCursorPos(&cursorPos); 152 | return FVector2D{ (float)cursorPos.x, (float)cursorPos.y }; 153 | } 154 | bool MouseInZone(FVector2D pos, FVector2D size) 155 | { 156 | FVector2D cursor_pos = CursorPos(); 157 | 158 | if (cursor_pos.X > pos.X && cursor_pos.Y > pos.Y) 159 | if (cursor_pos.X < pos.X + size.X && cursor_pos.Y < pos.Y + size.Y) 160 | return true; 161 | 162 | return false; 163 | } 164 | 165 | void Draw_Cursor(bool toogle) 166 | { 167 | if (toogle) 168 | { 169 | FVector2D cursorPos = CursorPos(); 170 | canvas->K2_DrawLine(FVector2D{ cursorPos.X, cursorPos.Y }, FVector2D{ cursorPos.X + 35, cursorPos.Y + 10 }, 1, FLinearColor{ 0.30f, 0.30f, 0.80f, 1.0f }); 171 | 172 | 173 | int x = 35; 174 | int y = 10; 175 | while (y != 30) //20 steps 176 | { 177 | x -= 1; if (x < 15) x = 15; 178 | y += 1; if (y > 30) y = 30; 179 | 180 | canvas->K2_DrawLine(FVector2D{ cursorPos.X, cursorPos.Y }, FVector2D{ cursorPos.X + x, cursorPos.Y + y }, 1, FLinearColor{ 0.30f, 0.30f, 0.80f, 1.0f }); 181 | } 182 | 183 | canvas->K2_DrawLine(FVector2D{ cursorPos.X, cursorPos.Y }, FVector2D{ cursorPos.X + 15, cursorPos.Y + 30 }, 1, FLinearColor{ 0.30f, 0.30f, 0.80f, 1.0f }); 184 | canvas->K2_DrawLine(FVector2D{ cursorPos.X + 35, cursorPos.Y + 10 }, FVector2D{ cursorPos.X + 15, cursorPos.Y + 30 }, 1, FLinearColor{ 0.30f, 0.30f, 0.80f, 1.0f }); 185 | } 186 | } 187 | 188 | void SameLine() 189 | { 190 | sameLine = true; 191 | } 192 | void PushNextElementY(float y, bool from_last_element = true) 193 | { 194 | pushY = true; 195 | if (from_last_element) 196 | pushYvalue = last_element_pos.Y + last_element_size.Y + y; 197 | else 198 | pushYvalue = y; 199 | } 200 | void NextColumn(float x) 201 | { 202 | offset_x = x; 203 | PushNextElementY(first_element_pos.Y, false); 204 | } 205 | void ClearFirstPos() 206 | { 207 | first_element_pos = FVector2D{ 0, 0 }; 208 | } 209 | 210 | void TextLeft(char* name, FVector2D pos, FLinearColor color, bool outline) 211 | { 212 | int length = strlen(name) + 1; 213 | canvas->K2_DrawText(Functions::NamesFont, FString{ s2wc(name), length, length }, pos, FVector2D{ 0.97f, 0.97f }, color, false, Colors::Text_Shadow, FVector2D{ pos.X + 1, pos.Y + 1 }, false, true, true, Colors::Text_Outline); 214 | } 215 | void TextCenter(char* name, FVector2D pos, FLinearColor color, bool outline) 216 | { 217 | int length = strlen(name) + 1; 218 | canvas->K2_DrawText(Functions::NamesFont, FString{ s2wc(name), length, length }, pos, FVector2D{ 0.97f, 0.97f }, color, false, Colors::Text_Shadow, FVector2D{ pos.X + 1, pos.Y + 1 }, true, true, true, Colors::Text_Outline); 219 | } 220 | 221 | void GetColor(FLinearColor* color, float* r, float* g, float* b, float* a) 222 | { 223 | *r = color->R; 224 | *g = color->G; 225 | *b = color->B; 226 | *a = color->A; 227 | } 228 | UINT32 GetColorUINT(int r, int g, int b, int a) 229 | { 230 | UINT32 result = (BYTE(a) << 24) + (BYTE(r) << 16) + (BYTE(g) << 8) + BYTE(b); 231 | return result; 232 | } 233 | 234 | void Draw_Line(FVector2D from, FVector2D to, int thickness, FLinearColor color) 235 | { 236 | canvas->K2_DrawLine(FVector2D{ from.X, from.Y }, FVector2D{ to.X, to.Y }, thickness, color); 237 | } 238 | void drawFilledRect(FVector2D initial_pos, float w, float h, FLinearColor color) 239 | { 240 | for (float i = 0.0f; i < h; i += 1.0f) 241 | canvas->K2_DrawLine(FVector2D{ initial_pos.X, initial_pos.Y + i }, FVector2D{ initial_pos.X + w, initial_pos.Y + i }, 1.0f, color); 242 | } 243 | void DrawFilledCircle(FVector2D pos, float r, FLinearColor color) 244 | { 245 | float smooth = 0.07f; 246 | 247 | double PI = 3.14159265359; 248 | int size = (int)(2.0f * PI / smooth) + 1; 249 | 250 | float angle = 0.0f; 251 | int i = 0; 252 | 253 | for (; angle < 2 * PI; angle += smooth, i++) 254 | { 255 | Draw_Line(FVector2D{ pos.X, pos.Y }, FVector2D{ pos.X + cosf(angle) * r, pos.Y + sinf(angle) * r }, 1.0f, color); 256 | } 257 | } 258 | void DrawCircle(FVector2D pos, int radius, int numSides, FLinearColor Color) 259 | { 260 | float PI = 3.1415927f; 261 | 262 | float Step = PI * 2.0 / numSides; 263 | int Count = 0; 264 | FVector2D V[128]; 265 | for (float a = 0; a < PI * 2.0; a += Step) { 266 | float X1 = radius * cos(a) + pos.X; 267 | float Y1 = radius * sin(a) + pos.Y; 268 | float X2 = radius * cos(a + Step) + pos.X; 269 | float Y2 = radius * sin(a + Step) + pos.Y; 270 | V[Count].X = X1; 271 | V[Count].Y = Y1; 272 | V[Count + 1].X = X2; 273 | V[Count + 1].Y = Y2; 274 | //Draw_Line(FVector2D{ pos.X, pos.Y }, FVector2D{ X2, Y2 }, 1.0f, Color); // Points from Centre to ends of circle 275 | Draw_Line(FVector2D{ V[Count].X, V[Count].Y }, FVector2D{ X2, Y2 }, 1.0f, Color);// Circle Around 276 | } 277 | } 278 | 279 | FVector2D dragPos; 280 | bool Window(char* name, FVector2D* pos, FVector2D size, bool isOpen) 281 | { 282 | elements_count = 0; 283 | 284 | if (!isOpen) 285 | return false; 286 | 287 | bool isHovered = MouseInZone(FVector2D{ pos->X, pos->Y }, size); 288 | 289 | //Drop last element 290 | if (current_element != -1 && !GetAsyncKeyState(0x1)) 291 | { 292 | current_element = -1; 293 | } 294 | 295 | //Drag 296 | if (hover_element && GetAsyncKeyState(0x1)) 297 | { 298 | 299 | } 300 | else if ((isHovered || dragPos.X != 0) && !hover_element) 301 | { 302 | if (Input::IsMouseClicked(0, elements_count, true)) 303 | { 304 | FVector2D cursorPos = CursorPos(); 305 | 306 | cursorPos.X -= size.X; 307 | cursorPos.Y -= size.Y; 308 | 309 | if (dragPos.X == 0) 310 | { 311 | dragPos.X = (cursorPos.X - pos->X); 312 | dragPos.Y = (cursorPos.Y - pos->Y); 313 | } 314 | pos->X = cursorPos.X - dragPos.X; 315 | pos->Y = cursorPos.Y - dragPos.Y; 316 | } 317 | else 318 | { 319 | dragPos = FVector2D{ 0, 0 }; 320 | } 321 | } 322 | else 323 | { 324 | hover_element = false; 325 | } 326 | 327 | 328 | offset_x = 0.0f; offset_y = 0.0f; 329 | menu_pos = FVector2D{ pos->X, pos->Y }; 330 | first_element_pos = FVector2D{ 0, 0 }; 331 | current_element_pos = FVector2D{ 0, 0 }; 332 | current_element_size = FVector2D{ 0, 0 }; 333 | 334 | //Bg 335 | drawFilledRect(FVector2D{ pos->X, pos->Y }, size.X, size.Y, Colors::Window_Background); 336 | //drawFilledRect(FVector2D{ pos->X, pos->Y }, 122, size.Y, FLinearColor{ 0.006f, 0.006f, 0.006f, 1.0f });//My tabs bg 337 | 338 | //Header 339 | drawFilledRect(FVector2D{ pos->X, pos->Y }, size.X, 25.0f, Colors::Window_Header); 340 | 341 | offset_y += 25.0f; 342 | 343 | //Title 344 | FVector2D titlePos = FVector2D{ pos->X + size.X / 2, pos->Y + 25 / 2 }; 345 | TextCenter(name, titlePos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 346 | 347 | return true; 348 | } 349 | 350 | void Text(char* text, bool center = false, bool outline = false) 351 | { 352 | elements_count++; 353 | 354 | float size = 25; 355 | FVector2D padding = FVector2D{ 10, 10 }; 356 | FVector2D pos = FVector2D{ menu_pos.X + padding.X + offset_x, menu_pos.Y + padding.Y + offset_y }; 357 | if (sameLine) 358 | { 359 | pos.X = last_element_pos.X + last_element_size.X + padding.X; 360 | pos.Y = last_element_pos.Y; 361 | } 362 | if (pushY) 363 | { 364 | pos.Y = pushYvalue; 365 | pushY = false; 366 | pushYvalue = 0.0f; 367 | offset_y = pos.Y - menu_pos.Y; 368 | } 369 | 370 | if (!sameLine) 371 | offset_y += size + padding.Y; 372 | 373 | //Text 374 | FVector2D textPos = FVector2D{ pos.X + 5.0f, pos.Y + size / 2 }; 375 | if (center) 376 | TextCenter(text, textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, outline); 377 | else 378 | TextLeft(text, textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, outline); 379 | 380 | sameLine = false; 381 | last_element_pos = pos; 382 | //last_element_size = size; 383 | if (first_element_pos.X == 0.0f) 384 | first_element_pos = pos; 385 | } 386 | bool ButtonTab(char* name, FVector2D size, bool active) 387 | { 388 | elements_count++; 389 | 390 | FVector2D padding = FVector2D{ 5, 10 }; 391 | FVector2D pos = FVector2D{ menu_pos.X + padding.X + offset_x, menu_pos.Y + padding.Y + offset_y }; 392 | if (sameLine) 393 | { 394 | pos.X = last_element_pos.X + last_element_size.X + padding.X; 395 | pos.Y = last_element_pos.Y; 396 | } 397 | if (pushY) 398 | { 399 | pos.Y = pushYvalue; 400 | pushY = false; 401 | pushYvalue = 0.0f; 402 | offset_y = pos.Y - menu_pos.Y; 403 | } 404 | bool isHovered = MouseInZone(FVector2D{ pos.X, pos.Y }, size); 405 | 406 | //Bg 407 | if (active) 408 | { 409 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size.X, size.Y, Colors::Button_Active); 410 | } 411 | else if (isHovered) 412 | { 413 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size.X, size.Y, Colors::Button_Hovered); 414 | hover_element = true; 415 | } 416 | else 417 | { 418 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size.X, size.Y, Colors::Button_Idle); 419 | } 420 | 421 | if (!sameLine) 422 | offset_y += size.Y + padding.Y; 423 | 424 | //Text 425 | FVector2D textPos = FVector2D{ pos.X + size.X / 2, pos.Y + size.Y / 2 }; 426 | TextCenter(name, textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 427 | 428 | 429 | sameLine = false; 430 | last_element_pos = pos; 431 | last_element_size = size; 432 | if (first_element_pos.X == 0.0f) 433 | first_element_pos = pos; 434 | 435 | if (isHovered && Input::IsMouseClicked(0, elements_count, false)) 436 | return true; 437 | 438 | return false; 439 | } 440 | bool Button(char* name, FVector2D size) 441 | { 442 | elements_count++; 443 | 444 | FVector2D padding = FVector2D{ 5, 10 }; 445 | FVector2D pos = FVector2D{ menu_pos.X + padding.X + offset_x, menu_pos.Y + padding.Y + offset_y }; 446 | if (sameLine) 447 | { 448 | pos.X = last_element_pos.X + last_element_size.X + padding.X; 449 | pos.Y = last_element_pos.Y; 450 | } 451 | if (pushY) 452 | { 453 | pos.Y = pushYvalue; 454 | pushY = false; 455 | pushYvalue = 0.0f; 456 | offset_y = pos.Y - menu_pos.Y; 457 | } 458 | bool isHovered = MouseInZone(FVector2D{ pos.X, pos.Y }, size); 459 | 460 | //Bg 461 | if (isHovered) 462 | { 463 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size.X, size.Y, Colors::Button_Hovered); 464 | hover_element = true; 465 | } 466 | else 467 | { 468 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size.X, size.Y, Colors::Button_Idle); 469 | } 470 | 471 | if (!sameLine) 472 | offset_y += size.Y + padding.Y; 473 | 474 | //Text 475 | FVector2D textPos = FVector2D{ pos.X + size.X / 2, pos.Y + size.Y / 2 }; 476 | //if (!TextOverlapedFromActiveElement(textPos)) 477 | TextCenter(name, textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 478 | 479 | 480 | sameLine = false; 481 | last_element_pos = pos; 482 | last_element_size = size; 483 | if (first_element_pos.X == 0.0f) 484 | first_element_pos = pos; 485 | 486 | if (isHovered && Input::IsMouseClicked(0, elements_count, false)) 487 | return true; 488 | 489 | return false; 490 | } 491 | void Checkbox(char* name, bool* value) 492 | { 493 | elements_count++; 494 | 495 | float size = 18; 496 | FVector2D padding = FVector2D{ 10, 10 }; 497 | FVector2D pos = FVector2D{ menu_pos.X + padding.X + offset_x, menu_pos.Y + padding.Y + offset_y }; 498 | if (sameLine) 499 | { 500 | pos.X = last_element_pos.X + last_element_size.X + padding.X; 501 | pos.Y = last_element_pos.Y; 502 | } 503 | if (pushY) 504 | { 505 | pos.Y = pushYvalue; 506 | pushY = false; 507 | pushYvalue = 0.0f; 508 | offset_y = pos.Y - menu_pos.Y; 509 | } 510 | bool isHovered = MouseInZone(FVector2D{ pos.X, pos.Y }, FVector2D{ size, size }); 511 | 512 | //Bg 513 | if (isHovered) 514 | { 515 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size, size, Colors::Checkbox_Hovered); 516 | hover_element = true; 517 | } 518 | else 519 | { 520 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size, size, Colors::Checkbox_Idle); 521 | } 522 | 523 | if (!sameLine) 524 | offset_y += size + padding.Y; 525 | 526 | if (*value) 527 | { 528 | drawFilledRect(FVector2D{ pos.X + 3, pos.Y + 3 }, size - 6, size - 6, Colors::Checkbox_Enabled); 529 | //drawFilledRect(FVector2D{ pos.X + 9, pos.Y + 9 }, size - 18, size - 18, Colors::Checkbox_Hovered); 530 | } 531 | 532 | 533 | 534 | //Text 535 | FVector2D textPos = FVector2D{ pos.X + size + 5.0f, pos.Y + size / 2 }; 536 | //if (!TextOverlapedFromActiveElement(textPos)) 537 | TextLeft(name, textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 538 | 539 | 540 | sameLine = false; 541 | last_element_pos = pos; 542 | //last_element_size = size; 543 | if (first_element_pos.X == 0.0f) 544 | first_element_pos = pos; 545 | 546 | if (isHovered && Input::IsMouseClicked(0, elements_count, false)) 547 | *value = !*value; 548 | } 549 | void SliderInt(char* name, int* value, int min, int max) 550 | { 551 | elements_count++; 552 | 553 | FVector2D size = FVector2D{ 240, 50 }; 554 | FVector2D slider_size = FVector2D{ 200, 10 }; 555 | FVector2D padding = FVector2D{ 10, 15 }; 556 | FVector2D pos = FVector2D{ menu_pos.X + padding.X + offset_x, menu_pos.Y + padding.Y + offset_y }; 557 | if (sameLine) 558 | { 559 | pos.X = last_element_pos.X + last_element_size.X + padding.X; 560 | pos.Y = last_element_pos.Y; 561 | } 562 | if (pushY) 563 | { 564 | pos.Y = pushYvalue; 565 | pushY = false; 566 | pushYvalue = 0.0f; 567 | offset_y = pos.Y - menu_pos.Y; 568 | } 569 | bool isHovered = MouseInZone(FVector2D{ pos.X, pos.Y + slider_size.Y + padding.Y }, slider_size); 570 | 571 | if (!sameLine) 572 | offset_y += size.Y + padding.Y; 573 | 574 | //Bg 575 | if (isHovered || current_element == elements_count) 576 | { 577 | //Drag 578 | if (Input::IsMouseClicked(0, elements_count, true)) 579 | { 580 | current_element = elements_count; 581 | 582 | FVector2D cursorPos = CursorPos(); 583 | *value = ((cursorPos.X - pos.X) * ((max - min) / slider_size.X)) + min; 584 | if (*value < min) *value = min; 585 | if (*value > max) *value = max; 586 | } 587 | 588 | drawFilledRect(FVector2D{ pos.X, pos.Y + slider_size.Y + padding.Y }, slider_size.X, slider_size.Y, Colors::Slider_Hovered); 589 | drawFilledRect(FVector2D{ pos.X, pos.Y + slider_size.Y + padding.Y + 5.0f }, 5.0f, 5.0f, Colors::Slider_Progress); 590 | 591 | hover_element = true; 592 | } 593 | else 594 | { 595 | drawFilledRect(FVector2D{ pos.X, pos.Y + slider_size.Y + padding.Y }, slider_size.X, slider_size.Y, Colors::Slider_Idle); 596 | drawFilledRect(FVector2D{ pos.X, pos.Y + slider_size.Y + padding.Y + 5.0f }, 5.0f, 5.0f, Colors::Slider_Progress); 597 | } 598 | 599 | 600 | //Value 601 | float oneP = slider_size.X / (max - min); 602 | drawFilledRect(FVector2D{ pos.X, pos.Y + slider_size.Y + padding.Y }, oneP * (*value - min), slider_size.Y, Colors::Slider_Progress); 603 | //drawFilledRect(FVector2D{ pos.X + oneP * (*value - min) - 10.0f, pos.Y + slider_size.Y - 5.0f + padding.Y }, 20.0f, 20.0f, Colors::Slider_Button); 604 | DrawFilledCircle(FVector2D{ pos.X + oneP * (*value - min), pos.Y + slider_size.Y + 3.3f + padding.Y }, 10.0f, Colors::Slider_Button); 605 | DrawFilledCircle(FVector2D{ pos.X + oneP * (*value - min), pos.Y + slider_size.Y + 3.3f + padding.Y }, 5.0f, Colors::Slider_Progress); 606 | 607 | char buffer[32]; 608 | sprintf_s(buffer, "%i", *value); 609 | FVector2D valuePos = FVector2D{ pos.X + oneP * (*value - min), pos.Y + slider_size.Y + 25 + padding.Y }; 610 | TextCenter(buffer, valuePos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 611 | 612 | //Text 613 | FVector2D textPos = FVector2D{ pos.X + 5, pos.Y + 10 }; 614 | TextLeft(name, textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 615 | 616 | 617 | sameLine = false; 618 | last_element_pos = pos; 619 | last_element_size = size; 620 | if (first_element_pos.X == 0.0f) 621 | first_element_pos = pos; 622 | } 623 | void SliderFloat(char* name, float* value, float min, float max, char* format = "%.0f") 624 | { 625 | elements_count++; 626 | 627 | FVector2D size = FVector2D{ 210, 40 }; 628 | FVector2D slider_size = FVector2D{ 170, 7 }; 629 | FVector2D adjust_zone = FVector2D{ 0, 20 }; 630 | FVector2D padding = FVector2D{ 10, 15 }; 631 | FVector2D pos = FVector2D{ menu_pos.X + padding.X + offset_x, menu_pos.Y + padding.Y + offset_y }; 632 | if (sameLine) 633 | { 634 | pos.X = last_element_pos.X + last_element_size.X + padding.X; 635 | pos.Y = last_element_pos.Y; 636 | } 637 | if (pushY) 638 | { 639 | pos.Y = pushYvalue; 640 | pushY = false; 641 | pushYvalue = 0.0f; 642 | offset_y = pos.Y - menu_pos.Y; 643 | } 644 | bool isHovered = MouseInZone(FVector2D{ pos.X, pos.Y + slider_size.Y + padding.Y - adjust_zone.Y }, FVector2D{ slider_size.X, slider_size.Y + adjust_zone.Y * 1.5f }); 645 | 646 | if (!sameLine) 647 | offset_y += size.Y + padding.Y; 648 | 649 | //Bg 650 | if (isHovered || current_element == elements_count) 651 | { 652 | //Drag 653 | if (Input::IsMouseClicked(0, elements_count, true)) 654 | { 655 | current_element = elements_count; 656 | 657 | FVector2D cursorPos = CursorPos(); 658 | *value = ((cursorPos.X - pos.X) * ((max - min) / slider_size.X)) + min; 659 | if (*value < min) *value = min; 660 | if (*value > max) *value = max; 661 | } 662 | 663 | drawFilledRect(FVector2D{ pos.X, pos.Y + slider_size.Y + padding.Y }, slider_size.X, slider_size.Y, Colors::Slider_Hovered); 664 | DrawFilledCircle(FVector2D{ pos.X, pos.Y + padding.Y + 9.3f }, 3.1f, Colors::Slider_Progress); 665 | DrawFilledCircle(FVector2D{ pos.X + slider_size.X, pos.Y + padding.Y + 9.3f }, 3.1f, Colors::Slider_Hovered); 666 | 667 | hover_element = true; 668 | } 669 | else 670 | { 671 | drawFilledRect(FVector2D{ pos.X, pos.Y + slider_size.Y + padding.Y }, slider_size.X, slider_size.Y, Colors::Slider_Idle); 672 | DrawFilledCircle(FVector2D{ pos.X, pos.Y + padding.Y + 9.3f }, 3.1f, Colors::Slider_Progress); 673 | DrawFilledCircle(FVector2D{ pos.X + slider_size.X, pos.Y + padding.Y + 9.3f }, 3.1f, Colors::Slider_Idle); 674 | } 675 | 676 | 677 | //Text 678 | FVector2D textPos = FVector2D{ pos.X, pos.Y + 5 }; 679 | TextLeft(name, textPos, Colors::Text, false); 680 | 681 | //Value 682 | float oneP = slider_size.X / (max - min); 683 | drawFilledRect(FVector2D{ pos.X, pos.Y + slider_size.Y + padding.Y }, oneP * (*value - min), slider_size.Y, Colors::Slider_Progress); 684 | DrawFilledCircle(FVector2D{ pos.X + oneP * (*value - min), pos.Y + slider_size.Y + 2.66f + padding.Y }, 8.0f, Colors::Slider_Button); 685 | DrawFilledCircle(FVector2D{ pos.X + oneP * (*value - min), pos.Y + slider_size.Y + 2.66f + padding.Y }, 4.0f, Colors::Slider_Progress); 686 | 687 | char buffer[32]; 688 | sprintf_s(buffer, format, *value); 689 | FVector2D valuePos = FVector2D{ pos.X + oneP * (*value - min), pos.Y + slider_size.Y + 20 + padding.Y }; 690 | TextCenter(buffer, valuePos, Colors::Text, false); 691 | 692 | 693 | sameLine = false; 694 | last_element_pos = pos; 695 | last_element_size = size; 696 | if (first_element_pos.X == 0.0f) 697 | first_element_pos = pos; 698 | } 699 | 700 | 701 | 702 | bool checkbox_enabled[256]; 703 | void Combobox(char* name, FVector2D size, int* value, const char* arg, ...) 704 | { 705 | elements_count++; 706 | 707 | FVector2D padding = FVector2D{ 5, 10 }; 708 | FVector2D pos = FVector2D{ menu_pos.X + padding.X + offset_x, menu_pos.Y + padding.Y + offset_y }; 709 | if (sameLine) 710 | { 711 | pos.X = last_element_pos.X + last_element_size.X + padding.X; 712 | pos.Y = last_element_pos.Y; 713 | } 714 | if (pushY) 715 | { 716 | pos.Y = pushYvalue; 717 | pushY = false; 718 | pushYvalue = 0.0f; 719 | offset_y = pos.Y - menu_pos.Y; 720 | } 721 | bool isHovered = MouseInZone(FVector2D{ pos.X, pos.Y }, size); 722 | 723 | //Bg 724 | if (isHovered || checkbox_enabled[elements_count]) 725 | { 726 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size.X, size.Y, Colors::Combobox_Hovered); 727 | 728 | hover_element = true; 729 | } 730 | else 731 | { 732 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size.X, size.Y, Colors::Combobox_Idle); 733 | } 734 | 735 | if (!sameLine) 736 | offset_y += size.Y + padding.Y; 737 | 738 | //Text 739 | FVector2D textPos = FVector2D{ pos.X + size.X + 5.0f, pos.Y + size.Y / 2 }; 740 | TextLeft(name, textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 741 | 742 | //Elements 743 | bool isHovered2 = false; 744 | FVector2D element_pos = pos; 745 | int num = 0; 746 | 747 | if (checkbox_enabled[elements_count]) 748 | { 749 | current_element_size.X = element_pos.X - 5.0f; 750 | current_element_size.Y = element_pos.Y - 5.0f; 751 | } 752 | va_list arguments; 753 | for (va_start(arguments, arg); arg != NULL; arg = va_arg(arguments, const char*)) 754 | { 755 | //Selected Element 756 | if (num == *value) 757 | { 758 | FVector2D _textPos = FVector2D{ pos.X + size.X / 2, pos.Y + size.Y / 2 }; 759 | TextCenter((char*)arg, _textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 760 | } 761 | 762 | if (checkbox_enabled[elements_count]) 763 | { 764 | element_pos.Y += 25.0f; 765 | 766 | isHovered2 = MouseInZone(FVector2D{ element_pos.X, element_pos.Y }, FVector2D{ size.X, 25.0f }); 767 | if (isHovered2) 768 | { 769 | hover_element = true; 770 | PostRenderer::drawFilledRect(FVector2D{ element_pos.X, element_pos.Y }, size.X, 25.0f, Colors::Combobox_Hovered); 771 | 772 | //Click 773 | if (Input::IsMouseClicked(0, elements_count, false)) 774 | { 775 | *value = num; 776 | checkbox_enabled[elements_count] = false; 777 | } 778 | } 779 | else 780 | { 781 | PostRenderer::drawFilledRect(FVector2D{ element_pos.X, element_pos.Y }, size.X, 25.0f, Colors::Combobox_Idle); 782 | } 783 | 784 | PostRenderer::TextLeft((char*)arg, FVector2D{ element_pos.X + 5.0f, element_pos.Y + 15.0f }, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 785 | } 786 | num++; 787 | } 788 | va_end(arguments); 789 | if (checkbox_enabled[elements_count]) 790 | { 791 | current_element_size.X = element_pos.X + 5.0f; 792 | current_element_size.Y = element_pos.Y + 5.0f; 793 | } 794 | 795 | 796 | sameLine = false; 797 | last_element_pos = pos; 798 | last_element_size = size; 799 | if (first_element_pos.X == 0.0f) 800 | first_element_pos = pos; 801 | 802 | if (isHovered && Input::IsMouseClicked(0, elements_count, false)) 803 | { 804 | checkbox_enabled[elements_count] = !checkbox_enabled[elements_count]; 805 | } 806 | if (!isHovered && !isHovered2 && Input::IsMouseClicked(0, elements_count, false)) 807 | { 808 | checkbox_enabled[elements_count] = false; 809 | } 810 | } 811 | 812 | int active_hotkey = -1; 813 | bool already_pressed = false; 814 | std::string VirtualKeyCodeToString(UCHAR virtualKey) 815 | { 816 | UINT scanCode = MapVirtualKey(virtualKey, MAPVK_VK_TO_VSC); 817 | 818 | if (virtualKey == VK_LBUTTON) 819 | { 820 | return crypt("MOUSE0"); 821 | } 822 | if (virtualKey == VK_RBUTTON) 823 | { 824 | return crypt("MOUSE1"); 825 | } 826 | if (virtualKey == VK_MBUTTON) 827 | { 828 | return crypt("MBUTTON"); 829 | } 830 | if (virtualKey == VK_XBUTTON1) 831 | { 832 | return crypt("XBUTTON1"); 833 | } 834 | if (virtualKey == VK_XBUTTON2) 835 | { 836 | return crypt("XBUTTON2"); 837 | } 838 | 839 | CHAR szName[128]; 840 | int result = 0; 841 | switch (virtualKey) 842 | { 843 | case VK_LEFT: case VK_UP: case VK_RIGHT: case VK_DOWN: 844 | case VK_RCONTROL: case VK_RMENU: 845 | case VK_LWIN: case VK_RWIN: case VK_APPS: 846 | case VK_PRIOR: case VK_NEXT: 847 | case VK_END: case VK_HOME: 848 | case VK_INSERT: case VK_DELETE: 849 | case VK_DIVIDE: 850 | case VK_NUMLOCK: 851 | scanCode |= KF_EXTENDED; 852 | default: 853 | result = GetKeyNameTextA(scanCode << 16, szName, 128); 854 | } 855 | 856 | return szName; 857 | } 858 | void Hotkey(char* name, FVector2D size, int* key) 859 | { 860 | elements_count++; 861 | 862 | FVector2D padding = FVector2D{ 5, 10 }; 863 | FVector2D pos = FVector2D{ menu_pos.X + padding.X + offset_x, menu_pos.Y + padding.Y + offset_y }; 864 | if (sameLine) 865 | { 866 | pos.X = last_element_pos.X + last_element_size.X + padding.X; 867 | pos.Y = last_element_pos.Y + (last_element_size.Y / 2) - size.Y / 2; 868 | } 869 | if (pushY) 870 | { 871 | pos.Y = pushYvalue; 872 | pushY = false; 873 | pushYvalue = 0.0f; 874 | offset_y = pos.Y - menu_pos.Y; 875 | } 876 | bool isHovered = MouseInZone(FVector2D{ pos.X, pos.Y }, size); 877 | 878 | //Bg 879 | if (isHovered) 880 | { 881 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size.X, size.Y, Colors::Button_Hovered); 882 | hover_element = true; 883 | } 884 | else 885 | { 886 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size.X, size.Y, Colors::Button_Idle); 887 | } 888 | 889 | if (!sameLine) 890 | offset_y += size.Y + padding.Y; 891 | 892 | if (active_hotkey == elements_count) 893 | { 894 | //Text 895 | FVector2D textPos = FVector2D{ pos.X + size.X / 2, pos.Y + size.Y / 2 }; 896 | TextCenter(crypt("[Press Key]"), textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 897 | 898 | if (!ZeroGUI::Input::IsAnyMouseDown()) 899 | { 900 | already_pressed = false; 901 | } 902 | 903 | if (!already_pressed) 904 | { 905 | for (int code = 0; code < 255; code++) 906 | { 907 | if (GetAsyncKeyState(code)) 908 | { 909 | *key = code; 910 | active_hotkey = -1; 911 | } 912 | } 913 | } 914 | } 915 | else 916 | { 917 | //Text 918 | FVector2D textPos = FVector2D{ pos.X + size.X / 2, pos.Y + size.Y / 2 }; 919 | TextCenter((char*)VirtualKeyCodeToString(*key).c_str(), textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 920 | 921 | if (isHovered) 922 | { 923 | if (Input::IsMouseClicked(0, elements_count, false)) 924 | { 925 | already_pressed = true; 926 | active_hotkey = elements_count; 927 | 928 | //Queue Fix 929 | for (int code = 0; code < 255; code++) 930 | if (GetAsyncKeyState(code)) { } 931 | } 932 | } 933 | else 934 | { 935 | if (Input::IsMouseClicked(0, elements_count, false)) 936 | { 937 | active_hotkey = -1; 938 | } 939 | } 940 | } 941 | 942 | 943 | sameLine = false; 944 | last_element_pos = pos; 945 | last_element_size = size; 946 | if (first_element_pos.X == 0.0f) 947 | first_element_pos = pos; 948 | } 949 | 950 | int active_picker = -1; 951 | FLinearColor saved_color; 952 | bool ColorPixel(FVector2D pos, FVector2D size, FLinearColor* original, FLinearColor color) 953 | { 954 | PostRenderer::drawFilledRect(FVector2D{ pos.X, pos.Y }, size.X, size.Y, color); 955 | 956 | //Выбранный цвет 957 | if (original->R == color.R && original->G == color.G && original->B == color.B) 958 | { 959 | PostRenderer::Draw_Line(FVector2D{ pos.X, pos.Y }, FVector2D{ pos.X + size.X - 1, pos.Y }, 1.0f, FLinearColor{ 0.0f, 0.0f, 0.0f, 1.0f }); 960 | PostRenderer::Draw_Line(FVector2D{ pos.X, pos.Y + size.Y - 1 }, FVector2D{ pos.X + size.X - 1, pos.Y + size.Y - 1 }, 1.0f, FLinearColor{ 0.0f, 0.0f, 0.0f, 1.0f }); 961 | PostRenderer::Draw_Line(FVector2D{ pos.X, pos.Y }, FVector2D{ pos.X, pos.Y + size.Y - 1 }, 1.0f, FLinearColor{ 0.0f, 0.0f, 0.0f, 1.0f }); 962 | PostRenderer::Draw_Line(FVector2D{ pos.X + size.X - 1, pos.Y }, FVector2D{ pos.X + size.X - 1, pos.Y + size.Y - 1 }, 1.0f, FLinearColor{ 0.0f, 0.0f, 0.0f, 1.0f }); 963 | } 964 | 965 | //Смена цвета 966 | bool isHovered = MouseInZone(FVector2D{ pos.X, pos.Y }, size); 967 | if (isHovered) 968 | { 969 | if (Input::IsMouseClicked(0, elements_count, false)) 970 | *original = color; 971 | } 972 | 973 | return true; 974 | } 975 | void ColorPicker(char* name, FLinearColor* color) 976 | { 977 | elements_count++; 978 | 979 | float size = 25; 980 | FVector2D padding = FVector2D{ 10, 10 }; 981 | FVector2D pos = FVector2D{ menu_pos.X + padding.X + offset_x, menu_pos.Y + padding.Y + offset_y }; 982 | if (sameLine) 983 | { 984 | pos.X = last_element_pos.X + last_element_size.X + padding.X; 985 | pos.Y = last_element_pos.Y; 986 | } 987 | if (pushY) 988 | { 989 | pos.Y = pushYvalue; 990 | pushY = false; 991 | pushYvalue = 0.0f; 992 | offset_y = pos.Y - menu_pos.Y; 993 | } 994 | bool isHovered = MouseInZone(FVector2D{ pos.X, pos.Y }, FVector2D{ size, size }); 995 | 996 | if (!sameLine) 997 | offset_y += size + padding.Y; 998 | 999 | if (active_picker == elements_count) 1000 | { 1001 | hover_element = true; 1002 | 1003 | float sizePickerX = 250; 1004 | float sizePickerY = 250; 1005 | bool isHoveredPicker = MouseInZone(FVector2D{ pos.X, pos.Y }, FVector2D{ sizePickerX, sizePickerY - 60 }); 1006 | 1007 | //Background 1008 | PostRenderer::drawFilledRect(FVector2D{ pos.X, pos.Y }, sizePickerX, sizePickerY - 65, Colors::ColorPicker_Background); 1009 | 1010 | //float pixedSize = sizePickerY / pixels; 1011 | //FLinearColor temp_color{1.0f, 1.0f, 1.0f, 1.0f}; 1012 | //float iterator = 0.0f; 1013 | // 1014 | //for (int y = 0; y < pixels; y++) 1015 | //{ 1016 | // for (int x = 0; x < pixels; x++) 1017 | // { 1018 | // ColorPixel(FVector2D{ pos.X + pixedSize * x, pos.Y + pixedSize * y }, pixedSize, color, temp_color); 1019 | // temp_color.R -= (1.0f - saved_color.R) / pixels; 1020 | // temp_color.G -= (1.0f - saved_color.G) / pixels; 1021 | // temp_color.B -= (1.0f - saved_color.B) / pixels; 1022 | // } 1023 | // 1024 | // iterator += 1.0f / pixels; 1025 | // temp_color = FLinearColor{ 1.0f - iterator, 1.0f - iterator, 1.0f - iterator, 1.0f }; 1026 | //} 1027 | 1028 | FVector2D pixelSize = FVector2D{ sizePickerX/12, sizePickerY/12 }; 1029 | 1030 | //0 1031 | { 1032 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 0, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 174/255.f, 235/255.f, 253/255.f, 1.0f }); 1033 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 0, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 136/255.f, 225/255.f, 251/255.f, 1.0f }); 1034 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 0, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 108/255.f, 213/255.f, 250/255.f, 1.0f }); 1035 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 0, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 89/255.f, 175/255.f, 213/255.f, 1.0f }); 1036 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 0, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 76/255.f, 151/255.f, 177/255.f, 1.0f }); 1037 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 0, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 60/255.f, 118/255.f, 140/255.f, 1.0f }); 1038 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 0, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 43/255.f, 85/255.f, 100/255.f, 1.0f }); 1039 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 0, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 32/255.f, 62/255.f, 74/255.f, 1.0f }); 1040 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 0, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 255/255.f, 255/255.f, 255/255.f, 1.0f }); 1041 | } 1042 | //1 1043 | { 1044 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 1, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 175/255.f, 205/255.f, 252/255.f, 1.0f }); 1045 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 1, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 132/255.f, 179/255.f, 252/255.f, 1.0f }); 1046 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 1, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 90/255.f, 152/255.f, 250/255.f, 1.0f }); 1047 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 1, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 55/255.f, 120/255.f, 250/255.f, 1.0f }); 1048 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 1, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 49/255.f, 105/255.f, 209/255.f, 1.0f }); 1049 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 1, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 38/255.f, 83/255.f, 165/255.f, 1.0f }); 1050 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 1, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 28/255.f, 61/255.f, 120/255.f, 1.0f }); 1051 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 1, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 20/255.f, 43/255.f, 86/255.f, 1.0f }); 1052 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 1, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 247/255.f, 247/255.f, 247/255.f, 1.0f }); 1053 | } 1054 | //2 1055 | { 1056 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 2, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 153/255.f, 139/255.f, 250/255.f, 1.0f }); 1057 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 2, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 101/255.f, 79/255.f, 249/255.f, 1.0f }); 1058 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 2, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 64/255.f, 50/255.f, 230/255.f, 1.0f }); 1059 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 2, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 54/255.f, 38/255.f, 175/255.f, 1.0f }); 1060 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 2, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 39/255.f, 31/255.f, 144/255.f, 1.0f }); 1061 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 2, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 32/255.f, 25/255.f, 116/255.f, 1.0f }); 1062 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 2, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 21/255.f, 18/255.f, 82/255.f, 1.0f }); 1063 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 2, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 16/255.f, 13/255.f, 61/255.f, 1.0f }); 1064 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 2, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 228/255.f, 228/255.f, 228/255.f, 1.0f }); 1065 | } 1066 | //3 1067 | { 1068 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 3, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 194/255.f, 144/255.f, 251/255.f, 1.0f }); 1069 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 3, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 165/255.f, 87/255.f, 249/255.f, 1.0f }); 1070 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 3, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 142/255.f, 57/255.f, 239/255.f, 1.0f }); 1071 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 3, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 116/255.f, 45/255.f, 184/255.f, 1.0f }); 1072 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 3, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 92/255.f, 37/255.f, 154/255.f, 1.0f }); 1073 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 3, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 73/255.f, 29/255.f, 121/255.f, 1.0f }); 1074 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 3, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 53/255.f, 21/255.f, 88/255.f, 1.0f }); 1075 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 3, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 37/255.f, 15/255.f, 63/255.f, 1.0f }); 1076 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 3, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 203/255.f, 203/255.f, 203/255.f, 1.0f }); 1077 | } 1078 | //4 1079 | { 1080 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 4, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 224/255.f, 162/255.f, 197/255.f, 1.0f }); 1081 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 4, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 210/255.f, 112/255.f, 166/255.f, 1.0f }); 1082 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 4, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 199/255.f, 62/255.f, 135/255.f, 1.0f }); 1083 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 4, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 159/255.f, 49/255.f, 105/255.f, 1.0f }); 1084 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 4, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 132/255.f, 41/255.f, 89/255.f, 1.0f }); 1085 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 4, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 104/255.f, 32/255.f, 71/255.f, 1.0f }); 1086 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 4, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 75/255.f, 24/255.f, 51/255.f, 1.0f }); 1087 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 4, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 54/255.f, 14/255.f, 36/255.f, 1.0f }); 1088 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 4, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 175/255.f, 175/255.f, 175/255.f, 1.0f }); 1089 | } 1090 | //5 1091 | { 1092 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 5, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 235/255.f, 175/255.f, 176/255.f, 1.0f }); 1093 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 5, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 227/255.f, 133/255.f, 135/255.f, 1.0f }); 1094 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 5, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 219/255.f, 87/255.f, 88/255.f, 1.0f }); 1095 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 5, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 215/255.f, 50/255.f, 36/255.f, 1.0f }); 1096 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 5, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 187/255.f, 25/255.f, 7/255.f, 1.0f }); 1097 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 5, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 149/255.f, 20/255.f, 6/255.f, 1.0f }); 1098 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 5, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 107/255.f, 14/255.f, 4/255.f, 1.0f }); 1099 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 5, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 77/255.f, 9/255.f, 3/255.f, 1.0f }); 1100 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 5, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 144/255.f, 144/255.f, 144/255.f, 1.0f }); 1101 | } 1102 | //6 1103 | { 1104 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 6, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 241/255.f, 187/255.f, 171/255.f, 1.0f }); 1105 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 6, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 234/255.f, 151/255.f, 126/255.f, 1.0f }); 1106 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 6, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 229/255.f, 115/255.f, 76/255.f, 1.0f }); 1107 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 6, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 227/255.f, 82/255.f, 24/255.f, 1.0f }); 1108 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 6, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 190/255.f, 61/255.f, 15/255.f, 1.0f }); 1109 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 6, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 150/255.f, 48/255.f, 12/255.f, 1.0f }); 1110 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 6, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 107/255.f, 34/255.f, 8/255.f, 1.0f }); 1111 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 6, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 79/255.f, 25/255.f, 6/255.f, 1.0f }); 1112 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 6, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 113/255.f, 113/255.f, 113/255.f, 1.0f }); 1113 | } 1114 | //7 1115 | { 1116 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 7, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 245/255.f, 207/255.f, 169/255.f, 1.0f }); 1117 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 7, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 240/255.f, 183/255.f, 122/255.f, 1.0f }); 1118 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 7, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 236/255.f, 159/255.f, 74/255.f, 1.0f }); 1119 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 7, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 234/255.f, 146/255.f, 37/255.f, 1.0f }); 1120 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 7, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 193/255.f, 111/255.f, 28/255.f, 1.0f }); 1121 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 7, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 152/255.f, 89/255.f, 22/255.f, 1.0f }); 1122 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 7, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 110/255.f, 64/255.f, 16/255.f, 1.0f }); 1123 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 7, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 80/255.f, 47/255.f, 12/255.f, 1.0f }); 1124 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 7, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 82/255.f, 82/255.f, 82/255.f, 1.0f }); 1125 | } 1126 | //8 1127 | { 1128 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 8, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 247/255.f, 218/255.f, 170/255.f, 1.0f }); 1129 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 8, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 244/255.f, 200/255.f, 124/255.f, 1.0f }); 1130 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 8, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 241/255.f, 182/255.f, 77/255.f, 1.0f }); 1131 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 8, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 239/255.f, 174/255.f, 44/255.f, 1.0f }); 1132 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 8, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 196/255.f, 137/255.f, 34/255.f, 1.0f }); 1133 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 8, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 154/255.f, 108/255.f, 27/255.f, 1.0f }); 1134 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 8, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 111/255.f, 77/255.f, 19/255.f, 1.0f }); 1135 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 8, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 80/255.f, 56/255.f, 14/255.f, 1.0f }); 1136 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 8, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 54/255.f, 54/255.f, 54/255.f, 1.0f }); 1137 | } 1138 | //9 1139 | { 1140 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 9, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 254/255.f, 243/255.f, 187/255.f, 1.0f }); 1141 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 9, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 253/255.f, 237/255.f, 153/255.f, 1.0f }); 1142 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 9, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 253/255.f, 231/255.f, 117/255.f, 1.0f }); 1143 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 9, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 254/255.f, 232/255.f, 85/255.f, 1.0f }); 1144 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 9, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 242/255.f, 212/255.f, 53/255.f, 1.0f }); 1145 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 9, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 192/255.f, 169/255.f, 42/255.f, 1.0f }); 1146 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 9, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 138/255.f, 120/255.f, 30/255.f, 1.0f }); 1147 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 9, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 101/255.f, 87/255.f, 22/255.f, 1.0f }); 1148 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 9, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 29/255.f, 29/255.f, 29/255.f, 1.0f }); 1149 | } 1150 | //10 1151 | { 1152 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 10, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 247/255.f, 243/255.f, 185/255.f, 1.0f }); 1153 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 10, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 243/255.f, 239/255.f, 148/255.f, 1.0f }); 1154 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 10, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 239/255.f, 232/255.f, 111/255.f, 1.0f }); 1155 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 10, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 235/255.f, 229/255.f, 76/255.f, 1.0f }); 1156 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 10, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 208/255.f, 200/255.f, 55/255.f, 1.0f }); 1157 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 10, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 164/255.f, 157/255.f, 43/255.f, 1.0f }); 1158 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 10, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 118/255.f, 114/255.f, 31/255.f, 1.0f }); 1159 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 10, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 86/255.f, 82/255.f, 21/255.f, 1.0f }); 1160 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 10, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 9/255.f, 9/255.f, 9/255.f, 1.0f }); 1161 | } 1162 | //11 1163 | { 1164 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 11, pos.Y + pixelSize.Y * 0 }, pixelSize, color, FLinearColor{ 218/255.f, 232/255.f, 182/255.f, 1.0f }); 1165 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 11, pos.Y + pixelSize.Y * 1 }, pixelSize, color, FLinearColor{ 198/255.f, 221/255.f, 143/255.f, 1.0f }); 1166 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 11, pos.Y + pixelSize.Y * 2 }, pixelSize, color, FLinearColor{ 181/255.f, 210/255.f, 103/255.f, 1.0f }); 1167 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 11, pos.Y + pixelSize.Y * 3 }, pixelSize, color, FLinearColor{ 154/255.f, 186/255.f, 76/255.f, 1.0f }); 1168 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 11, pos.Y + pixelSize.Y * 4 }, pixelSize, color, FLinearColor{ 130/255.f, 155/255.f, 64/255.f, 1.0f }); 1169 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 11, pos.Y + pixelSize.Y * 5 }, pixelSize, color, FLinearColor{ 102/255.f, 121/255.f, 50/255.f, 1.0f }); 1170 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 11, pos.Y + pixelSize.Y * 6 }, pixelSize, color, FLinearColor{ 74/255.f, 88/255.f, 36/255.f, 1.0f }); 1171 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 11, pos.Y + pixelSize.Y * 7 }, pixelSize, color, FLinearColor{ 54/255.f, 64/255.f, 26/255.f, 1.0f }); 1172 | ColorPixel(FVector2D{ pos.X + pixelSize.X * 11, pos.Y + pixelSize.Y * 8 }, pixelSize, color, FLinearColor{ 0/255.f, 0/255.f, 0/255.f, 1.0f }); 1173 | } 1174 | 1175 | 1176 | 1177 | if (isHoveredPicker) 1178 | { 1179 | if (Input::IsMouseClicked(0, elements_count, false)) 1180 | { 1181 | 1182 | } 1183 | } 1184 | else 1185 | { 1186 | if (Input::IsMouseClicked(0, elements_count, false)) 1187 | { 1188 | active_picker = -1; 1189 | //hover_element = false; 1190 | } 1191 | } 1192 | } 1193 | else 1194 | { 1195 | //Bg 1196 | if (isHovered) 1197 | { 1198 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size, size, Colors::Checkbox_Hovered); 1199 | hover_element = true; 1200 | } 1201 | else 1202 | { 1203 | drawFilledRect(FVector2D{ pos.X, pos.Y }, size, size, Colors::Checkbox_Idle); 1204 | } 1205 | 1206 | //Color 1207 | drawFilledRect(FVector2D{ pos.X + 4, pos.Y + 4 }, size - 8, size - 8, *color); 1208 | 1209 | //Text 1210 | FVector2D textPos = FVector2D{ pos.X + size + 5.0f, pos.Y + size / 2 }; 1211 | TextLeft(name, textPos, FLinearColor{ 1.0f, 1.0f, 1.0f, 1.0f }, false); 1212 | 1213 | if (isHovered && Input::IsMouseClicked(0, elements_count, false)) 1214 | { 1215 | saved_color = *color; 1216 | active_picker = elements_count; 1217 | } 1218 | } 1219 | 1220 | 1221 | sameLine = false; 1222 | last_element_pos = pos; 1223 | //last_element_size = size; 1224 | if (first_element_pos.X == 0.0f) 1225 | first_element_pos = pos; 1226 | } 1227 | 1228 | 1229 | void Render() 1230 | { 1231 | for (int i = 0; i < 128; i++) 1232 | { 1233 | if (PostRenderer::drawlist[i].type != -1) 1234 | { 1235 | //Filled Rect 1236 | if (PostRenderer::drawlist[i].type == 1) 1237 | { 1238 | ZeroGUI::drawFilledRect(PostRenderer::drawlist[i].pos, PostRenderer::drawlist[i].size.X, PostRenderer::drawlist[i].size.Y, PostRenderer::drawlist[i].color); 1239 | } 1240 | //TextLeft 1241 | else if (PostRenderer::drawlist[i].type == 2) 1242 | { 1243 | ZeroGUI::TextLeft(PostRenderer::drawlist[i].name, PostRenderer::drawlist[i].pos, PostRenderer::drawlist[i].color, PostRenderer::drawlist[i].outline); 1244 | } 1245 | //TextCenter 1246 | else if (PostRenderer::drawlist[i].type == 3) 1247 | { 1248 | ZeroGUI::TextCenter(PostRenderer::drawlist[i].name, PostRenderer::drawlist[i].pos, PostRenderer::drawlist[i].color, PostRenderer::drawlist[i].outline); 1249 | } 1250 | //Draw_Line 1251 | else if (PostRenderer::drawlist[i].type == 4) 1252 | { 1253 | Draw_Line(PostRenderer::drawlist[i].from, PostRenderer::drawlist[i].to, PostRenderer::drawlist[i].thickness, PostRenderer::drawlist[i].color); 1254 | } 1255 | 1256 | PostRenderer::drawlist[i].type = -1; 1257 | } 1258 | } 1259 | } 1260 | } 1261 | -------------------------------------------------------------------------------- /source/ZeroInput.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace ZeroGUI 5 | { 6 | namespace Input 7 | { 8 | bool mouseDown[5]; 9 | bool mouseDownAlready[256]; 10 | 11 | bool keysDown[256]; 12 | bool keysDownAlready[256]; 13 | 14 | bool IsAnyMouseDown() 15 | { 16 | if (mouseDown[0]) return true; 17 | if (mouseDown[1]) return true; 18 | if (mouseDown[2]) return true; 19 | if (mouseDown[3]) return true; 20 | if (mouseDown[4]) return true; 21 | 22 | return false; 23 | } 24 | 25 | bool IsMouseClicked(int button, int element_id, bool repeat) 26 | { 27 | if (mouseDown[button]) 28 | { 29 | if (!mouseDownAlready[element_id]) 30 | { 31 | mouseDownAlready[element_id] = true; 32 | return true; 33 | } 34 | if (repeat) 35 | return true; 36 | } 37 | else 38 | { 39 | mouseDownAlready[element_id] = false; 40 | } 41 | return false; 42 | } 43 | bool IsKeyPressed(int key, bool repeat) 44 | { 45 | if (keysDown[key]) 46 | { 47 | if (!keysDownAlready[key]) 48 | { 49 | keysDownAlready[key] = true; 50 | return true; 51 | } 52 | if (repeat) 53 | return true; 54 | } 55 | else 56 | { 57 | keysDownAlready[key] = false; 58 | } 59 | return false; 60 | } 61 | 62 | void Handle() 63 | { 64 | if (GetAsyncKeyState(0x01)) 65 | mouseDown[0] = true; 66 | else 67 | mouseDown[0] = false; 68 | } 69 | } 70 | } 71 | --------------------------------------------------------------------------------