Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
hud_config.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HUD_Write(s)
#define HUD_Write_Cvar(cvar)
#define HUD_Write_PanelCvar(cvar_suf)

Functions

void HUD_Configure_Frame ()
void HUD_Configure_PostDraw ()
void HUD_Panel_EnableMenu ()
void HUD_Panel_ExportCfg (string cfgname)
void HUD_Panel_FirstInDrawQ (float id)
float HUD_Panel_InputEvent (float bInputType, float nPrimary, float nSecondary)
void HUD_Panel_Mouse ()

Variables

bool autocvar__hud_configure
bool autocvar_hud_configure_checkcollisions
bool autocvar_hud_configure_grid
float autocvar_hud_configure_grid_alpha
bool autocvar_hud_configure_teamcolorforced
string autocvar_hud_configure_vertical_lines = "0.5"
float hud_configure_centerline_time
float hud_configure_checkcollisions
vector hud_configure_gridSize
float hud_configure_menu_open
float hud_configure_prev
vector hud_configure_realGridSize
int mouseClicked
int prevMouseClicked
vector prevMouseClickedPos
float prevMouseClickedTime
const int S_MOUSE1 = 1
const int S_MOUSE2 = 2
const int S_MOUSE3 = 4

Macro Definition Documentation

◆ HUD_Write

#define HUD_Write ( s)
Value:
fputs(fh, s)
void fputs(float fhandle, string s)

Definition at line 39 of file hud_config.qh.

Referenced by HUD_Panel_ExportCfg().

◆ HUD_Write_Cvar

◆ HUD_Write_PanelCvar

#define HUD_Write_PanelCvar ( cvar_suf)
Value:
str = strcat("hud_panel_", panel.panel_name, cvar_suf), HUD_Write_Cvar(str)
entity panel
Definition hud.qh:147
#define HUD_Write_Cvar(cvar)
Definition hud_config.qh:40

Definition at line 41 of file hud_config.qh.

Referenced by HUD_Panel_ExportCfg().

Function Documentation

◆ HUD_Configure_Frame()

void HUD_Configure_Frame ( )

Definition at line 1087 of file hud_config.qc.

1088{
1090 {
1091 if (isdemo() || intermission == 2 || scoreboard_active)
1092 {
1094 return;
1095 }
1096
1097 if (!hud_configure_prev)
1098 {
1099 hudShiftState = 0;
1100 for (int i = REGISTRY_COUNT(hud_panels) - 1; i >= 0; --i)
1101 REGISTRY_GET(hud_panels, panel_order[i]).update_time = time;
1102 }
1103
1104 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1106 {
1107 if (autocvar__menu_alpha == 0)
1110 }
1111
1113 }
1114 else if (hud_configure_prev)
1115 {
1119 }
1120}
float time
float intermission
int hudShiftState
Definition hud.qh:128
float autocvar__menu_alpha
Definition hud.qh:187
float hud_dynamic_shake_factor
Definition hud.qh:214
int panel_order[REGISTRY_MAX(hud_panels)]
Definition hud.qh:66
void HUD_Configure_DrawGrid()
float _menu_alpha_prev
void HUD_Configure_Exit_Force()
Definition hud_config.qc:86
float hud_configure_prev
Definition hud_config.qh:18
bool autocvar__hud_configure
Definition hud_config.qh:3
float hud_configure_menu_open
Definition hud_config.qh:22
float isdemo()
#define REGISTRY_COUNT(id)
Definition registry.qh:18
#define REGISTRY_GET(id, i)
Definition registry.qh:43
bool scoreboard_active
Definition scoreboard.qh:16

References _menu_alpha_prev, autocvar__hud_configure, autocvar__menu_alpha, HUD_Configure_DrawGrid(), HUD_Configure_Exit_Force(), hud_configure_menu_open, hud_configure_prev, hud_dynamic_shake_factor, hudShiftState, intermission, isdemo(), panel_order, REGISTRY_COUNT, REGISTRY_GET, scoreboard_active, and time.

Referenced by HUD_Main().

◆ HUD_Configure_PostDraw()

void HUD_Configure_PostDraw ( )

Definition at line 1160 of file hud_config.qc.

1161{
1163 {
1164 if (tab_panel)
1165 {
1166 panel = tab_panel;
1168 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', 0.2, DRAWFLAG_NORMAL);
1169 }
1170 if (highlightedPanel)
1171 {
1176 }
1177 }
1178}
#define drawfill(position, size, rgb, alpha, flag)
Definition draw.qh:36
const float DRAWFLAG_NORMAL
entity highlightedPanel
Definition hud.qh:107
vector panel_size
Definition hud.qh:163
#define HUD_Panel_UpdatePosSize()
Definition hud.qh:428
float panel_bg_border
Definition hud.qh:172
vector panel_pos
Definition hud.qh:162
void HUD_Panel_HlCenterLine(float myBorder)
void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
const float hlBorderSize
entity tab_panel

References autocvar__hud_configure, autocvar__menu_alpha, drawfill, DRAWFLAG_NORMAL, highlightedPanel, hlBorderSize, HUD_Panel_HlBorder(), HUD_Panel_HlCenterLine(), HUD_Panel_UpdatePosSize, panel, panel_bg_border, panel_pos, panel_size, and tab_panel.

Referenced by HUD_Main().

◆ HUD_Panel_EnableMenu()

void HUD_Panel_EnableMenu ( )

Definition at line 947 of file hud_config.qc.

948{
950 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
951}
void localcmd(string command,...)

References highlightedPanel, hud_configure_menu_open, and localcmd().

Referenced by HUD_Panel_InputEvent(), and HUD_Panel_Mouse().

◆ HUD_Panel_ExportCfg()

void HUD_Panel_ExportCfg ( string cfgname)

Definition at line 10 of file hud_config.qc.

11{
12 string filename = strcat("hud_", autocvar_hud_skin, "_", cfgname, ".cfg");
13 float fh = fopen(filename, FILE_WRITE);
14 if (fh >= 0)
15 {
16 HUD_Write("//title \n");
17 HUD_Write("//author \n");
18 HUD_Write("\n");
19 HUD_Write_Cvar("hud_skin");
20 HUD_Write_Cvar("hud_panel_bg");
21 HUD_Write_Cvar("hud_panel_bg_color");
22 HUD_Write_Cvar("hud_panel_bg_color_team");
23 HUD_Write_Cvar("hud_panel_bg_alpha");
24 HUD_Write_Cvar("hud_panel_bg_border");
25 HUD_Write_Cvar("hud_panel_bg_padding");
26 HUD_Write_Cvar("hud_panel_fg_alpha");
27 HUD_Write("\n");
28
29 HUD_Write_Cvar("hud_dock");
30 HUD_Write_Cvar("hud_dock_color");
31 HUD_Write_Cvar("hud_dock_color_team");
32 HUD_Write_Cvar("hud_dock_alpha");
33 HUD_Write("\n");
34
35 HUD_Write_Cvar("hud_progressbar_alpha");
36 HUD_Write_Cvar("hud_progressbar_strength_color");
37 HUD_Write_Cvar("hud_progressbar_superweapons_color");
38 HUD_Write_Cvar("hud_progressbar_shield_color");
39 HUD_Write_Cvar("hud_progressbar_health_color");
40 HUD_Write_Cvar("hud_progressbar_armor_color");
41 HUD_Write_Cvar("hud_progressbar_fuel_color");
42 HUD_Write_Cvar("hud_progressbar_oxygen_color");
43 HUD_Write_Cvar("hud_progressbar_nexball_color");
44 HUD_Write_Cvar("hud_progressbar_speed_color");
45 HUD_Write_Cvar("hud_progressbar_acceleration_color");
46 HUD_Write_Cvar("hud_progressbar_acceleration_neg_color");
47 HUD_Write_Cvar("hud_progressbar_vehicles_ammo1_color");
48 HUD_Write_Cvar("hud_progressbar_vehicles_ammo2_color");
49 HUD_Write("\n");
50
51 HUD_Write_Cvar("_hud_panelorder");
52 HUD_Write("\n");
53
54 HUD_Write_Cvar("hud_configure_grid");
55 HUD_Write_Cvar("hud_configure_grid_xsize");
56 HUD_Write_Cvar("hud_configure_grid_ysize");
57 HUD_Write("\n");
58
59 // common cvars for all panels
60 string str = "";
61 for (int i = 0; i < REGISTRY_COUNT(hud_panels); ++i)
62 {
63 panel = REGISTRY_GET(hud_panels, i);
64
65 HUD_Write_PanelCvar("_pos");
66 HUD_Write_PanelCvar("_size");
68 HUD_Write_PanelCvar("_bg_color");
69 HUD_Write_PanelCvar("_bg_color_team");
70 HUD_Write_PanelCvar("_bg_alpha");
71 HUD_Write_PanelCvar("_bg_border");
72 HUD_Write_PanelCvar("_bg_padding");
73 panel.panel_export(fh);
74 HUD_Write("\n");
75 }
76
77 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
78
79 LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)"), filename);
80 fclose(fh);
81 }
82 else
83 LOG_INFOF(_("^1Couldn't write to %s"), filename);
84}
const float FILE_WRITE
string autocvar_hud_skin
Definition hud.qh:203
#define HUD_Write_PanelCvar(cvar_suf)
Definition hud_config.qh:41
#define LOG_INFOF(...)
Definition log.qh:66
void fclose(float fhandle)
float fopen(string filename, float mode)

References autocvar_hud_skin, fclose(), FILE_WRITE, fopen(), HUD_Write, HUD_Write_Cvar, HUD_Write_PanelCvar, LOG_INFOF, panel, REGISTRY_COUNT, REGISTRY_GET, and strcat().

Referenced by LocalCommand_hud().

◆ HUD_Panel_FirstInDrawQ()

void HUD_Panel_FirstInDrawQ ( float id)

Definition at line 842 of file hud_config.qc.

843{
844 int i, place = -1;
845 // find out where in the array our current id is, save into place
846 for (i = 0; i < REGISTRY_COUNT(hud_panels); ++i)
847 if (panel_order[i] == id)
848 {
849 place = i;
850 break;
851 }
852
853 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
854 if (place == -1)
855 place = REGISTRY_COUNT(hud_panels) - 1;
856
857 // move all ids up by one step in the array until "place"
858 for (i = place; i > 0; --i)
859 panel_order[i] = panel_order[i - 1];
860 // now save the new top id
861 panel_order[0] = id;
862
863 // let's save them into the cvar by some strcat trickery
864 string s = "";
865 for (i = 0; i < REGISTRY_COUNT(hud_panels); ++i)
866 s = strcat(s, ftos(panel_order[i]), " ");
867
868 cvar_set("_hud_panelorder", s);
869 strcpy(hud_panelorder_prev, autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
870}
string autocvar__hud_panelorder
Definition hud.qh:189
string hud_panelorder_prev
Definition hud.qh:67
void cvar_set(string name, string value)
string ftos(float f)
#define strcpy(this, s)
Definition string.qh:52

References autocvar__hud_panelorder, cvar_set(), ftos(), hud_panelorder_prev, panel_order, REGISTRY_COUNT, strcat(), and strcpy.

Referenced by HUD_Panel_Highlight(), and HUD_Panel_InputEvent().

◆ HUD_Panel_InputEvent()

float HUD_Panel_InputEvent ( float bInputType,
float nPrimary,
float nSecondary )

Definition at line 532 of file hud_config.qc.

533{
535 return false;
536
537 if (bInputType == 3)
538 {
539 mousepos.x = nPrimary;
540 mousepos.y = nSecondary;
541 return true;
542 }
543
544 if (bInputType == 2)
545 return false;
546
547 // at this point bInputType can only be 0 or 1 (key pressed or released)
548 bool key_pressed = bInputType == 0;
549
550 // block any input while a menu dialog is fading
551 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
553 {
554 hudShiftState = 0;
555 mouseClicked = 0;
556 return true;
557 }
558
559 int hudShiftState_prev = hudShiftState;
560 int mouseClicked_prev = mouseClicked;
561 if (key_pressed)
562 {
563 if (nPrimary == K_ALT) hudShiftState |= S_ALT;
564 if (nPrimary == K_CTRL) hudShiftState |= S_CTRL;
565 if (nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
566 if (nPrimary == K_MOUSE1) mouseClicked |= S_MOUSE1;
567 if (nPrimary == K_MOUSE2) mouseClicked |= S_MOUSE2;
568 }
569 else
570 {
571 if (nPrimary == K_ALT) hudShiftState &= ~S_ALT;
572 if (nPrimary == K_CTRL) hudShiftState &= ~S_CTRL;
573 if (nPrimary == K_SHIFT) hudShiftState &= ~S_SHIFT;
574 if (nPrimary == K_MOUSE1) mouseClicked &= ~S_MOUSE1;
575 if (nPrimary == K_MOUSE2) mouseClicked &= ~S_MOUSE2;
576 }
577
578 if (nPrimary == K_CTRL)
579 {
580 if (!key_pressed) // ctrl has been released
581 {
582 if (tab_panel)
583 {
584 // switch to selected panel
588 }
589 tab_panel = NULL;
591 }
592 }
593
594 string s;
595 if (nPrimary == K_ESCAPE)
596 {
597 if (!key_pressed)
598 return true;
600 localcmd("menu_showhudexit\n");
601 }
602 else if (nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
603 {
604 if (!key_pressed)
605 return true;
608 }
609 else if (nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
610 {
611 if (!key_pressed || mouseClicked)
612 return true;
613
614 // FIXME minor bug: if a panel is highlighted, has the same pos_x and
615 // lays in the same level of another panel then the next consecutive
616 // CTRL TAB presses will reselect once more the highlighted panel
617
618 entity starting_panel;
619 entity old_tab_panel = tab_panel;
620 if (!tab_panel) // first press of TAB
621 {
623 {
626 }
627 else
628 panel_pos = '0 0 0';
629 starting_panel = highlightedPanel;
630 tab_panel_pos = panel_pos; // to compute level
631 }
632 else
633 {
634 if ((!tab_backward && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT))) // tab direction changed?
636 starting_panel = tab_panel;
637 }
639
640 float k, level = 0, start_posX;
641 vector candidate_pos = '0 0 0';
642 const float LEVELS_NUM = 4;
643 float level_height = vid_conheight / LEVELS_NUM;
644 LABEL(find_tab_panel)
645 level = floor(tab_panel_pos.y / level_height) * level_height; // starting level
646 candidate_pos.x = !tab_backward ? vid_conwidth : 0;
647 start_posX = tab_panel_pos.x;
648 tab_panel = NULL;
649 k = 0;
650 while (++k)
651 {
652 for (int i = 0; i < REGISTRY_COUNT(hud_panels); ++i)
653 {
654 panel = REGISTRY_GET(hud_panels, i);
655 if (!(panel.panel_configflags & PANEL_CONFIG_MAIN))
656 continue;
657 if (panel == tab_panels[i] || panel == starting_panel)
658 continue;
660 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
661 if ((!tab_backward && panel_pos.x >= start_posX && (panel_pos.x < candidate_pos.x || (panel_pos.x == candidate_pos.x && panel_pos.y <= candidate_pos.y)))
662 || (tab_backward && panel_pos.x <= start_posX && (panel_pos.x > candidate_pos.x || (panel_pos.x == candidate_pos.x && panel_pos.y >= candidate_pos.y))))
663 {
665 tab_panel_pos = candidate_pos = panel_pos;
666 }
667 }
668 if (tab_panel)
669 break;
670 if (k == LEVELS_NUM) // tab_panel not found
671 {
673 if (!old_tab_panel)
674 {
675 tab_panel = NULL;
676 return true;
677 }
678 starting_panel = old_tab_panel;
679 old_tab_panel = NULL;
680 goto find_tab_panel; // u must find tab_panel!
681 }
682 if (!tab_backward)
683 {
684 level = (level + level_height) % vid_conheight;
685 start_posX = 0;
686 candidate_pos.x = vid_conwidth;
687 }
688 else
689 {
690 level = (level - level_height) % vid_conheight;
691 start_posX = vid_conwidth;
692 candidate_pos.x = 0;
693 }
694 }
695
696 tab_panels[tab_panel.panel_id] = tab_panel;
697 }
698 else if (nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
699 {
700 if (!key_pressed || mouseClicked)
701 return true;
702
704 {
705 if (panel.panel_configflags & PANEL_CONFIG_CANBEOFF)
706 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
707 }
708 else
709 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
710 }
711 else if (nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
712 {
713 if (!key_pressed || mouseClicked)
714 return true;
715
717 {
721 }
722 }
723 else if (nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
724 {
725 if (!key_pressed || mouseClicked)
726 return true;
727
728 if (panel_size_copied == '0 0 0' || !highlightedPanel)
729 return true;
730
733
734 // reduce size if it'd go beyond screen boundaries
735 vector tmp_size = panel_size_copied;
737 tmp_size.x = vid_conwidth - panel_pos.x;
739 tmp_size.y = vid_conheight - panel_pos.y;
740
741 if (panel_size == tmp_size)
742 return true;
743
744 // backup first!
748
749 s = strcat(ftos_mindecimals(tmp_size.x/vid_conwidth), " ", ftos_mindecimals(tmp_size.y/vid_conheight));
750 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
751 }
752 else if (nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
753 {
754 if (!key_pressed || mouseClicked)
755 return true;
756 // restore previous values
758 {
760 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
762 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
764 }
765 }
766 else if (nPrimary == 's' && hudShiftState & S_CTRL) // save config
767 {
768 if (!key_pressed || mouseClicked)
769 return true;
770 localcmd("hud save myconfig\n");
771 }
772 else if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
773 {
774 if (!key_pressed)
775 {
777 return true;
778 }
779 else if (pressed_key_time == 0)
781
782 if (!mouseClicked)
783 HUD_Panel_Arrow_Action(nPrimary); // move or resize panel
784 }
785 else if (nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
786 {
787 if (bInputType == 1)
788 return true;
791 }
792 else if (nPrimary == K_PAUSE)
793 return false;
794 else if (hudShiftState_prev == hudShiftState && mouseClicked_prev == mouseClicked)
795 {
796 // allow console bind to work
797 string con_keys = findkeysforcommand("toggleconsole", 0);
798 int keys = tokenize(con_keys); // findkeysforcommand returns data for this
799 for (int i = 0; i < keys; ++i)
800 if (nPrimary == stof(argv(i)))
801 return false; // hit console bind
802 }
803
804 return true;
805}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define LABEL(id)
Definition compiler.qh:34
string autocvar_hud_dock
Definition hud.qh:192
float highlightedAction
Definition hud.qh:108
entity highlightedPanel_backup
Definition hud.qh:141
vector panel_pos_backup
Definition hud.qh:142
const int S_SHIFT
Definition hud.qh:129
const int S_ALT
Definition hud.qh:131
vector panel_size_copied
Definition hud.qh:145
vector panel_size_backup
Definition hud.qh:143
const int PANEL_CONFIG_CANBEOFF
Definition hud.qh:238
vector mousepos
Definition hud.qh:103
const int PANEL_CONFIG_MAIN
Definition hud.qh:237
const int S_CTRL
Definition hud.qh:130
void HUD_Panel_FirstInDrawQ(float id)
float tab_backward
void reset_tab_panels()
float pressed_key_time
vector tab_panel_pos
entity tab_panels[REGISTRY_MAX(hud_panels)]
void HUD_Panel_EnableMenu()
void HUD_Panel_Arrow_Action(float nPrimary)
const int S_MOUSE1
Definition hud_config.qh:10
int mouseClicked
Definition hud_config.qh:13
const int S_MOUSE2
Definition hud_config.qh:11
float K_SHIFT
Definition keycodes.qc:22
float K_UPARROW
Definition keycodes.qc:15
float K_BACKSPACE
Definition keycodes.qc:14
float K_DOWNARROW
Definition keycodes.qc:16
float K_MOUSE1
Definition keycodes.qc:129
float K_CTRL
Definition keycodes.qc:21
float K_RIGHTARROW
Definition keycodes.qc:18
float K_SPACE
Definition keycodes.qc:10
float K_ALT
Definition keycodes.qc:20
float K_ENTER
Definition keycodes.qc:8
float K_LEFTARROW
Definition keycodes.qc:17
float K_MOUSE2
Definition keycodes.qc:130
float K_KP_ENTER
Definition keycodes.qc:74
float K_TAB
Definition keycodes.qc:7
float K_ESCAPE
Definition keycodes.qc:9
float K_PAUSE
Definition keycodes.qc:78
noref float vid_conwidth
Definition draw.qh:8
noref float vid_conheight
Definition draw.qh:9
float stof(string val,...)
float floor(float f)
float tokenize(string s)
string argv(float n)
#define NULL
Definition post.qh:14
vector
Definition self.qh:92
ERASEABLE string ftos_mindecimals(float number)
Converts a number to a string with the minimum number of decimals It assumes that an extreme accuracy...
Definition string.qh:497

References argv(), autocvar__hud_configure, autocvar__menu_alpha, autocvar_hud_dock, cvar(), cvar_set(), entity(), floor(), ftos(), ftos_mindecimals(), highlightedAction, highlightedPanel, highlightedPanel_backup, HUD_Configure_Exit_Force(), hud_configure_menu_open, HUD_Panel_Arrow_Action(), HUD_Panel_EnableMenu(), HUD_Panel_FirstInDrawQ(), HUD_Panel_UpdatePosSize, hudShiftState, K_ALT, K_BACKSPACE, K_CTRL, K_DOWNARROW, K_ENTER, K_ESCAPE, K_KP_ENTER, K_LEFTARROW, K_MOUSE1, K_MOUSE2, K_PAUSE, K_RIGHTARROW, K_SHIFT, K_SPACE, K_TAB, K_UPARROW, LABEL, localcmd(), mouseClicked, mousepos, NULL, panel, PANEL_CONFIG_CANBEOFF, PANEL_CONFIG_MAIN, panel_pos, panel_pos_backup, panel_size, panel_size_backup, panel_size_copied, pressed_key_time, REGISTRY_COUNT, REGISTRY_GET, reset_tab_panels(), S_ALT, S_CTRL, S_MOUSE1, S_MOUSE2, S_SHIFT, stof(), strcat(), tab_backward, tab_panel, tab_panel_pos, tab_panels, time, tokenize(), vector, vid_conheight, and vid_conwidth.

Referenced by CSQC_InputEvent().

◆ HUD_Panel_Mouse()

void HUD_Panel_Mouse ( )

Definition at line 953 of file hud_config.qc.

954{
955 if (autocvar__menu_alpha == 1)
956 return;
957
958 if (mouseClicked)
959 {
960 if (prevMouseClicked == 0)
961 {
962 if (tab_panel)
963 {
964 // stop ctrl-tab selection
965 tab_panel = NULL;
967 }
968 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
969 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
971 {
974 }
975 // doubleclick check
977 {
978 mouseClicked = 0; // to prevent spam, I guess.
980 }
981 else
982 {
984 {
987 }
989 }
990 }
991 else
992 {
995 }
996
998 {
999 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', 0.1, DRAWFLAG_NORMAL);
1001 {
1003 // backup!
1007 }
1008 else
1009 // in case the clicked panel is inside another panel and we aren't
1010 // moving it, avoid the immediate "fix" of its position/size
1011 // (often unwanted and hateful) by disabling collisions check
1013
1014 if (time - prevMouseClickedTime > 0.25) // avoid showing the center line immediately on mouse click
1016 }
1017
1018 if (highlightedAction == 1)
1020 else if (highlightedAction == 2)
1021 {
1022 vector mySize = '0 0 0';
1023 if (resizeCorner == 1)
1024 {
1027 }
1028 else if (resizeCorner == 2)
1029 {
1032 }
1033 else if (resizeCorner == 3)
1034 {
1037 }
1038 else // resizeCorner == 4
1039 {
1042 }
1043 HUD_Panel_SetPosSize(mySize);
1044 }
1045 }
1046 else
1047 {
1048 if (prevMouseClicked)
1050 if (hud_configure_menu_open == 2)
1052 else
1054 if (cursor_type != CURSOR_NORMAL && !tab_panel) // mouse over a panel?
1055 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', 0.1, DRAWFLAG_NORMAL);
1056 }
1057}
vector panel_click_distance
Definition hud.qh:104
float resizeCorner
Definition hud.qh:106
vector panel_click_resizeorigin
Definition hud.qh:105
int HUD_Panel_Check_Mouse_Pos(bool allow_move)
vector highlightedPanel_initial_pos
void HUD_Panel_SetPosSize(vector mySize)
void HUD_Panel_Highlight(float allow_move)
vector highlightedPanel_initial_size
void HUD_Panel_SetPos(vector pos)
float prevMouseClickedTime
Definition hud_config.qh:15
float hud_configure_checkcollisions
Definition hud_config.qh:19
int prevMouseClicked
Definition hud_config.qh:14
bool autocvar_hud_configure_checkcollisions
Definition hud_config.qh:4
vector prevMouseClickedPos
Definition hud_config.qh:16
float hud_configure_centerline_time
Definition hud_config.qh:23
int cursor_type
Definition view.qh:113
const int CURSOR_NORMAL
Definition view.qh:114

References autocvar__menu_alpha, autocvar_hud_configure_checkcollisions, CURSOR_NORMAL, cursor_type, drawfill, DRAWFLAG_NORMAL, highlightedAction, highlightedPanel, highlightedPanel_backup, highlightedPanel_initial_pos, highlightedPanel_initial_size, hud_configure_centerline_time, hud_configure_checkcollisions, hud_configure_menu_open, HUD_Panel_Check_Mouse_Pos(), HUD_Panel_EnableMenu(), HUD_Panel_Highlight(), HUD_Panel_SetPos(), HUD_Panel_SetPosSize(), HUD_Panel_UpdatePosSize, hudShiftState, mouseClicked, mousepos, NULL, panel, panel_bg_border, panel_click_distance, panel_click_resizeorigin, panel_pos, panel_pos_backup, panel_size, panel_size_backup, prevMouseClicked, prevMouseClickedPos, prevMouseClickedTime, reset_tab_panels(), resizeCorner, S_CTRL, S_MOUSE1, tab_panel, time, and vector.

Referenced by HUD_Mouse().

Variable Documentation

◆ autocvar__hud_configure

◆ autocvar_hud_configure_checkcollisions

bool autocvar_hud_configure_checkcollisions

Definition at line 4 of file hud_config.qh.

Referenced by HUD_Panel_Arrow_Action(), and HUD_Panel_Mouse().

◆ autocvar_hud_configure_grid

bool autocvar_hud_configure_grid

◆ autocvar_hud_configure_grid_alpha

float autocvar_hud_configure_grid_alpha

Definition at line 6 of file hud_config.qh.

Referenced by HUD_Configure_DrawGrid().

◆ autocvar_hud_configure_teamcolorforced

bool autocvar_hud_configure_teamcolorforced

Definition at line 8 of file hud_config.qh.

Referenced by HUD_Main().

◆ autocvar_hud_configure_vertical_lines

string autocvar_hud_configure_vertical_lines = "0.5"

Definition at line 7 of file hud_config.qh.

Referenced by HUD_Configure_DrawGrid(), and HUD_Panel_HlCenterLine().

◆ hud_configure_centerline_time

float hud_configure_centerline_time

Definition at line 23 of file hud_config.qh.

Referenced by HUD_Panel_Arrow_Action(), HUD_Panel_HlCenterLine(), and HUD_Panel_Mouse().

◆ hud_configure_checkcollisions

float hud_configure_checkcollisions

◆ hud_configure_gridSize

vector hud_configure_gridSize

Definition at line 20 of file hud_config.qh.

Referenced by HUD_Configure_DrawGrid(), HUD_Panel_SetPos(), and HUD_Panel_SetPosSize().

◆ hud_configure_menu_open

◆ hud_configure_prev

float hud_configure_prev

◆ hud_configure_realGridSize

vector hud_configure_realGridSize

◆ mouseClicked

◆ prevMouseClicked

int prevMouseClicked

Definition at line 14 of file hud_config.qh.

Referenced by HUD_Mouse(), HUD_Panel_Mouse(), QuickMenu_Close(), and QuickMenu_Mouse().

◆ prevMouseClickedPos

vector prevMouseClickedPos

Definition at line 16 of file hud_config.qh.

Referenced by HUD_Panel_Mouse().

◆ prevMouseClickedTime

float prevMouseClickedTime

Definition at line 15 of file hud_config.qh.

Referenced by HUD_Panel_Mouse().

◆ S_MOUSE1

◆ S_MOUSE2

◆ S_MOUSE3

const int S_MOUSE3 = 4

Definition at line 12 of file hud_config.qh.