diff options
Diffstat (limited to 'src/gui.cpp')
| -rw-r--r-- | src/gui.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/gui.cpp b/src/gui.cpp index 7baf383..132068e 100644 --- a/src/gui.cpp +++ b/src/gui.cpp | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | // gui.cpp — custom immediate-mode GUI | 1 | // gui.cpp — custom immediate-mode GUI |
| 2 | // | 2 | // |
| 3 | // Categories, feature cards and controls are wired to the real settings in | 3 | // Categories, feature cards and controls are wired to the real settings in |
| 4 | // menu.cpp. The old text tree is still reachable on F1 until the GUI has been | 4 | // menu.cpp. This is the only menu; Insert toggles it. |
| 5 | // verified as a full replacement. | ||
| 6 | 5 | ||
| 7 | #include "hl2h.h" | 6 | #include "hl2h.h" |
| 8 | 7 | ||
| @@ -653,7 +652,6 @@ static void open_gui() { | |||
| 653 | g_scroll = 0.0f; | 652 | g_scroll = 0.0f; |
| 654 | if (g_cat < 0 || g_cat >= CAT_COUNT) | 653 | if (g_cat < 0 || g_cat >= CAT_COUNT) |
| 655 | g_cat = 0; | 654 | g_cat = 0; |
| 656 | menu_force_close(); | ||
| 657 | logf("gui: opened"); | 655 | logf("gui: opened"); |
| 658 | } | 656 | } |
| 659 | 657 | ||
| @@ -707,8 +705,6 @@ static void handle_capture(const unsigned char *keys) { | |||
| 707 | continue; | 705 | continue; |
| 708 | if (k == 73) // Insert is reserved for opening/closing the GUI | 706 | if (k == 73) // Insert is reserved for opening/closing the GUI |
| 709 | continue; | 707 | continue; |
| 710 | if (k == 58) // F1 opens the old text tree during the verification pass | ||
| 711 | continue; | ||
| 712 | if (card.feat) | 708 | if (card.feat) |
| 713 | card.feat->bind = k; | 709 | card.feat->bind = k; |
| 714 | g_capture_card = -1; | 710 | g_capture_card = -1; |
| @@ -1271,12 +1267,19 @@ void gui_draw() { | |||
| 1271 | Rect foot{win.x, win.y + win.h - S(30.0f), win.w, S(30.0f)}; | 1267 | Rect foot{win.x, win.y + win.h - S(30.0f), win.w, S(30.0f)}; |
| 1272 | fill(foot, Col{24, 27, 33, 255}); | 1268 | fill(foot, Col{24, 27, 33, 255}); |
| 1273 | line(foot.x, foot.y, foot.x + foot.w, foot.y, C_BORDER); | 1269 | line(foot.x, foot.y, foot.x + foot.w, foot.y, C_BORDER); |
| 1274 | text_in(foot, foot.x + S(12.0f), foot.y + S(6.0f), | 1270 | const char *hint = |
| 1275 | "config: ~/.config/hl2hake/config", g_font_body, g_body_h, | 1271 | g_capture_card >= 0 ? "press a key / Esc" : "INS close"; |
| 1276 | foot.w - S(220.0f), C_DIM); | 1272 | int hint_w = text_w(hint, g_body_h); |
| 1277 | text_in(foot, foot.x + foot.w - S(200.0f), foot.y + S(6.0f), | 1273 | int hint_x = foot.x + foot.w - hint_w - S(12.0f); |
| 1278 | g_capture_card >= 0 ? "press a key / Esc" : "INS close | F1 old menu", | 1274 | int left_x = foot.x + S(12.0f); |
| 1279 | g_font_body, g_body_h, S(190.0f), C_DIM); | 1275 | if (hint_x < left_x) |
| 1276 | hint_x = left_x; | ||
| 1277 | int left_max = hint_x - left_x - S(12.0f); | ||
| 1278 | if (left_max > 0) | ||
| 1279 | text_in(foot, left_x, foot.y + S(6.0f), g_config_label, g_font_body, | ||
| 1280 | g_body_h, left_max, C_DIM); | ||
| 1281 | text_in(foot, hint_x, foot.y + S(6.0f), hint, g_font_body, g_body_h, | ||
| 1282 | hint_w + S(4.0f), C_DIM); | ||
| 1280 | 1283 | ||
| 1281 | draw_tooltip(); | 1284 | draw_tooltip(); |
| 1282 | } | 1285 | } |
