|
From: Tapio V. <aa...@us...> - 2010-09-16 11:19:19
|
Module: performous
Branch: master
Commit: 5e0dc2a36b157d1a7e5ca7111674ba1a933b985d
Author: Tapio Vierros <tap...@gm...>
Date: Thu Sep 16 14:18:37 2010 +0300
Loading bar for loading.
---
game/glutil.hh | 4 ++--
game/screenmanager.cc | 9 +++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/game/glutil.hh b/game/glutil.hh
index c30c6ee..4c2551b 100644
--- a/game/glutil.hh
+++ b/game/glutil.hh
@@ -84,8 +84,8 @@ namespace glutil {
/// easy square
struct Square {
- Square(float cx, float cy, float r) {
- Begin line(GL_LINE_LOOP);
+ Square(float cx, float cy, float r, bool filled = false) {
+ Begin line(filled ? GL_QUADS : GL_LINE_LOOP);
glVertex2f(cx-r,cy+r);
glVertex2f(cx-r,cy-r);
glVertex2f(cx+r,cy-r);
diff --git a/game/screenmanager.cc b/game/screenmanager.cc
index 27e4b77..f7bcb51 100644
--- a/game/screenmanager.cc
+++ b/game/screenmanager.cc
@@ -1,6 +1,7 @@
#include "screen.hh"
#include "fs.hh"
#include "configuration.hh"
+#include "glutil.hh"
#include <boost/thread.hpp>
#include <boost/lexical_cast.hpp>
@@ -44,6 +45,14 @@ void ScreenManager::loading(std::string const& message, float progress) {
flashMessage(message + " " + boost::lexical_cast<std::string>(progress*100) + "%", 0.0f, 1.0f, 1.0f);
m_window.blank();
drawNotifications();
+ const int maxi = 20;
+ const float x = 0.3;
+ const float spacing = 0.01;
+ const float sq_size = (2*x - (maxi-1)*spacing) / maxi;
+ for (int i = 0; i <= progress * maxi; ++i) {
+ glColor4f(0.2f, 0.7f, 0.7f, (progress + 1)*0.5f);
+ glutil::Square(-x + i * (sq_size + spacing), 0, sq_size/2, true);
+ }
m_window.swap();
}
|