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 | |
parent | 17de81fb71b4f91d2e0897f802a36df5630f1eaa (diff) | |
download | Mana-857794d1c02fd0719634bea9674caa8c76d97007.tar.gz Mana-857794d1c02fd0719634bea9674caa8c76d97007.tar.bz2 Mana-857794d1c02fd0719634bea9674caa8c76d97007.tar.xz Mana-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')
-rw-r--r-- | src/graphic/graphic.h | 2 | ||||
-rw-r--r-- | src/gui/chargedialog.cpp | 20 | ||||
-rw-r--r-- | src/gui/chargedialog.h | 5 | ||||
-rw-r--r-- | src/net/protocol.cpp | 2 |
4 files changed, 25 insertions, 4 deletions
diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h index 0b653875..413c9d33 100644 --- a/src/graphic/graphic.h +++ b/src/graphic/graphic.h @@ -42,6 +42,7 @@ class Graphics; #include "../gui/newskill.h" #include "../gui/setup.h" #include "../gui/equipment.h" +#include "../gui/chargedialog.h" #include "../resources/resourcemanager.h" #include "../map.h" #include "spriteset.h" @@ -71,6 +72,7 @@ extern NewSkillDialog *newSkillWindow; extern StatsWindow *statsWindow; extern Setup *setupWindow; extern EquipmentWindow *equipmentWindow; +extern ChargeDialog* chargeDialog; char get_x_offset(char, char); char get_y_offset(char, char); 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 diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp index 40110144..b59a8c68 100644 --- a/src/net/protocol.cpp +++ b/src/net/protocol.cpp @@ -235,4 +235,6 @@ void attack(unsigned short x, unsigned short y, unsigned char direction) { if (monster_id != 0) action(0, monster_id); } + // implement charging attacks here + char_info->lastAttackTime = 0; } |