r3283 - in trunk/data/qcsrc/menu: item nexuiz
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Jan 26 07:21:35 EST 2008
Author: div0
Date: 2008-01-26 07:21:31 -0500 (Sat, 26 Jan 2008)
New Revision: 3283
Modified:
trunk/data/qcsrc/menu/item/inputbox.c
trunk/data/qcsrc/menu/item/listbox.c
trunk/data/qcsrc/menu/nexuiz/credits.c
Log:
change dragScrollTimer to be an absolute time instead of a counter that gets decreased by frametime; fixes drag scrolling speed issues with menu_slowmo
Modified: trunk/data/qcsrc/menu/item/inputbox.c
===================================================================
--- trunk/data/qcsrc/menu/item/inputbox.c 2008-01-26 12:16:36 UTC (rev 3282)
+++ trunk/data/qcsrc/menu/item/inputbox.c 2008-01-26 12:21:31 UTC (rev 3283)
@@ -61,7 +61,7 @@
float mousePressInputBox(entity me, vector pos)
{
- me.dragScrollTimer = 0;
+ me.dragScrollTimer = time;
me.pressed = 1;
return mouseDragInputBox(me, pos);
}
@@ -85,7 +85,7 @@
float keyDownInputBox(entity me, float key, float ascii, float shift)
{
me.lastChangeTime = time;
- me.dragScrollTimer = 0;
+ me.dragScrollTimer = time;
if(ascii >= 32 && ascii != 127)
{
me.enterText(me, chr(ascii));
@@ -149,14 +149,13 @@
cursorPosInWidths = draw_TextWidth(substring(me.text, 0, me.cursorPos), 0) * me.realFontSize_x;
totalSizeInWidths = draw_TextWidth(strcat(me.text, CURSOR), 0) * me.realFontSize_x;
- me.dragScrollTimer -= frametime;
- if(me.dragScrollTimer < 0)
+ if(me.dragScrollTimer < time)
{
float save;
save = me.scrollPos;
me.scrollPos = bound(cursorPosInWidths - (0.875 - me.keepspaceLeft - me.keepspaceRight), me.scrollPos, cursorPosInWidths - 0.125);
if(me.scrollPos != save)
- me.dragScrollTimer = 0.2;
+ me.dragScrollTimer = time + 0.2;
}
me.scrollPos = min(me.scrollPos, totalSizeInWidths - (1 - me.keepspaceRight - me.keepspaceLeft));
me.scrollPos = max(0, me.scrollPos);
Modified: trunk/data/qcsrc/menu/item/listbox.c
===================================================================
--- trunk/data/qcsrc/menu/item/listbox.c 2008-01-26 12:16:36 UTC (rev 3282)
+++ trunk/data/qcsrc/menu/item/listbox.c 2008-01-26 12:21:31 UTC (rev 3283)
@@ -54,7 +54,7 @@
}
float keyDownListBox(entity me, float key, float ascii, float shift)
{
- me.dragScrollTimer = 0;
+ me.dragScrollTimer = time;
if(key == K_MWHEELUP)
{
me.scrollPos = max(me.scrollPos - 0.5, 0);
@@ -129,7 +129,7 @@
if(pos_y >= 1) return 0;
me.dragScrollPos = pos;
me.updateControlTopBottom(me);
- me.dragScrollTimer = 0;
+ me.dragScrollTimer = time;
if(pos_x >= 1 - me.controlWidth)
{
// if hit, set me.pressed, otherwise scroll by one page
@@ -200,8 +200,7 @@
{
if(frametime) // only do this in draw frames
{
- me.dragScrollTimer -= frametime;
- if(me.dragScrollTimer < 0)
+ if(me.dragScrollTimer < time)
{
float save;
save = me.scrollPos;
@@ -210,7 +209,7 @@
// if selected item is above listbox, decrease scrollpos so it is in
me.scrollPos = min(me.scrollPos, me.selectedItem * me.itemHeight);
if(me.scrollPos != save)
- me.dragScrollTimer = 0.2;
+ me.dragScrollTimer = time + 0.2;
}
}
// if scroll pos is below end of list, fix it
Modified: trunk/data/qcsrc/menu/nexuiz/credits.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/credits.c 2008-01-26 12:16:36 UTC (rev 3282)
+++ trunk/data/qcsrc/menu/nexuiz/credits.c 2008-01-26 12:21:31 UTC (rev 3283)
@@ -83,7 +83,7 @@
float keyDownNexuizCreditsList(entity me, float scan, float ascii, float shift)
{
float i;
- me.dragScrollTimer = 0;
+ me.dragScrollTimer = time;
me.scrolling = 0;
if(scan == K_PGUP)
More information about the nexuiz-commits
mailing list