fixed so that the scrollwheel works in the server browser

This commit is contained in:
Magnus Auvinen 2007-12-18 20:19:35 +00:00
parent f3a60b6df9
commit e988e3c161

View file

@ -987,6 +987,18 @@ static void menu2_render_serverbrowser(RECT main_view)
ui2_hmargin(&scroll, 5.0f, &scroll); ui2_hmargin(&scroll, 5.0f, &scroll);
scrollvalue = ui2_do_scrollbar_v(&scrollbar, &scroll, scrollvalue); scrollvalue = ui2_do_scrollbar_v(&scrollbar, &scroll, scrollvalue);
int scrollnum = num_servers-num;
if(scrollnum > 0)
{
if(inp_key_presses(KEY_MOUSE_WHEEL_UP))
scrollvalue -= 1.0f/scrollnum;
if(inp_key_presses(KEY_MOUSE_WHEEL_DOWN))
scrollvalue += 1.0f/scrollnum;
if(scrollvalue < 0) scrollvalue = 0;
if(scrollvalue > 1) scrollvalue = 1;
}
int start = (int)((num_servers-num)*scrollvalue); int start = (int)((num_servers-num)*scrollvalue);
if(start < 0) if(start < 0)
start = 0; start = 0;