]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
(crappy, placeholder) move/resize cursors! Also force border size to be 10 for the...
authorFruitieX <rasse@rasse-lappy.localdomain>
Tue, 29 Jun 2010 10:21:28 +0000 (13:21 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Tue, 29 Jun 2010 10:21:28 +0000 (13:21 +0300)
gfx/menu/wickedx/cursor_move.tga [new file with mode: 0644]
gfx/menu/wickedx/cursor_resize.tga [new file with mode: 0644]
gfx/menu/wickedx/cursor_resize2.tga [new file with mode: 0644]
qcsrc/client/hud.qc

diff --git a/gfx/menu/wickedx/cursor_move.tga b/gfx/menu/wickedx/cursor_move.tga
new file mode 100644 (file)
index 0000000..0264316
Binary files /dev/null and b/gfx/menu/wickedx/cursor_move.tga differ
diff --git a/gfx/menu/wickedx/cursor_resize.tga b/gfx/menu/wickedx/cursor_resize.tga
new file mode 100644 (file)
index 0000000..475e224
Binary files /dev/null and b/gfx/menu/wickedx/cursor_resize.tga differ
diff --git a/gfx/menu/wickedx/cursor_resize2.tga b/gfx/menu/wickedx/cursor_resize2.tga
new file mode 100644 (file)
index 0000000..6c97fb8
Binary files /dev/null and b/gfx/menu/wickedx/cursor_resize2.tga differ
index 737f67face475b47a34a1884755248bbafc5a72b..7071f83c23b24ee8ba8ce5a94963b37c4a26296b 100644 (file)
@@ -1285,6 +1285,47 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        return true; // Suppress ALL other input
 }
 
+float HUD_Panel_HighlightCheck()
+{
+       float i, border;
+       vector panelPos;
+       vector panelSize;
+
+       for(i = 0; i < HUD_PANEL_NUM; ++i)
+       {
+               panelPos = HUD_Panel_GetPos(i);
+               panelSize = HUD_Panel_GetSize(i);
+               border = 10; // FORCED border so a small border size doesn't mean you can't resize
+
+               // move
+               if(mousepos_x >= panelPos_x && mousepos_y >= panelPos_y && mousepos_x <= panelPos_x + panelSize_x && mousepos_y <= panelPos_y + panelSize_y)
+               {
+                       return 1;
+               }
+               // resize from topleft border
+               else if(mousepos_x >= panelPos_x - border && mousepos_y >= panelPos_y - border && mousepos_x <= panelPos_x + 0.5 * panelSize_x && mousepos_y <= panelPos_y + 0.5 * panelSize_y)
+               {
+                       return 2;
+               }
+               // resize from topright border
+               else if(mousepos_x >= panelPos_x + 0.5 * panelSize_x && mousepos_y >= panelPos_y - border && mousepos_x <= panelPos_x + panelSize_x + border && mousepos_y <= panelPos_y + 0.5 * panelSize_y)
+               {
+                       return 3;
+               }
+               // resize from bottomleft border
+               else if(mousepos_x >= panelPos_x - border && mousepos_y >= panelPos_y + 0.5 * panelSize_y && mousepos_x <= panelPos_x + 0.5 * panelSize_x && mousepos_y <= panelPos_y + panelSize_y + border)
+               {
+                       return 3;
+               }
+               // resize from bottomright border
+               else if(mousepos_x >= panelPos_x + 0.5 * panelSize_x && mousepos_y >= panelPos_y + 0.5 * panelSize_y && mousepos_x <= panelPos_x + panelSize_x + border && mousepos_y <= panelPos_y + panelSize_y + border)
+               {
+                       return 2;
+               }
+       }
+       return 0;
+}
+
 void HUD_Panel_Highlight()
 {
        float i, border;
@@ -1295,7 +1336,7 @@ void HUD_Panel_Highlight()
        {
                panelPos = HUD_Panel_GetPos(i);
                panelSize = HUD_Panel_GetSize(i);
-               border = HUD_Panel_GetBorder(i);
+               border = 10; // FORCED border so a small border size doesn't mean you can't resize
 
                // move
                if(mousepos_x >= panelPos_x && mousepos_y >= panelPos_y && mousepos_x <= panelPos_x + panelSize_x && mousepos_y <= panelPos_y + panelSize_y)
@@ -1350,6 +1391,7 @@ void HUD_Panel_Highlight()
        }
 }
 
+float highlightcheck;
 void HUD_Panel_Mouse()
 {
        // TODO: needs better check... is there any float that contains the current state of the menu? _menu_alpha isn't apparently updated the frame the menu gets enabled
@@ -1375,8 +1417,6 @@ void HUD_Panel_Mouse()
        mousepos_x = bound(0, mousepos_x, vid_conwidth);
        mousepos_y = bound(0, mousepos_y, vid_conheight);
 
-       drawpic(mousepos, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor.tga"), '32 32 0', '1 1 1', 1, DRAWFLAG_NORMAL);
-
        if(mouseClicked)
        {
                if(prevMouseClicked == 0)
@@ -1421,6 +1461,24 @@ void HUD_Panel_Mouse()
                        prevMouseClickedPos = mousepos;
                }
        }
+       else
+       {
+               highlightcheck = HUD_Panel_HighlightCheck();
+       }
+       // draw cursor after performing move/resize to have the panel pos/size updated before highlightcheck
+       string cursor;
+       vector cursorsize;
+       cursorsize = '32 32 0';
+
+       if(highlightcheck == 0)
+               drawpic(mousepos, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor.tga"), '32 32 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+       else if(highlightcheck == 1)
+               drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor_move.tga"), '32 32 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+       else if(highlightcheck == 2)
+               drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor_resize.tga"), '32 32 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+       else
+               drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", cvar_string("menu_skin"), "/cursor_resize2.tga"), '32 32 0', '1 1 1', 1, DRAWFLAG_NORMAL);
+
        prevMouseClicked = mouseClicked;
 }