diff --git a/src/engine/client/ui.cpp b/src/engine/client/ui.cpp index 0f42e4357..85ebeaf73 100644 --- a/src/engine/client/ui.cpp +++ b/src/engine/client/ui.cpp @@ -80,7 +80,7 @@ void ui_do_label(float x, float y, char *text) { gfx_blend_normal(); gfx_texture_set(current_font->font_texture); - gfx_pretty_text(x, y, 18.f, text); + gfx_pretty_text(x, y, 36.f, text); } int ui_do_button(void *id, const char *text, int checked, float x, float y, float w, float h, draw_button_callback draw_func, void *extra) diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp index 4db4b714c..27ae06910 100644 --- a/src/game/client/menu.cpp +++ b/src/game/client/menu.cpp @@ -1,5 +1,7 @@ #include #include +#include + #include #include #include @@ -30,37 +32,86 @@ enum gui_tileset_enum enum gui_parts_enum { invalid_part = 0, - button_big_begin, - button_big_mid, - button_big_end, - slider_big_arrow_left, - slider_big_horiz_begin, - slider_big_horiz_mid, - slider_big_horiz_end, - slider_big_arrow_up, - slider_big_vert_begin, - slider_big_handle_horiz, - slider_small_handle_horiz, - slider_small_handle_vert, - slider_big_handle_vert, - slider_huge_handle_vert, - radio_unchecked, - radio_checked, - slider_small_vert_end, - slider_small_vert_mid, - slider_small_vert_begin, - slider_small_horiz_end, - slider_small_arrow_right, - slider_small_arrow_up, - slider_small_arrow_down, - slider_small_arrow_left, - slider_small_horiz_mid, - slider_small_horiz_begin, - slider_huge_handle_horiz, - slider_big_vert_mid, - slider_big_vert_end, - slider_big_arrow_down, - slider_big_arrow_right, + button_big_topleft, + button_big_topmid, + button_big_topright, + button_big_midleft, + button_big_midmid, + button_big_midright, + button_big_btmleft, + button_big_btmmid, + button_big_btmright, + slider_big_horiz_begin, + slider_big_horiz_mid, + slider_big_horiz_end, + slider_small_horiz_begin, + slider_small_horiz_mid, + slider_small_horiz_end, + slider_small_vert_begin, + radio_unchecked, + radio_checked, + slider_small_vert_mid, + slider_small_vert_end, + slider_big_vert_begin, + slider_big_handle_vert, + slider_big_handle_horiz, + slider_small_handle_horiz, + slider_big_arrow_left, + slider_big_arrow_up, + slider_big_arrow_right, + slider_big_arrow_down, + slider_small_arrow_left, + slider_small_arrow_up, + slider_small_arrow_right, + slider_small_arrow_down, + slider_small_handle_vert, + slider_big_vert_mid, + slider_big_vert_end, + screen_thick_topleft, + screen_thick_topmid, + screen_thick_topright, + screen_thick_midleft, + screen_thick_midmid, + screen_thick_midright, + screen_thick_btmleft, + screen_thick_btmmid, + screen_thick_btmright, + screen_transparent_topleft, + screen_transparent_topmid, + screen_transparent_topright, + screen_transparent_midleft, + screen_transparent_midmid, + screen_transparent_midright, + screen_transparent_btmleft, + screen_transparent_btmmid, + screen_transparent_btmright, + screen_info_topleft, + screen_info_topmid, + screen_info_topright, + screen_info_midleft, + screen_info_midmid, + screen_info_midright, + screen_info_btmleft, + screen_info_btmmid, + screen_info_btmright, + screen_textbox_topleft, + screen_textbox_topmid, + screen_textbox_topright, + screen_textbox_midleft, + screen_textbox_midmid, + screen_textbox_midright, + screen_textbox_btmleft, + screen_textbox_btmmid, + screen_textbox_btmright, + screen_list_topleft, + screen_list_topmid, + screen_list_topright, + screen_list_midleft, + screen_list_midmid, + screen_list_midright, + screen_list_btmleft, + screen_list_btmmid, + screen_list_btmright }; struct gui_part @@ -73,48 +124,124 @@ struct gui_part gui_part parts[] = { { 0, 0, 0, 0 }, // invalid_part - { 0, 0, 16, 48 }, // button_big_begin - { 16, 0, 16, 48 }, // button_big_mid - { 32, 0, 16, 48 }, // button_big_end - { 0, 64, 16, 16 }, // slider_big_arrow_left - { 0, 48, 16, 16 }, // slider_big_horiz_begin - { 16, 48, 16, 16 }, // slider_big_horiz_mid - { 32, 48, 16, 16 }, // slider_big_horiz_end - { 16, 64, 16, 16 }, // slider_big_arrow_up - { 48, 48, 16, 16 }, // slider_big_vert_begin - { 64, 48, 16, 32 }, // slider_big_handle_horiz - { 80, 48, 16, 16 }, // slider_small_handle_horiz - { 96, 48, 16, 16 }, // slider_small_handle_vert - { 80, 64, 32, 16 }, // slider_big_handle_vert - { 64, 80, 48, 32 }, // slider_huge_handle_vert - { 64, 112, 32, 32 }, // radio_unchecked - { 96, 112, 32, 32 }, // radio_checked - { 48, 128, 16, 16 }, // slider_small_vert_end - { 48, 112, 16, 16 }, // slider_small_vert_mid - { 48, 96, 16, 16 }, // slider_small_vert_begin - { 32, 96, 16, 16 }, // slider_small_horiz_end - { 32, 112, 16, 16 }, // slider_small_arrow_right - { 16, 112, 16, 16 }, // slider_small_arrow_up - { 16, 128, 16, 16 }, // slider_small_arrow_down - { 0, 112, 16, 16 }, // slider_small_arrow_left - { 17, 96, 16, 16 }, // slider_small_horiz_mid - { 0, 96, 16, 16 }, // slider_small_horiz_begin - { 112, 64, 32, 48 }, // slider_huge_handle_horiz - { 48, 64, 16, 16 }, // slider_big_vert_mid - { 48, 80, 16, 16 }, // slider_big_vert_end - { 16, 80, 16, 16 }, // slider_big_arrow_down - { 32, 64, 16, 16 } // slider_big_arrow_right +{ 0, 0, 16, 16 }, // button_big_topleft +{ 16, 0, 16, 16 }, // button_big_topmid +{ 32, 0, 16, 16 }, // button_big_topright +{ 0, 16, 16, 16 }, // button_big_midleft +{ 16, 16, 16, 16 }, // button_big_midmid +{ 32, 16, 16, 16 }, // button_big_midright +{ 0, 32, 16, 16 }, // button_big_btmleft +{ 16, 32, 16, 16 }, // button_big_btmmid +{ 32, 32, 16, 16 }, // button_big_btmright +{ 0, 48, 16, 16 }, // slider_big_horiz_begin +{ 16, 48, 16, 16 }, // slider_big_horiz_mid +{ 32, 48, 16, 16 }, // slider_big_horiz_end +{ 0, 96, 16, 16 }, // slider_small_horiz_begin +{ 16, 96, 16, 16 }, // slider_small_horiz_mid +{ 32, 96, 16, 16 }, // slider_small_horiz_end +{ 48, 96, 16, 16 }, // slider_small_vert_begin +{ 64, 112, 32, 32 }, // radio_unchecked +{ 96, 112, 32, 32 }, // radio_checked +{ 48, 112, 16, 16 }, // slider_small_vert_mid +{ 48, 128, 16, 16 }, // slider_small_vert_end +{ 48, 48, 16, 16 }, // slider_big_vert_begin +{ 64, 48, 16, 32 }, // slider_big_handle_vert +{ 80, 64, 32, 16 }, // slider_big_handle_horiz +{ 80, 48, 16, 16 }, // slider_small_handle_horiz +{ 0, 64, 16, 16 }, // slider_big_arrow_left +{ 16, 64, 16, 16 }, // slider_big_arrow_up +{ 32, 64, 16, 16 }, // slider_big_arrow_right +{ 16, 80, 16, 16 }, // slider_big_arrow_down +{ 0, 112, 16, 16 }, // slider_small_arrow_left +{ 16, 112, 16, 16 }, // slider_small_arrow_up +{ 32, 112, 16, 16 }, // slider_small_arrow_right +{ 16, 128, 16, 16 }, // slider_small_arrow_down +{ 96, 48, 16, 16 }, // slider_small_handle_vert +{ 48, 64, 16, 16 }, // slider_big_vert_mid +{ 48, 80, 16, 16 }, // slider_big_vert_end +{ 0, 384, 16, 16 }, // screen_thick_topleft +{ 16, 384, 16, 16 }, // screen_thick_topmid +{ 32, 384, 16, 16 }, // screen_thick_topright +{ 0, 400, 16, 16 }, // screen_thick_midleft +{ 16, 400, 16, 16 }, // screen_thick_midmid +{ 32, 400, 16, 16 }, // screen_thick_midright +{ 0, 416, 16, 16 }, // screen_thick_btmleft +{ 16, 416, 16, 16 }, // screen_thick_btmmid +{ 32, 416, 16, 16 }, // screen_thick_btmright +{ 48, 384, 16, 16 }, // screen_transparent_topleft +{ 64, 384, 16, 16 }, // screen_transparent_topmid +{ 80, 384, 16, 16 }, // screen_transparent_topright +{ 48, 400, 16, 16 }, // screen_transparent_midleft +{ 64, 400, 16, 16 }, // screen_transparent_midmid +{ 80, 400, 16, 16 }, // screen_transparent_midright +{ 48, 416, 16, 16 }, // screen_transparent_btmleft +{ 64, 416, 16, 16 }, // screen_transparent_btmmid +{ 80, 416, 16, 16 }, // screen_transparent_btmright +{ 96, 384, 16, 16 }, // screen_info_topleft +{ 112, 384, 16, 16 }, // screen_info_topmid +{ 128, 384, 16, 16 }, // screen_info_topright +{ 96, 400, 16, 16 }, // screen_info_midleft +{ 112, 400, 16, 16 }, // screen_info_midmid +{ 128, 400, 16, 16 }, // screen_info_midright +{ 96, 416, 16, 16 }, // screen_info_btmleft +{ 112, 416, 16, 16 }, // screen_info_btmmid +{ 128, 416, 16, 16 }, // screen_info_btmright +{ 144, 384, 16, 16 }, // screen_textbox_topleft +{ 160, 384, 16, 16 }, // screen_textbox_topmid +{ 176, 384, 16, 16 }, // screen_textbox_topright +{ 144, 400, 16, 16 }, // screen_textbox_midleft +{ 160, 400, 16, 16 }, // screen_textbox_midmid +{ 176, 400, 16, 16 }, // screen_textbox_midright +{ 144, 416, 16, 16 }, // screen_textbox_btmleft +{ 160, 416, 16, 16 }, // screen_textbox_btmmid +{ 176, 416, 16, 16 }, // screen_textbox_btmright +{ 192, 384, 16, 16 }, // screen_list_topleft +{ 208, 384, 16, 16 }, // screen_list_topmid +{ 224, 384, 16, 16 }, // screen_list_topright +{ 192, 400, 16, 16 }, // screen_list_midleft +{ 208, 400, 16, 16 }, // screen_list_midmid +{ 224, 400, 16, 16 }, // screen_list_midright +{ 192, 416, 16, 16 }, // screen_list_btmleft +{ 208, 416, 16, 16 }, // screen_list_btmmid +{ 224, 416, 16, 16 } // screen_list_btmright }; +#define GUI_COMPOSITE_BOX(name) { name ## _topleft, name ## _topmid, name ## _topright, name ## _midleft, name ## _midmid, name ## _midright, name ## _btmleft, name ## _btmmid, name ## _btmright } + +enum gui_composite_box_enum +{ + button_big_box, + screen_thick_box, + screen_transparent_box, + screen_info_box, + screen_textbox_box, + screen_list_box, +}; + +struct gui_composite_box +{ + gui_parts_enum part_topleft, part_topmid, part_topright; + gui_parts_enum part_midleft, part_midmid, part_midright; + gui_parts_enum part_btmleft, part_btmmid, part_btmright; +}; + +gui_composite_box boxes[] = +{ + GUI_COMPOSITE_BOX(button_big), + GUI_COMPOSITE_BOX(screen_thick), + GUI_COMPOSITE_BOX(screen_transparent), + GUI_COMPOSITE_BOX(screen_info), + GUI_COMPOSITE_BOX(screen_textbox), + GUI_COMPOSITE_BOX(screen_list), +}; int gui_tileset_texture; -void draw_part(gui_parts_enum part, gui_tileset_enum tileset, float x, float y, float w, float h) +void draw_part(gui_part part, gui_tileset_enum tileset, float x, float y, float w, float h) { const float tex_w = 512.0, tex_h = 512.0; - const gui_part p = parts[part]; - const float start_x = p.x/tex_w, start_y = p.y/tex_h, f_w = p.w/tex_w, f_h = p.h/tex_h; + const float start_x = part.x/tex_w, start_y = part.y/tex_h, f_w = part.w/tex_w, f_h = part.h/tex_h; float ts_x, ts_y; @@ -143,7 +270,12 @@ void draw_part(gui_parts_enum part, gui_tileset_enum tileset, float x, float y, ts_y+start_y+f_h); // endy gfx_quads_drawTL(x,y,w,h); gfx_quads_end(); - +} + + +void draw_part(gui_parts_enum part, gui_tileset_enum tileset, float x, float y, float w, float h) +{ + draw_part(parts[part], tileset, x, y, w, h); } void draw_part(gui_parts_enum part, gui_tileset_enum tileset, float x, float y) @@ -151,6 +283,39 @@ void draw_part(gui_parts_enum part, gui_tileset_enum tileset, float x, float y) draw_part(part, tileset, x, y, parts[part].w, parts[part].h); } +void draw_box(gui_composite_box_enum box, gui_tileset_enum tileset, float x, float y, float w, float h) +{ + gui_composite_box b = boxes[box]; + + gui_part topleft_p = parts[b.part_topleft]; + gui_part topmid_p = parts[b.part_topmid]; + gui_part topright_p = parts[b.part_topright]; + gui_part midleft_p = parts[b.part_midleft]; + gui_part btmleft_p = parts[b.part_btmleft]; + + float scale = h / (topleft_p.h + midleft_p.h + btmleft_p.h); + scale = 1.0; + + float topleft_w = scale * topleft_p.w; + float topright_w = scale * topright_p.w; + float topmid_w = w - topright_w - topleft_w; + float topleft_h = scale * topleft_p.h; + float btmleft_h = scale * btmleft_p.h; + float midleft_h = h - topleft_h - btmleft_h; + + draw_part(b.part_topleft, tileset, x, y); + draw_part(b.part_topmid, tileset, x + topleft_w, y, topmid_w, topleft_h); + draw_part(b.part_topright, tileset, x + topleft_w + topmid_w, y); + + draw_part(b.part_midleft, tileset, x, y + topleft_h, topright_w, midleft_h); + draw_part(b.part_midmid, tileset, x + topleft_w, y + topleft_h, topmid_w, midleft_h); + draw_part(b.part_midright, tileset, x + topleft_w + topmid_w, y + topleft_h, topright_w, midleft_h); + + draw_part(b.part_btmleft, tileset, x, y + topleft_h + midleft_h); + draw_part(b.part_btmmid, tileset, x + topleft_w, y + topleft_h + midleft_h, topmid_w, btmleft_h); + draw_part(b.part_btmright, tileset, x + topleft_w + topmid_w, y + topleft_h + midleft_h); +} + struct pretty_font { char m_CharStartTable[256]; @@ -188,24 +353,8 @@ int not_empty_item_texture; int empty_item_texture; int active_item_texture; int selected_item_texture; -int join_button_texture; -int join_button_hot_texture; -int join_button_active_texture; -int join_button_grey_texture; -int quit_button_texture; -int quit_button_hot_texture; -int quit_button_active_texture; -int up_button_texture; -int up_button_active_texture; -int down_button_texture; -int down_button_active_texture; int teewars_banner_texture; -int scroll_indicator_texture; int connect_localhost_texture; -int refresh_button_texture; -int refresh_button_hot_texture; -int refresh_button_active_texture; -int input_box_texture; int music_menu; int music_menu_id = -1; @@ -218,13 +367,8 @@ struct button_textures }; button_textures connect_localhost_button = { &connect_localhost_texture, &connect_localhost_texture, &connect_localhost_texture }; -button_textures join_button = { &join_button_texture, &join_button_hot_texture, &join_button_active_texture }; -button_textures quit_button = { &quit_button_texture, &quit_button_hot_texture, &quit_button_active_texture }; -button_textures scroll_up_button = { &up_button_texture, &up_button_texture, &up_button_active_texture }; -button_textures scroll_down_button = { &down_button_texture, &down_button_texture, &down_button_active_texture }; button_textures list_item_button = { ¬_empty_item_texture, &active_item_texture, &active_item_texture }; button_textures selected_item_button = { &selected_item_texture, &selected_item_texture, &selected_item_texture }; -button_textures refresh_button = { &refresh_button_texture, &refresh_button_hot_texture, &refresh_button_active_texture }; void draw_menu_button(void *id, const char *text, int checked, float x, float y, float w, float h, void *extra) { @@ -247,7 +391,7 @@ void draw_menu_button(void *id, const char *text, int checked, float x, float y, gfx_quads_end(); gfx_texture_set(current_font->font_texture); - gfx_pretty_text(x + 4, y - 3.5f, 18.f, text); + gfx_pretty_text(x + 8.f, y - 7.f, 36.f, text); } void draw_image_button(void *id, const char *text, int checked, float x, float y, float w, float h, void *extra) @@ -271,6 +415,7 @@ void draw_single_part_button(void *id, const char *text, int checked, float x, f void draw_teewars_button(void *id, const char *text, int checked, float x, float y, float w, float h, void *extra) { + float text_width = gfx_pretty_text_width(46.f, text); gui_tileset_enum tileset; if (ui_active_item() == id && ui_hot_item() == id) @@ -280,25 +425,14 @@ void draw_teewars_button(void *id, const char *text, int checked, float x, float else tileset = tileset_regular; - gui_part begin_p = parts[button_big_begin]; - gui_part mid_p = parts[button_big_mid]; - gui_part end_p = parts[button_big_end]; + if ((int)(int *)extra == 1) + tileset = tileset_inactive; - float scale = h / begin_p.h; - - float begin_w = scale * begin_p.w; - float end_w = scale * end_p.w; - float mid_w = w - begin_w - end_w; - - float text_width = gfx_pretty_text_width(23.f, text); - - draw_part(button_big_begin, tileset, x, y, begin_w, h); - draw_part(button_big_mid, tileset, x + begin_w, y, mid_w, h); - draw_part(button_big_end, tileset, x + begin_w + mid_w, y, end_w, h); + draw_box(button_big_box, tileset, x, y, w, h); gfx_texture_set(current_font->font_texture); - gfx_pretty_text(x + w/2 - text_width/2 , y, 23.f, text); + gfx_pretty_text(x + w/2 - text_width/2 , y, 46.f, text); } struct server_info @@ -318,7 +452,6 @@ struct server_list int scroll_index; int selected_index; }; -#include int ui_do_edit_box(void *id, float x, float y, float w, float h, char *str, int str_size) { @@ -356,12 +489,14 @@ int ui_do_edit_box(void *id, float x, float y, float w, float h, char *str, int r = 1; } - ui_do_label(x + 4, y - 3.5f, str); + draw_box(screen_textbox_box, tileset_regular, x, y, w, h); + + ui_do_label(x + 8.f, y - 7.f, str); if (ui_active_item() == id) { - float w = gfx_pretty_text_width(18.0f, str); - ui_do_label(x + 4 + w, y - 3.5f, "_"); + float w = gfx_pretty_text_width(36.0f, str); + ui_do_label(x + 8.f + w, y - 7.f, "_"); } return r; @@ -371,19 +506,22 @@ int do_scroll_bar(void *id, float x, float y, float height, int steps, int last_ { int r = last_index; - if (ui_do_button(&up_button_texture, "", 0, x + 4, y, 8, 8, draw_single_part_button, (void *)slider_big_arrow_up)) + static int up_button; + static int down_button; + + if (ui_do_button(&up_button, "", 0, x + 8, y, 16, 16, draw_single_part_button, (void *)slider_big_arrow_up)) { if (r > 0) --r; } - else if (ui_do_button(&down_button_texture, "", 0, x + 4, y + height - 8, 8, 8, draw_single_part_button, (void *)slider_big_arrow_down)) + else if (ui_do_button(&down_button, "", 0, x + 8, y + height - 16, 16, 16, draw_single_part_button, (void *)slider_big_arrow_down)) { if (r < steps) ++r; } else if (steps > 0) // only if there's actually stuff to scroll through { - int inside = ui_mouse_inside(x, y + 8, 8, height - 16); + int inside = ui_mouse_inside(x, y + 16, 16, height - 32); if (inside && (!ui_active_item() || ui_active_item() == id)) ui_set_hot_item(id); @@ -391,8 +529,8 @@ int do_scroll_bar(void *id, float x, float y, float height, int steps, int last_ { if (ui_mouse_button(0)) { - float pos = ui_mouse_y() - y - 8; - float perc = pos / (height - 16); + float pos = ui_mouse_y() - y - 16; + float perc = pos / (height - 32); r = (int)((steps + 1) * perc); if (r < 0) @@ -409,21 +547,21 @@ int do_scroll_bar(void *id, float x, float y, float height, int steps, int last_ ui_set_hot_item(id); } - draw_part(slider_big_vert_begin, tileset_regular, x + 4, y + 8, 8, 8); - draw_part(slider_big_vert_mid, tileset_regular, x + 4, y + 8 + 8, 8, height - 16 - 16); - draw_part(slider_big_vert_end, tileset_regular, x + 4, y + 8 + 8 + height - 16 - 16, 8, 8); + draw_part(slider_big_vert_begin, tileset_regular, x + 8, y + 16, 16, 16); + draw_part(slider_big_vert_mid, tileset_regular, x + 8, y + 32, 16, height - 32 - 32); + draw_part(slider_big_vert_end, tileset_regular, x + 8, y + height - 32, 16, 16); - draw_part(slider_big_handle_vert, tileset_regular, x, y + 8 + r * ((height - 32) / steps), 16, 8); + draw_part(slider_big_handle_horiz, tileset_regular, x, y + 16 + r * ((height - 64) / steps), 32, 16); return r; } int do_server_list(server_list *list, float x, float y, int visible_items) { - const float spacing = 1.5f; - const float item_height = 14; - const float item_width = 364; - const float real_width = item_width + 10; + const float spacing = 3.f; + const float item_height = 28; + const float item_width = 728; + const float real_width = item_width + 20; const float real_height = item_height * visible_items + spacing * (visible_items - 1); int r = -1; @@ -447,8 +585,8 @@ int do_server_list(server_list *list, float x, float y, int visible_items) sprintf(temp, "%i/%i", item->players, item->max_players); gfx_texture_set(current_font->font_texture); - gfx_pretty_text(x + 300, y + i * item_height + i * spacing - 3.5f, 18.f, temp); - gfx_pretty_text(x + 180, y + i * item_height + i * spacing - 3.5f, 18.f, item->map); + gfx_pretty_text(x + 600, y + i * item_height + i * spacing - 7.f, 36.f, temp); + gfx_pretty_text(x + 360, y + i * item_height + i * spacing - 7.f, 36.f, item->map); if (clicked) { @@ -458,13 +596,11 @@ int do_server_list(server_list *list, float x, float y, int visible_items) } } - list->scroll_index = do_scroll_bar(&list->scroll_index, x + real_width - 8, y, real_height, list->active_count - visible_items, list->scroll_index); + list->scroll_index = do_scroll_bar(&list->scroll_index, x + real_width - 16, y, real_height, list->active_count - visible_items, list->scroll_index); return r; } -#include - char *read_int(char *buffer, int *value) { *value = buffer[0] << 24; @@ -591,7 +727,7 @@ static int menu_render(netaddr4 *server_address, char *str, int max_len) gfx_clear(89/255.f,122/255.f,0.0); // GUI coordsys - gfx_mapscreen(0,0,400.0f,300.0f); + gfx_mapscreen(0,0,800.0f,600.0f); static server_list list; static bool inited = false; @@ -611,11 +747,11 @@ static int menu_render(netaddr4 *server_address, char *str, int max_len) static int64 start = time_get(); float t = double(time_get() - start) / double(time_freq()); - draw_scrolling_background(background_texture, 400, 300, t * 0.01); + draw_scrolling_background(background_texture, 800, 600, t * 0.01); - ui_do_image(teewars_banner_texture, 70, 10, 256, 64); + ui_do_image(teewars_banner_texture, 140, 20, 512, 128); - do_server_list(&list, 10, 80, 8); + do_server_list(&list, 20, 160, 8); /* if (ui_do_button(&connect_localhost_button, "", 0, 15, 250, 64, 24, draw_menu_button, &connect_localhost_button)) @@ -624,16 +760,18 @@ static int menu_render(netaddr4 *server_address, char *str, int max_len) return 1; }*/ - if (ui_do_button(&refresh_button, "Refresh", 0, 220, 210, 85, 24, draw_teewars_button)) + static int refresh_button, join_button, quit_button; + + if (ui_do_button(&refresh_button, "Refresh", 0, 440, 420, 170, 48, draw_teewars_button)) { refresh_list(&list); } if (list.selected_index == -1) { - ui_do_button(&join_button, "Join", 0, 310, 210, 64, 24, draw_teewars_button); + ui_do_button(&join_button, "Join", 0, 620, 420, 128, 48, draw_teewars_button, (void *)1); } - else if (ui_do_button(&join_button, "Join", 0, 310, 210, 64, 24, draw_teewars_button)) + else if (ui_do_button(&join_button, "Join", 0, 620, 420, 128, 48, draw_teewars_button)) { *server_address = list.infos[list.selected_index].address; @@ -642,16 +780,16 @@ static int menu_render(netaddr4 *server_address, char *str, int max_len) return 1; } - const float name_x = 10, name_y = 215; + const float name_x = 20, name_y = 430; - ui_do_label(name_x + 4, name_y - 3.5f, "Name:"); - ui_do_image(input_box_texture, name_x + 50 - 5, name_y - 5, 150 + 10, 14 + 10); - ui_do_edit_box(str, name_x + 50, name_y, 150, 14, str, max_len); + ui_do_label(name_x + 8.f, name_y - 7.f, "Name:"); + //ui_do_image(input_box_texture, name_x + 50 - 5, name_y - 5, 150 + 10, 14 + 10); + ui_do_edit_box(str, name_x + 100, name_y, 300, 28, str, max_len); - if (ui_do_button(&quit_button, "Quit", 0, 310, 245, 64, 25, draw_teewars_button)) + if (ui_do_button(&quit_button, "Quit", 0, 620, 490, 128, 48, draw_teewars_button)) return -1; - ui_do_label(10.0f, 300.0f-20.0f, "Version: " TEEWARS_VERSION); + ui_do_label(20.0f, 600.0f-40.0f, "Version: " TEEWARS_VERSION); return 0; } @@ -668,36 +806,11 @@ void modmenu_init() active_item_texture = gfx_load_texture("data/gui/game_list_item_active.png"); selected_item_texture = gfx_load_texture("data/gui/game_list_item_selected.png"); - join_button_texture = gfx_load_texture("data/gui/join_button.png"); - join_button_hot_texture = gfx_load_texture("data/gui/join_button_hot.png"); - join_button_active_texture = gfx_load_texture("data/gui/join_button_active.png"); - join_button_grey_texture = gfx_load_texture("data/gui/join_button_greyed.png"); - gui_tileset_texture = gfx_load_texture("data/gui/gui_widgets.png"); -// button_not_hilighted_texture = gfx_load_texture("data/gui/game_list_join_button.png"); -// button_hilighted_texture = gfx_load_texture("data/gui/button_hilighted.png"); -// button_active_texture = gfx_load_texture("data/gui/button_active.png"); - - quit_button_texture = gfx_load_texture("data/gui/quit_button.png"); - quit_button_hot_texture = gfx_load_texture("data/gui/quit_button_hot.png"); - quit_button_active_texture = gfx_load_texture("data/gui/quit_button_active.png"); - - up_button_texture = gfx_load_texture("data/gui/scroll_arrow_up.png"); - up_button_active_texture = gfx_load_texture("data/gui/scroll_arrow_up_active.png"); - - down_button_texture = gfx_load_texture("data/gui/scroll_arrow_down.png"); - down_button_active_texture = gfx_load_texture("data/gui/scroll_arrow_down_active.png"); teewars_banner_texture = gfx_load_texture("data/gui_logo.png"); - scroll_indicator_texture = gfx_load_texture("data/gui/scroll_drag.png"); connect_localhost_texture = gfx_load_texture("data/gui/game_list_connect_localhost.png"); - refresh_button_texture = gfx_load_texture("data/gui/refresh_button.png"); - refresh_button_hot_texture = gfx_load_texture("data/gui/refresh_button_hot.png"); - refresh_button_active_texture = gfx_load_texture("data/gui/refresh_button_active.png"); - - input_box_texture = gfx_load_texture("data/gui/input_box.png"); - music_menu = snd_load_wav("data/audio/Music_Menu.wav"); } @@ -731,8 +844,8 @@ int modmenu_render(void *ptr, char *str, int max_len) if(mouse_y > gfx_screenheight()) mouse_y = gfx_screenheight(); // update the ui - mx = (mouse_x/(float)gfx_screenwidth())*400.0f; - my = (mouse_y/(float)gfx_screenheight())*300.0f; + mx = (mouse_x/(float)gfx_screenwidth())*800.0f; + my = (mouse_y/(float)gfx_screenheight())*600.0f; mwx = mx*3.0f; // adjust to zoom and offset mwy = mx*3.0f; // adjust to zoom and offset @@ -751,12 +864,12 @@ int modmenu_render(void *ptr, char *str, int max_len) gfx_quads_begin(); gfx_quads_setcolor(0,0,0,1); gfx_quads_draw_freeform(mx,my,mx,my, - mx+7,my, - mx,my+7); + mx+14,my, + mx,my+14); gfx_quads_setcolor(1,1,1,1); gfx_quads_draw_freeform(mx+1,my+1,mx+1,my+1, - mx+5,my+1, - mx+1,my+5); + mx+10,my+1, + mx+1,my+10); gfx_quads_end(); if (r)