diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-07-20 22:30:11 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-07-20 22:30:11 +0000 |
| commit | c6eb611d8fbfd5825ea96f8d660bef4a6c45be1d (patch) | |
| tree | 81f3bd1e1e70700bfd0328a42b32454ac96bfd98 /src/game | |
| parent | 52c8d980a2b65535df9853d9fcf08cc5e02b0448 (diff) | |
| download | zcatch-c6eb611d8fbfd5825ea96f8d660bef4a6c45be1d.tar.gz zcatch-c6eb611d8fbfd5825ea96f8d660bef4a6c45be1d.zip | |
fixed some bugs
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/menu.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp index 1a6243c9..9e1b34e6 100644 --- a/src/game/client/menu.cpp +++ b/src/game/client/menu.cpp @@ -243,9 +243,12 @@ struct server_list int ui_do_key_reader(void *id, float x, float y, float w, float h, int key) { // process - static bool can_be_selected = true; + static bool mouse_released = true; int inside = ui_mouse_inside(x, y, w, h); int new_key = key; + + if(!ui_mouse_button(0)) + mouse_released = true; if(ui_active_item() == id) { @@ -254,19 +257,18 @@ int ui_do_key_reader(void *id, float x, float y, float w, float h, int key) { new_key = k; ui_set_active_item(0); - can_be_selected = false; + mouse_released = false; } } else if(ui_hot_item() == id) { - if(ui_mouse_button(0)) + if(ui_mouse_button(0) && mouse_released) ui_set_active_item(id); } if(inside) ui_set_hot_item(id); - // draw draw_box(GUI_BOX_SCREEN_INFO, tileset_regular, x, y, w, h); @@ -329,7 +331,7 @@ int ui_do_edit_box(void *id, float x, float y, float w, float h, char *str, int int inside = ui_mouse_inside(x, y, w, h); int r = 0; - if (ui_active_item() == id) + if(ui_last_active_item() == id) { int c = input::last_char(); int k = input::last_key(); @@ -351,6 +353,12 @@ int ui_do_edit_box(void *id, float x, float y, float w, float h, char *str, int } r = 1; } + + if(ui_active_item() == id) + { + if(!ui_mouse_button(0)) + ui_set_active_item(0); + } else if(ui_hot_item() == id) { if(ui_mouse_button(0)) @@ -358,13 +366,13 @@ int ui_do_edit_box(void *id, float x, float y, float w, float h, char *str, int } if(inside) - ui_set_hot_item(id); + ui_set_hot_item(id); draw_box(GUI_BOX_SCREEN_TEXTBOX, tileset_regular, x, y, w, h); ui_do_label(x + 10, y, str, 36); - if (ui_active_item() == id) + if (ui_last_active_item() == id) { float w = gfx_pretty_text_width(36.0f, str); ui_do_label(x + 10 + w, y, "_", 36); |