diff options
author | Kiyoshi Kyokai <kiyoshi.kyokai@gmail.com> | 2005-03-01 04:06:17 +0000 |
---|---|---|
committer | Kiyoshi Kyokai <kiyoshi.kyokai@gmail.com> | 2005-03-01 04:06:17 +0000 |
commit | 857794d1c02fd0719634bea9674caa8c76d97007 (patch) | |
tree | a8f1a7043935e8429d79d9e96c429fced5507f36 /src/gui | |
parent | 17de81fb71b4f91d2e0897f802a36df5630f1eaa (diff) | |
download | mana-client-857794d1c02fd0719634bea9674caa8c76d97007.tar.gz mana-client-857794d1c02fd0719634bea9674caa8c76d97007.tar.bz2 mana-client-857794d1c02fd0719634bea9674caa8c76d97007.tar.xz mana-client-857794d1c02fd0719634bea9674caa8c76d97007.zip |
This is the update for the charge bar. It resets every time an attack message is sent to the server. I still haven't actually worked the timer into this. I'd appreciate it if someone would explain how. Thanks.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chargedialog.cpp | 20 | ||||
-rw-r--r-- | src/gui/chargedialog.h | 5 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp index 17c280c2..0d65c6b3 100644 --- a/src/gui/chargedialog.cpp +++ b/src/gui/chargedialog.cpp @@ -29,13 +29,15 @@ #include "scrollarea.h" #include "button.h" #include "../main.h" - +#include <time.h> ChargeDialog::ChargeDialog(): Window("") { - setSize(200,100); - progBar = new ProgressBar(0.0f,50,40,100,15,128,128,128); + + + setSize(180,70); + progBar = new ProgressBar(0.0f,20,40,140,25,128,128,128); add(progBar); } @@ -49,3 +51,15 @@ void ChargeDialog::action(const std::string& eventId) } +// update the dialog +void ChargeDialog::draw(gcn::Graphics *graphics) +{ + // calculate time since the last attack was made + char_info->lastAttackTime += .01; // this a hack until someone explains + // to me how to work the timer + if(char_info->lastAttackTime > 1){char_info->lastAttackTime=1;} + + // reset the progress bar to display accurate time since attack + progBar->setProgress(char_info->lastAttackTime); + Window::draw(graphics); +}
\ No newline at end of file diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h index 5bc192fd..7d47a732 100644 --- a/src/gui/chargedialog.h +++ b/src/gui/chargedialog.h @@ -27,6 +27,8 @@ #include "window.h" #include "progressbar.h" +#define CHARGE_TIME 1000 // time in milliseconds it takes to charge up an attack + class ChargeDialog : public Window, public gcn::ActionListener { private: @@ -45,7 +47,8 @@ class ChargeDialog : public Window, public gcn::ActionListener ~ChargeDialog(); // action listener - void action(const std::string&); + void action(const std::string&); + void draw(gcn::Graphics *graphics); }; #endif |