seta hud_configure_checkcollisions 1 "check for collisions against other panels when in hud configure mode"
seta hud_configure_bg_minalpha 0.25 "minimum panel background alpha when in hud configure mode"
seta hud_configure_grid 1 "snap to grid when moving/resizing panels"
-seta hud_configure_grid_x 5 "snap each X pixels"
-seta hud_configure_grid_y 5 "snap each Y pixels"
+seta hud_configure_grid_x 0.01 "snap to X * vid_conwidth"
+seta hud_configure_grid_y 0.01 "snap to Y * vid_conheight"
seta hud_configure_grid_alpha 0.15 "alpha for visible grid when in configure mode"
seta sbar_info_pos 0 "Y-axis distance from lower right corner for engine info prints"
if(cvar("hud_configure_grid"))
{
- pos_x = floor(pos_x/cvar("hud_configure_grid_x") + 0.5) * cvar("hud_configure_grid_x");
- pos_y = floor(pos_y/cvar("hud_configure_grid_y") + 0.5) * cvar("hud_configure_grid_y");
+ pos_x = floor((pos_x/vid_conwidth)/bound(0.005, cvar("hud_configure_grid_x"), 0.2) + 0.5) * cvar("hud_configure_grid_x") * vid_conwidth;
+ pos_y = floor((pos_y/vid_conheight)/bound(0.005, cvar("hud_configure_grid_y"), 0.2) + 0.5) * cvar("hud_configure_grid_y") * vid_conheight;
}
string s;
// before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
if(cvar("hud_configure_grid"))
{
- mySize_x = floor(mySize_x/cvar("hud_configure_grid_x") + 0.5) * cvar("hud_configure_grid_x");
- mySize_y = floor(mySize_y/cvar("hud_configure_grid_y") + 0.5) * cvar("hud_configure_grid_y");
+ mySize_x = floor((mySize_x/vid_conwidth)/bound(0.005, cvar("hud_configure_grid_x"), 0.2) + 0.5) * cvar("hud_configure_grid_x") * vid_conwidth;
+ mySize_y = floor((mySize_y/vid_conheight)/bound(0.005, cvar("hud_configure_grid_y"), 0.2) + 0.5) * cvar("hud_configure_grid_y") * vid_conheight;
}
if (fixedRatio > 0)
{
float i;
// x-axis
- for(i = 0; i < vid_conwidth/max(2, cvar("hud_configure_grid_x")); ++i)
+ for(i = 0; i < 1/bound(0.005, bound(0.005, cvar("hud_configure_grid_x"), 0.2), 0.2); ++i)
{
- drawfill(eX * i * max(2, cvar("hud_configure_grid_x")), eX + eY * vid_conheight, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL);
+ drawfill(eX * i * vid_conwidth * bound(0.005, bound(0.005, cvar("hud_configure_grid_x"), 0.2), 0.2), eX + eY * vid_conheight, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL);
}
// y-axis
- for(i = 0; i < vid_conheight/max(2, cvar("hud_configure_grid_y")); ++i)
+ for(i = 0; i < 1/bound(0.005, bound(0.005, cvar("hud_configure_grid_y"), 0.2), 0.2); ++i)
{
- drawfill(eY * i * max(2, cvar("hud_configure_grid_y")), eY + eX * vid_conwidth, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL);
+ drawfill(eY * i * vid_conheight * bound(0.005, bound(0.005, cvar("hud_configure_grid_y"), 0.2), 0.2), eY + eX * vid_conwidth, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL);
}
}