summaryrefslogtreecommitdiff
path: root/src/gui/widgets/progressindicator.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-07 19:07:04 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-07 19:07:04 +0100
commita3157908d23fd711ea96797dffce064953cb8fb6 (patch)
tree2f237b21118461a9948f3ccb829f62038564dedf /src/gui/widgets/progressindicator.cpp
parent1208d5383a9bfd03f338ccf71fb9764790b2e1a9 (diff)
downloadmana-a3157908d23fd711ea96797dffce064953cb8fb6.tar.gz
mana-a3157908d23fd711ea96797dffce064953cb8fb6.tar.bz2
mana-a3157908d23fd711ea96797dffce064953cb8fb6.tar.xz
mana-a3157908d23fd711ea96797dffce064953cb8fb6.zip
Nicer way of indicating that we're waiting on the server
No longer a dialog with an annoying progress bar (due to going back and forth), but rather a progress indicator that integrates better with the background.
Diffstat (limited to 'src/gui/widgets/progressindicator.cpp')
-rw-r--r--src/gui/widgets/progressindicator.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
new file mode 100644
index 00000000..d67dd101
--- /dev/null
+++ b/src/gui/widgets/progressindicator.cpp
@@ -0,0 +1,64 @@
+/*
+ * The Mana World
+ * Copyright (C) 2010 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "progressindicator.h"
+
+#include "resources/animation.h"
+#include "resources/imageset.h"
+#include "resources/resourcemanager.h"
+
+#include "graphics.h"
+#include "simpleanimation.h"
+
+#include <guichan/widgets/label.hpp>
+
+ProgressIndicator::ProgressIndicator()
+{
+ ResourceManager *rm = ResourceManager::getInstance();
+ ImageSet *images = rm->getImageSet("graphics/gui/progress-indicator.png",
+ 32, 32);
+
+ Animation *anim = new Animation;
+ for (ImageSet::size_type i = 0; i < images->size(); ++i)
+ anim->addFrame(images->get(i), 100, 0, 0);
+
+ mIndicator = new SimpleAnimation(anim);
+
+ setSize(32, 32);
+}
+
+ProgressIndicator::~ProgressIndicator()
+{
+ delete mIndicator;
+}
+
+void ProgressIndicator::logic()
+{
+ mIndicator->update(10);
+}
+
+void ProgressIndicator::draw(gcn::Graphics *graphics)
+{
+ // Draw the indicator centered on the widget
+ const int x = (getWidth() - 32) / 2;
+ const int y = (getHeight() - 32) / 2;
+ mIndicator->draw(static_cast<Graphics*>(graphics), x, y);
+}