Xonotic
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)   fputs(fh, s)
 
#define HUD_Write_Cvar(cvar)   HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
 
#define HUD_Write_PanelCvar(cvar_suf)   str = strcat("hud_panel_", panel.panel_name, cvar_suf), HUD_Write_Cvar(str)
 

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
 
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)    fputs(fh, s)

Definition at line 37 of file hud_config.qh.

Referenced by HUD_Panel_ExportCfg().

◆ HUD_Write_Cvar

◆ HUD_Write_PanelCvar

#define HUD_Write_PanelCvar (   cvar_suf)    str = strcat("hud_panel_", panel.panel_name, cvar_suf), HUD_Write_Cvar(str)

Definition at line 39 of file hud_config.qh.

Referenced by HUD_Panel_ExportCfg().

Function Documentation

◆ HUD_Configure_Frame()

void HUD_Configure_Frame ( )

Definition at line 1063 of file hud_config.qc.

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().

1064 {
1065  int i;
1067  {
1068  if(isdemo() || intermission == 2 || scoreboard_active)
1069  {
1071  return;
1072  }
1073 
1074  if(!hud_configure_prev)
1075  {
1076  hudShiftState = 0;
1077  for(i = REGISTRY_COUNT(hud_panels) - 1; i >= 0; --i)
1078  REGISTRY_GET(hud_panels, panel_order[i]).update_time = time;
1079  }
1080 
1081  // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1083  {
1084  if(autocvar__menu_alpha == 0)
1087  }
1088 
1090  }
1091  else if(hud_configure_prev)
1092  {
1096  }
1097 }
bool autocvar__hud_configure
Definition: hud_config.qh:3
bool scoreboard_active
Definition: scoreboard.qh:9
#define REGISTRY_GET(id, i)
Definition: registry.qh:43
int panel_order[REGISTRY_MAX(hud_panels)]
Definition: hud.qh:65
float intermission
Definition: csprogsdefs.qc:148
float hud_dynamic_shake_factor
Definition: hud.qh:209
float _menu_alpha_prev
Definition: hud_config.qc:1062
#define REGISTRY_COUNT(id)
Definition: registry.qh:18
float autocvar__menu_alpha
Definition: hud.qh:184
int hudShiftState
Definition: hud.qh:126
void HUD_Configure_DrawGrid()
Definition: hud_config.qc:1041
void HUD_Configure_Exit_Force()
Definition: hud_config.qc:87
float hud_configure_prev
Definition: hud_config.qh:17
float hud_configure_menu_open
Definition: hud_config.qh:21
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HUD_Configure_PostDraw()

void HUD_Configure_PostDraw ( )

Definition at line 1113 of file hud_config.qc.

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

Referenced by HUD_Main().

1114 {
1116  {
1117  if(tab_panel)
1118  {
1119  panel = tab_panel;
1121  drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1122  }
1123  if(highlightedPanel)
1124  {
1128  }
1129  }
1130 }
float panel_bg_border
Definition: hud.qh:169
entity highlightedPanel
Definition: hud.qh:106
const float hlBorderSize
Definition: hud_config.qc:1099
bool autocvar__hud_configure
Definition: hud_config.qh:3
vector panel_size
Definition: hud.qh:160
void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
Definition: hud_config.qc:1102
#define HUD_Panel_UpdatePosSize()
Definition: hud.qh:417
float autocvar__menu_alpha
Definition: hud.qh:184
entity tab_panel
Definition: hud_config.qc:503
const float DRAWFLAG_NORMAL
Definition: csprogsdefs.qc:317
entity panel
Definition: hud.qh:144
vector panel_pos
Definition: hud.qh:159
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HUD_Panel_EnableMenu()

void HUD_Panel_EnableMenu ( )

Definition at line 941 of file hud_config.qc.

References highlightedPanel, hud_configure_menu_open, and localcmd.

Referenced by HUD_Panel_InputEvent(), and HUD_Panel_Mouse().

942 {
944  localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
945 }
entity highlightedPanel
Definition: hud.qh:106
float hud_configure_menu_open
Definition: hud_config.qh:21
+ Here is the caller graph for this function:

◆ HUD_Panel_ExportCfg()

void HUD_Panel_ExportCfg ( string  cfgname)

Definition at line 10 of file hud_config.qc.

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

Referenced by LocalCommand_hud().

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

◆ HUD_Panel_FirstInDrawQ()

void HUD_Panel_FirstInDrawQ ( float  id)

Definition at line 830 of file hud_config.qc.

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().

831 {
832  int i;
833  int place = -1;
834  // find out where in the array our current id is, save into place
835  for(i = 0; i < REGISTRY_COUNT(hud_panels); ++i)
836  {
837  if(panel_order[i] == id)
838  {
839  place = i;
840  break;
841  }
842  }
843  // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
844  if(place == -1)
845  place = REGISTRY_COUNT(hud_panels) - 1;
846 
847  // move all ids up by one step in the array until "place"
848  for(i = place; i > 0; --i)
849  {
850  panel_order[i] = panel_order[i-1];
851  }
852  // now save the new top id
853  panel_order[0] = id;
854 
855  // let's save them into the cvar by some strcat trickery
856  string s = "";
857  for(i = 0; i < REGISTRY_COUNT(hud_panels); ++i)
858  {
859  s = strcat(s, ftos(panel_order[i]), " ");
860  }
861  cvar_set("_hud_panelorder", s);
862  strcpy(hud_panelorder_prev, autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
863 }
int panel_order[REGISTRY_MAX(hud_panels)]
Definition: hud.qh:65
#define strcpy(this, s)
Definition: string.qh:49
#define REGISTRY_COUNT(id)
Definition: registry.qh:18
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
string hud_panelorder_prev
Definition: hud.qh:66
string autocvar__hud_panelorder
Definition: hud.qh:186
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HUD_Panel_InputEvent()

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

Definition at line 511 of file hud_config.qc.

References argv(), autocvar__hud_configure, autocvar__menu_alpha, autocvar_hud_dock, cvar(), cvar_set(), entity(), floor(), ftos(), 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().

512 {
513  string s;
514 
516  return false;
517 
518  if(bInputType == 3)
519  {
520  mousepos.x = nPrimary;
521  mousepos.y = nSecondary;
522  return true;
523  }
524 
525  if(bInputType == 2)
526  return false;
527 
528  // at this point bInputType can only be 0 or 1 (key pressed or released)
529  bool key_pressed = (bInputType == 0);
530 
531  // block any input while a menu dialog is fading
532  // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
534  {
535  hudShiftState = 0;
536  mouseClicked = 0;
537  return true;
538  }
539 
540  // allow console bind to work
541  string con_keys = findkeysforcommand("toggleconsole", 0);
542  int keys = tokenize(con_keys); // findkeysforcommand returns data for this
543 
544  bool hit_con_bind = false;
545  int i;
546  for (i = 0; i < keys; ++i)
547  {
548  if(nPrimary == stof(argv(i)))
549  hit_con_bind = true;
550  }
551 
552  if(key_pressed) {
553  if(nPrimary == K_ALT) hudShiftState |= S_ALT;
554  if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
555  if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
556  if(nPrimary == K_MOUSE1) mouseClicked |= S_MOUSE1;
557  if(nPrimary == K_MOUSE2) mouseClicked |= S_MOUSE2;
558  }
559  else {
560  if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
561  if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
562  if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
563  if(nPrimary == K_MOUSE1) mouseClicked -= (mouseClicked & S_MOUSE1);
564  if(nPrimary == K_MOUSE2) mouseClicked -= (mouseClicked & S_MOUSE2);
565  }
566 
567  if(nPrimary == K_CTRL)
568  {
569  if (!key_pressed) //ctrl has been released
570  {
571  if (tab_panel)
572  {
573  //switch to selected panel
575  highlightedAction = 0;
577  }
578  tab_panel = NULL;
580  }
581  }
582 
583  if(nPrimary == K_ESCAPE)
584  {
585  if (!key_pressed)
586  return true;
588  localcmd("menu_showhudexit\n");
589  }
590  else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
591  {
592  if (!key_pressed)
593  return true;
596  }
597  else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
598  {
599  if (!key_pressed || mouseClicked)
600  return true;
601 
602  // FIXME minor bug: if a panel is highlighted, has the same pos_x and
603  // lays in the same level of another panel then the next consecutive
604  // CTRL TAB presses will reselect once more the highlighted panel
605 
606  entity starting_panel;
607  entity old_tab_panel = tab_panel;
608  if (!tab_panel) //first press of TAB
609  {
610  if (highlightedPanel)
611  {
614  }
615  else
616  panel_pos = '0 0 0';
617  starting_panel = highlightedPanel;
618  tab_panel_pos = panel_pos; //to compute level
619  }
620  else
621  {
622  if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
624  starting_panel = tab_panel;
625  }
627 
628  float k, level = 0, start_posX;
629  vector candidate_pos = '0 0 0';
630  const float LEVELS_NUM = 4;
631  float level_height = vid_conheight / LEVELS_NUM;
632 LABEL(find_tab_panel)
633  level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
634  candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
635  start_posX = tab_panel_pos.x;
636  tab_panel = NULL;
637  k=0;
638  while(++k)
639  {
640  for(i = 0; i < REGISTRY_COUNT(hud_panels); ++i)
641  {
642  panel = REGISTRY_GET(hud_panels, i);
643  if(!(panel.panel_configflags & PANEL_CONFIG_MAIN))
644  continue;
645  if (panel == tab_panels[i] || panel == starting_panel)
646  continue;
648  if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
649  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)) )
650  || ( 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)) ) )
651  {
652  tab_panel = panel;
653  tab_panel_pos = candidate_pos = panel_pos;
654  }
655  }
656  if (tab_panel)
657  break;
658  if (k == LEVELS_NUM) //tab_panel not found
659  {
661  if (!old_tab_panel)
662  {
663  tab_panel = NULL;
664  return true;
665  }
666  starting_panel = old_tab_panel;
667  old_tab_panel = NULL;
668  goto find_tab_panel; //u must find tab_panel!
669  }
670  if (!tab_backward)
671  {
672  level = (level + level_height) % vid_conheight;
673  start_posX = 0;
674  candidate_pos.x = vid_conwidth;
675  }
676  else
677  {
678  level = (level - level_height) % vid_conheight;
679  start_posX = vid_conwidth;
680  candidate_pos.x = 0;
681  }
682  }
683 
684  tab_panels[tab_panel.panel_id] = tab_panel;
685  }
686  else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
687  {
688  if (!key_pressed || mouseClicked)
689  return true;
690 
691  if (highlightedPanel)
692  {
693  if(panel.panel_configflags & PANEL_CONFIG_CANBEOFF)
694  cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
695  }
696  else
697  cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
698  }
699  else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
700  {
701  if (!key_pressed || mouseClicked)
702  return true;
703 
704  if (highlightedPanel)
705  {
709  }
710  }
711  else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
712  {
713  if (!key_pressed || mouseClicked)
714  return true;
715 
716  if (panel_size_copied == '0 0 0' || !highlightedPanel)
717  return true;
718 
721 
722  // reduce size if it'd go beyond screen boundaries
723  vector tmp_size = panel_size_copied;
725  tmp_size.x = vid_conwidth - panel_pos.x;
727  tmp_size.y = vid_conheight - panel_pos.y;
728 
729  if (panel_size == tmp_size)
730  return true;
731 
732  // backup first!
736 
737  s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
738  cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
739  }
740  else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
741  {
742  if (!key_pressed || mouseClicked)
743  return true;
744  //restore previous values
746  {
748  cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
750  cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
752  }
753  }
754  else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
755  {
756  if (!key_pressed || mouseClicked)
757  return true;
758  localcmd("hud save myconfig\n");
759  }
760  else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
761  {
762  if (!key_pressed)
763  {
764  pressed_key_time = 0;
765  return true;
766  }
767  else if (pressed_key_time == 0)
769 
770  if (!mouseClicked)
771  HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
772  }
773  else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
774  {
775  if (bInputType == 1)
776  return true;
777  if (highlightedPanel)
779  }
780  else if(hit_con_bind || nPrimary == K_PAUSE)
781  return false;
782 
783  return true;
784 }
float vid_conheight
float K_UPARROW
Definition: keycodes.qc:15
const int PANEL_CONFIG_CANBEOFF
Definition: hud.qh:233
float K_ALT
Definition: keycodes.qc:20
float K_ESCAPE
Definition: keycodes.qc:9
entity highlightedPanel
Definition: hud.qh:106
float K_DOWNARROW
Definition: keycodes.qc:16
bool autocvar__hud_configure
Definition: hud_config.qh:3
const int S_SHIFT
Definition: hud.qh:127
vector panel_size
Definition: hud.qh:160
float tab_backward
Definition: hud_config.qc:505
entity() spawn
#define REGISTRY_GET(id, i)
Definition: registry.qh:43
float K_PAUSE
Definition: keycodes.qc:78
const int PANEL_CONFIG_MAIN
Definition: hud.qh:232
float K_TAB
Definition: keycodes.qc:7
#define HUD_Panel_UpdatePosSize()
Definition: hud.qh:417
float vid_conwidth
float K_SHIFT
Definition: keycodes.qc:22
void HUD_Panel_Arrow_Action(float nPrimary)
Definition: hud_config.qc:395
float K_SPACE
Definition: keycodes.qc:10
void HUD_Panel_EnableMenu()
Definition: hud_config.qc:941
float K_RIGHTARROW
Definition: keycodes.qc:18
float highlightedAction
Definition: hud.qh:107
const int S_ALT
Definition: hud.qh:129
float K_KP_ENTER
Definition: keycodes.qc:74
int mouseClicked
Definition: hud_config.qh:12
#define REGISTRY_COUNT(id)
Definition: registry.qh:18
float K_BACKSPACE
Definition: keycodes.qc:14
float autocvar__menu_alpha
Definition: hud.qh:184
int hudShiftState
Definition: hud.qh:126
vector panel_pos_backup
Definition: hud.qh:139
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
entity tab_panel
Definition: hud_config.qc:503
entity tab_panels[REGISTRY_MAX(hud_panels)]
Definition: hud_config.qc:502
float K_CTRL
Definition: keycodes.qc:21
float K_MOUSE2
Definition: keycodes.qc:130
#define NULL
Definition: post.qh:17
entity panel
Definition: hud.qh:144
vector panel_pos
Definition: hud.qh:159
string autocvar_hud_dock
Definition: hud.qh:189
vector tab_panel_pos
Definition: hud_config.qc:504
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float K_MOUSE1
Definition: keycodes.qc:129
float pressed_key_time
Definition: hud_config.qc:393
vector mousepos
Definition: hud.qh:102
void HUD_Configure_Exit_Force()
Definition: hud_config.qc:87
entity highlightedPanel_backup
Definition: hud.qh:138
#define LABEL(id)
Definition: compiler.qh:36
float K_LEFTARROW
Definition: keycodes.qc:17
const int S_MOUSE2
Definition: hud_config.qh:10
float hud_configure_menu_open
Definition: hud_config.qh:21
float K_ENTER
Definition: keycodes.qc:8
const int S_MOUSE1
Definition: hud_config.qh:9
void HUD_Panel_FirstInDrawQ(float id)
Definition: hud_config.qc:830
const int S_CTRL
Definition: hud.qh:128
float time
Definition: csprogsdefs.qc:16
vector panel_size_copied
Definition: hud.qh:142
void reset_tab_panels()
Definition: hud_config.qc:506
vector panel_size_backup
Definition: hud.qh:140
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HUD_Panel_Mouse()

void HUD_Panel_Mouse ( )

Definition at line 946 of file hud_config.qc.

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_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().

947 {
948  if(autocvar__menu_alpha == 1)
949  return;
950 
951  if(mouseClicked)
952  {
953  if(prevMouseClicked == 0)
954  {
955  if (tab_panel)
956  {
957  //stop ctrl-tab selection
958  tab_panel = NULL;
960  }
961  HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
962  // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
963  if (highlightedPanel)
964  {
967  }
968  // doubleclick check
970  {
971  mouseClicked = 0; // to prevent spam, I guess.
973  }
974  else
975  {
976  if (mouseClicked & S_MOUSE1)
977  {
980  }
982  }
983  }
984  else
985  {
988  }
989 
990  if (highlightedPanel)
991  {
992  drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
994  {
996  // backup!
1000  }
1001  else
1002  // in case the clicked panel is inside another panel and we aren't
1003  // moving it, avoid the immediate "fix" of its position/size
1004  // (often unwanted and hateful) by disabling collisions check
1006  }
1007 
1008  if(highlightedAction == 1)
1010  else if(highlightedAction == 2)
1011  {
1012  vector mySize = '0 0 0';
1013  if(resizeCorner == 1) {
1016  } else if(resizeCorner == 2) {
1019  } else if(resizeCorner == 3) {
1022  } else { // resizeCorner == 4
1025  }
1026  HUD_Panel_SetPosSize(mySize);
1027  }
1028  }
1029  else
1030  {
1031  if(prevMouseClicked)
1032  highlightedAction = 0;
1033  if(hud_configure_menu_open == 2)
1035  else
1037  if (cursor_type != CURSOR_NORMAL && !tab_panel) // mouse over a panel?
1038  drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1039  }
1040 }
float panel_bg_border
Definition: hud.qh:169
entity highlightedPanel
Definition: hud.qh:106
int prevMouseClicked
Definition: hud_config.qh:13
vector panel_size
Definition: hud.qh:160
float resizeCorner
Definition: hud.qh:105
float prevMouseClickedTime
Definition: hud_config.qh:14
vector highlightedPanel_initial_pos
Definition: hud_config.qc:394
#define HUD_Panel_UpdatePosSize()
Definition: hud.qh:417
void HUD_Panel_EnableMenu()
Definition: hud_config.qc:941
vector panel_click_resizeorigin
Definition: hud.qh:104
float highlightedAction
Definition: hud.qh:107
int mouseClicked
Definition: hud_config.qh:12
float autocvar__menu_alpha
Definition: hud.qh:184
int hudShiftState
Definition: hud.qh:126
void HUD_Panel_Highlight(float allow_move)
Definition: hud_config.qc:865
vector panel_pos_backup
Definition: hud.qh:139
bool autocvar_hud_configure_checkcollisions
Definition: hud_config.qh:4
entity tab_panel
Definition: hud_config.qc:503
vector highlightedPanel_initial_size
Definition: hud_config.qc:394
#define NULL
Definition: post.qh:17
const float DRAWFLAG_NORMAL
Definition: csprogsdefs.qc:317
entity panel
Definition: hud.qh:144
vector panel_pos
Definition: hud.qh:159
vector(float skel, float bonenum) _skel_get_boneabs_hidden
void HUD_Panel_SetPosSize(vector mySize)
Definition: hud_config.qc:303
vector panel_click_distance
Definition: hud.qh:103
vector prevMouseClickedPos
Definition: hud_config.qh:15
vector mousepos
Definition: hud.qh:102
const int CURSOR_NORMAL
Definition: view.qh:110
entity highlightedPanel_backup
Definition: hud.qh:138
float hud_configure_menu_open
Definition: hud_config.qh:21
const int S_MOUSE1
Definition: hud_config.qh:9
void HUD_Panel_SetPos(vector pos)
Definition: hud_config.qc:167
const int S_CTRL
Definition: hud.qh:128
float time
Definition: csprogsdefs.qc:16
int HUD_Panel_Check_Mouse_Pos(bool allow_move)
Definition: hud_config.qc:786
float hud_configure_checkcollisions
Definition: hud_config.qh:18
int cursor_type
Definition: view.qh:109
void reset_tab_panels()
Definition: hud_config.qc:506
vector panel_size_backup
Definition: hud.qh:140
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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 7 of file hud_config.qh.

Referenced by HUD_Main().

◆ hud_configure_checkcollisions

float hud_configure_checkcollisions

◆ hud_configure_gridSize

vector hud_configure_gridSize

Definition at line 19 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 13 of file hud_config.qh.

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

◆ prevMouseClickedPos

vector prevMouseClickedPos

Definition at line 15 of file hud_config.qh.

Referenced by HUD_Panel_Mouse().

◆ prevMouseClickedTime

float prevMouseClickedTime

Definition at line 14 of file hud_config.qh.

Referenced by HUD_Panel_Mouse().

◆ S_MOUSE1

◆ S_MOUSE2

◆ S_MOUSE3

const int S_MOUSE3 = 4

Definition at line 11 of file hud_config.qh.