From 6d44adb7114a0be6ecb1b0fabc6fe69d308cad1c Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Thu, 25 Sep 2008 14:04:02 +0000 Subject: fixed keybindings. reworked the voting a bit. added vote spamming protection. added ingame voting hud. --- src/game/client/components/hud.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/game/client/components/hud.cpp') diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index f2c37b83..86ce6257 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -13,6 +13,8 @@ #include "controls.hpp" #include "camera.hpp" #include "hud.hpp" +#include "voting.hpp" +#include "binds.hpp" HUD::HUD() { @@ -196,12 +198,35 @@ void HUD::render_teambalancewarning() gfx_text_color(1,1,0.5f,1); else gfx_text_color(0.7f,0.7f,0.2f,1.0f); - gfx_text(0x0, 5, 50, 6, text, -1); + gfx_text(0x0, 5, 40, 6, text, -1); gfx_text_color(1,1,1,1); } } } + +void HUD::render_voting() +{ + if(!gameclient.voting->is_voting()) + return; + + gfx_text_color(1,1,1,1); + gfx_text(0x0, 5, 50, 6, gameclient.voting->vote_description(), -1); + + RECT base = {5, 60, 119, 3}; + gameclient.voting->render_bars(base, false); + + char buf[512]; + const char *yes_key = gameclient.binds->get_key("vote yes"); + const char *no_key = gameclient.binds->get_key("vote no"); + str_format(buf, sizeof(buf), "%s - Vote Yes", yes_key); + base.y += base.h+1; + ui_do_label(&base, buf, 6.0f, -1); + + str_format(buf, sizeof(buf), "Vote No - %s", no_key); + ui_do_label(&base, buf, 6.0f, 1); +} + void HUD::render_cursor() { if(!gameclient.snap.local_character) @@ -283,5 +308,6 @@ void HUD::on_render() render_connectionwarning(); render_tunewarning(); render_teambalancewarning(); + render_voting(); render_cursor(); } -- cgit 1.4.1