panel_pos_backup = highlightedPanel_initial_pos;
panel_size_backup = highlightedPanel_initial_size;
highlightedPanel_backup = highlightedPanel;
+ hud_configure_centerline_time = time + 1;
}
}
hud_configure_menu_open = 2;
localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
}
+
void HUD_Panel_Mouse()
{
if(autocvar__menu_alpha == 1)
// moving it, avoid the immediate "fix" of its position/size
// (often unwanted and hateful) by disabling collisions check
hud_configure_checkcollisions = false;
+
+ if (time - prevMouseClickedTime > 0.25) // avoid showing the center line immediately on mouse click
+ hud_configure_centerline_time = time + 0.5;
}
if(highlightedAction == 1)
}
void HUD_Configure_DrawGrid()
{
- float i;
+ int i;
if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
{
hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
vector s;
+ // vertical center line, wider than vertical grid lines so that it's more visible
+ // NOTE: depending on grid size the vertical center line may not overlap any vertical grid line
+ drawfill(eX * (0.5 * vid_conwidth - 1), vec2(3, vid_conheight), '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
// x-axis
s = vec2(1, vid_conheight);
for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
drawpic_tiled(pos + eX * (panel_size.x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, vec2(hlBorderSize, panel_size.y + 2 * myBorder - 2 * hlBorderSize), color, theAlpha, DRAWFLAG_NORMAL);
}
+void HUD_Panel_HlCenterLine(float myBorder)
+{
+ if (time > hud_configure_centerline_time)
+ return;
+ float panel_centerpos_x = (panel_pos.x + panel_size.x * 0.5);
+ float ofs = fabs(panel_centerpos_x / vid_conwidth - 0.5);
+ if (ofs < 0.02) // don't bother showing the center line if it's evident that the panel is not centered
+ {
+ float f = map_bound_ranges(ofs, 0.001, 0.01, 0, 1);
+ vector col = '1 0 0' * f + '0 1 0' * (1 - f); // from red (far) to green (close)
+ float theAlpha = 0.3 + 0.1 * sin(6 * time); // blink
+ theAlpha *= (1 - autocvar__menu_alpha) * bound(0, hud_configure_centerline_time - time, 0.5) * 2; // fade
+ vector pos = vec2(panel_centerpos_x - 1, panel_pos.y - myBorder);
+ drawfill(pos, vec2(3, panel_size.y + 2 * myBorder), col, theAlpha, DRAWFLAG_NORMAL);
+ }
+}
+
void HUD_Configure_PostDraw()
{
if(autocvar__hud_configure)
panel = highlightedPanel;
HUD_Panel_UpdatePosSize();
HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));
+ HUD_Panel_HlCenterLine(panel_bg_border * hlBorderSize);
}
}
}