diff options
| author | Jakob Fries <jakob.fries@gmail.com> | 2007-06-01 02:21:46 +0000 |
|---|---|---|
| committer | Jakob Fries <jakob.fries@gmail.com> | 2007-06-01 02:21:46 +0000 |
| commit | 821e6bbe538421556f516c671114b7d748629661 (patch) | |
| tree | 1f9d9c8b42505b9a807e94aaee191934cd7f6590 /src/engine/client | |
| parent | 70a971d4a99675f65a0a4de9f1baa8352e464235 (diff) | |
| download | zcatch-821e6bbe538421556f516c671114b7d748629661.tar.gz zcatch-821e6bbe538421556f516c671114b7d748629661.zip | |
gui things
Diffstat (limited to 'src/engine/client')
| -rw-r--r-- | src/engine/client/client.cpp | 21 | ||||
| -rw-r--r-- | src/engine/client/ui.cpp | 8 | ||||
| -rw-r--r-- | src/engine/client/ui.h | 2 |
3 files changed, 13 insertions, 18 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index dd52608c..20ab0b39 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -17,6 +17,7 @@ #include <engine/lzw.h> #include <engine/versions.h> +#include <engine/config/config.h> using namespace baselib; @@ -282,7 +283,6 @@ public: // data to hold three snapshots // previous, - char name[MAX_NAME_LENGTH]; bool fullscreen; @@ -303,13 +303,6 @@ public: dbg_msg("game", "state change. last=%d current=%d", state, s); state = s; } - - void set_name(const char *new_name) - { - mem_zero(name, MAX_NAME_LENGTH); - strncpy(name, new_name, MAX_NAME_LENGTH); - name[MAX_NAME_LENGTH-1] = 0; - } void set_fullscreen(bool flag) { fullscreen = flag; } @@ -333,7 +326,7 @@ public: packet p(NETMSG_CLIENT_CONNECT); p.write_str(TEEWARS_VERSION); // payload - p.write_str(name); + p.write_str(config.player_name); p.write_str("no clan"); p.write_str("password"); p.write_str("myskin"); @@ -405,7 +398,7 @@ public: else if (get_state() != STATE_CONNECTING && get_state() != STATE_LOADING) { netaddr4 server_address; - int status = modmenu_render(&server_address, name, MAX_NAME_LENGTH); + int status = modmenu_render(&server_address); if (status == -1) set_state(STATE_QUIT); @@ -675,8 +668,11 @@ public: int main(int argc, char **argv) { dbg_msg("client", "starting..."); + config_reset(); + config_load("teewars.cfg"); + netaddr4 server_address(127, 0, 0, 1, 8303); - const char *name = "nameless jerk"; + //const char *name = "nameless jerk"; bool connect_at_once = false; bool fullscreen = true; @@ -699,7 +695,7 @@ int main(int argc, char **argv) { // -n NAME i++; - name = argv[i]; + set_player_name(argv[i]); } else if(argv[i][0] == '-' && argv[i][1] == 'w' && argv[i][2] == 0) { @@ -710,7 +706,6 @@ int main(int argc, char **argv) // start the server client c; - c.set_name(name); c.set_fullscreen(fullscreen); c.run(connect_at_once ? &server_address : 0x0); return 0; diff --git a/src/engine/client/ui.cpp b/src/engine/client/ui.cpp index 85ebeaf7..8f45bf5d 100644 --- a/src/engine/client/ui.cpp +++ b/src/engine/client/ui.cpp @@ -1,3 +1,4 @@ +#include <baselib/system.h> #include <engine/interface.h> #include "ui.h" @@ -16,7 +17,6 @@ struct pretty_font extern pretty_font *current_font; void gfx_pretty_text(float x, float y, float size, const char *text); - static void *hot_item = 0; static void *active_item = 0; static void *becomming_hot_item = 0; @@ -76,11 +76,11 @@ void ui_do_image(int texture, float x, float y, float w, float h) gfx_quads_end(); } -void ui_do_label(float x, float y, char *text) +void ui_do_label(float x, float y, const char *text, float size) { gfx_blend_normal(); gfx_texture_set(current_font->font_texture); - gfx_pretty_text(x, y, 36.f, text); + gfx_pretty_text(x, y, size, 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) @@ -97,7 +97,7 @@ int ui_do_button(void *id, const char *text, int checked, float x, float y, floa ui_set_active_item(id); } - // this gets rid of an annoying bug :< + // this gets rid of an annoying bug :< (but it creates another annoying bug :O) if (!inside && ui_active_item() == id && !ui_mouse_button(0)) ui_set_active_item(0); diff --git a/src/engine/client/ui.h b/src/engine/client/ui.h index 1a420906..268785be 100644 --- a/src/engine/client/ui.h +++ b/src/engine/client/ui.h @@ -26,7 +26,7 @@ int ui_mouse_inside(float x, float y, float w, float h); typedef void (*draw_button_callback)(void *id, const char *text, int checked, float x, float y, float w, float h, void *extra); void ui_do_image(int texture, float x, float y, float w, float h); -void ui_do_label(float x, float y, char *text); +void ui_do_label(float x, float y, const char *text, float size); 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); int ui_do_button(void *id, const char *text, int checked, float x, float y, float w, float h, draw_button_callback draw_func); |