]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add hud_configure_grid ;). Gridsize can be set manually. Maybe make this default...
authorFruitieX <rasse@rasse-lappy.localdomain>
Sun, 16 May 2010 18:43:53 +0000 (21:43 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Sun, 16 May 2010 18:43:53 +0000 (21:43 +0300)
defaultXonotic.cfg
qcsrc/client/hud.qc

index ec4b1d4e80ec47b42c651232a68513bd0c05c4f7..b6c93ae0649fdf9934a95c23a991fbfb874ba343 100644 (file)
@@ -1339,6 +1339,9 @@ seta hud_progressbar_alpha "0.5" "alpha of progressbars"
 
 seta hud_configure_checkcollisions 1 "check for collisions against other panels when in hud configure mode"
 seta hud_configure_bg_minalpha 0.5 "minimum panel background alpha when in hud configure mode"
+seta hud_configure_grid 0 "snap to grid when moving/resizing panels"
+seta hud_configure_grid_x 10 "snap each X pixels"
+seta hud_configure_grid_y 10 "snap each Y pixels"
 
 seta hud_dock 1 "enable/disable a fullscreen background for the hud, useful for creating artificial docks"
 seta hud_dock_color "0 0.6 0.9" "dock color"
index e53c10e98cdd4eabdac56526d23bb68a7ab4c4d7..864e1017c21260e97ec5e0a1db209e14f238a2eb 100644 (file)
@@ -852,6 +852,12 @@ float HUD_Panel_SetSize(float id, vector mySize)
        //mySize_x = bound(0.025 * vid_conwidth, mySize_x, vid_conwidth);
        //mySize_y = bound(0.025 * vid_conheight, mySize_y, vid_conheight);
 
+       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");
+       }
+
        // TODO: is this needed?
        // this is to check if (and how) SetPos should be called
        if(mySize_x == oldSize_x && mySize_y == oldSize_y)
@@ -959,6 +965,12 @@ void HUD_Panel_SetPos(float id, vector pos, float didntresize)
        pos_x = bound(0, pos_x, vid_conwidth - mySize_x);
        pos_y = bound(0, pos_y, vid_conheight - mySize_y);
 
+       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");
+       }
+
        if (pos_x + 0.5 * mySize_x > 0.5 * vid_conwidth)
                pos_x = pos_x - vid_conwidth;
        if (pos_y + 0.5 * mySize_y > 0.5 * vid_conheight)