mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
added scrollbar to the voting menu
This commit is contained in:
parent
6a1766f8ce
commit
76bffb13a8
|
@ -271,33 +271,23 @@ static const char *format_command(const char *cmd)
|
||||||
|
|
||||||
void MENUS::render_servercontrol_server(RECT main_view)
|
void MENUS::render_servercontrol_server(RECT main_view)
|
||||||
{
|
{
|
||||||
// draw header
|
int num_options = 0;
|
||||||
RECT header, footer;
|
for(VOTING::VOTEOPTION *option = gameclient.voting->first; option; option = option->next)
|
||||||
ui_hsplit_t(&main_view, 20, &header, &main_view);
|
num_options++;
|
||||||
ui_draw_rect(&header, vec4(1,1,1,0.25f), CORNER_T, 5.0f);
|
|
||||||
ui_do_label(&header, "Options", 18.0f, 0);
|
|
||||||
|
|
||||||
// draw footers
|
static int votelist = 0;
|
||||||
ui_hsplit_b(&main_view, 20, &main_view, &footer);
|
|
||||||
ui_draw_rect(&footer, vec4(1,1,1,0.25f), CORNER_B, 5.0f);
|
|
||||||
ui_vsplit_l(&footer, 10.0f, 0, &footer);
|
|
||||||
|
|
||||||
// options
|
|
||||||
ui_draw_rect(&main_view, vec4(0,0,0,0.15f), 0, 0);
|
|
||||||
RECT list = main_view;
|
RECT list = main_view;
|
||||||
int i = 0;
|
ui_do_listbox_start(&votelist, &list, 24.0f, "Options", num_options, callvote_selectedoption);
|
||||||
|
|
||||||
for(VOTING::VOTEOPTION *option = gameclient.voting->first; option; option = option->next)
|
for(VOTING::VOTEOPTION *option = gameclient.voting->first; option; option = option->next)
|
||||||
{
|
{
|
||||||
RECT button;
|
LISTBOXITEM item = ui_do_listbox_nextitem(option);
|
||||||
ui_hsplit_t(&list, button_height, &button, &list);
|
|
||||||
|
|
||||||
if(ui_do_button(option, "", callvote_selectedoption == i, &button, ui_draw_list_row, 0))
|
if(item.visible)
|
||||||
callvote_selectedoption = i;
|
ui_do_label(&item.rect, format_command(option->command), 16.0f, -1);
|
||||||
|
|
||||||
ui_vmargin(&button, 5.0f, &button);
|
|
||||||
ui_do_label(&button, format_command(option->command), 18.0f, -1);
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callvote_selectedoption = ui_do_listbox_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MENUS::render_servercontrol_kick(RECT main_view)
|
void MENUS::render_servercontrol_kick(RECT main_view)
|
||||||
|
|
Loading…
Reference in a new issue